-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (31 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
TEMPORARY_FOLDER?=./xcstats-build
PREFIX?=/usr/local
SWIFT_BUILD_FLAGS=--disable-sandbox -c release
EXECUTABLE_NAME=xcstats
BUILD_OUTPUT_PATH=$(shell swift build $(SWIFT_BUILD_FLAGS) --show-bin-path)
PORTABLE_ZIP_NAME=$(TEMPORARY_FOLDER)/xcstats_portable.zip
all: build
clean:
rm -f "$(OUTPUT_PACKAGE)"
rm -rf "$(TEMPORARY_FOLDER)"
rm -f "$(PORTABLE_ZIP_NAME)"
swift package clean
clean_xcode:
$(BUILD_TOOL) $(XCODEFLAGS) -configuration Test clean
build:
swift build $(SWIFT_BUILD_FLAGS)
install: build
mkdir -p "$(PREFIX)/bin"
mkdir -p "$(PREFIX)/lib"
cp -f "$(BUILD_OUTPUT_PATH)/$(EXECUTABLE_NAME)" "$(PREFIX)/bin/$(EXECUTABLE_NAME)"
cp -f "$(BUILD_OUTPUT_PATH)/libSwiftSyntax.dylib" "$(PREFIX)/lib/libSwiftSyntax.dylib"
uninstall:
rm "$(PREFIX)/bin/$(EXECUTABLE_NAME)"
rm "$(PREFIX)/lib/libSwiftSyntax.dylib"
xcodeproj:
swift package generate-xcodeproj
portable_zip: build
mkdir -p "$(TEMPORARY_FOLDER)"
cp -f "$(EXECUTABLE_PATH)" "$(TEMPORARY_FOLDER)/$(EXECUTABLE_NAME)"
cp -f "LICENSE" "$(TEMPORARY_FOLDER)"
(cd "$(TEMPORARY_FOLDER)"; zip -yr - "$(EXECUTABLE_NAME)" "LICENSE") > "$(PORTABLE_ZIP_NAME)"