-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
67 lines (49 loc) · 2.03 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
TEMPORARY_FOLDER :=/tmp/Spelt.dst
PREFIX :=/usr/local
OUTPUT_PACKAGE=Spelt.pkg
OUTPUT_FRAMEWORK=SpeltKit.framework
BINARIES_FOLDER=/usr/local/bin
FRAMEWORKS_FOLDER=/Library/Frameworks
BUILT_BUNDLE=$(TEMPORARY_FOLDER)/Applications/spelt.app
SPELT_BUNDLE=$(BUILT_BUNDLE)/Contents/Frameworks/$(OUTPUT_FRAMEWORK)
SPELT_EXECUTABLE=$(BUILT_BUNDLE)/Contents/MacOS/spelt
COMPONENTS_PLIST=SpeltComponents.plist
VERSION_STRING=$(shell agvtool what-marketing-version -terse1)
XCODEFLAGS=-workspace Spelt.xcworkspace -scheme spelt -configuration Release DSTROOT=$(TEMPORARY_FOLDER)
.PHONY: all bootstrap clean install uninstall installables prefix_install package
all:
xcodebuild $(XCODEFLAGS) build
bootstrap:
carthage bootstrap --use-submodules --platform Mac
clean:
rm -rf "$(TEMPORARY_FOLDER)"
rm -f "$(OUTPUT_PACKAGE)"
xcodebuild $(XCODEFLAGS) clean
install: package
sudo installer -pkg "$(OUTPUT_PACKAGE)" -target /
uninstall:
rm -f "$(PREFIX)/bin/spelt"
rm -rf "$(PREFIX)/Frameworks/SpeltKit.framework"
rm -rf "$(FRAMEWORKS_FOLDER)/$(OUTPUT_FRAMEWORK)"
installables: clean
xcodebuild $(XCODEFLAGS) install
mkdir -p "$(TEMPORARY_FOLDER)$(FRAMEWORKS_FOLDER)" "$(TEMPORARY_FOLDER)$(BINARIES_FOLDER)"
mv -f "$(SPELT_BUNDLE)" "$(TEMPORARY_FOLDER)$(FRAMEWORKS_FOLDER)/$(OUTPUT_FRAMEWORK)"
mv -f "$(SPELT_EXECUTABLE)" "$(TEMPORARY_FOLDER)$(BINARIES_FOLDER)/spelt"
rm -rf "$(BUILT_BUNDLE)"
prefix_install: installables
mkdir -p "$(PREFIX)/Frameworks" "$(PREFIX)/bin"
# Copy Frameworks
cp -Rf "$(TEMPORARY_FOLDER)$(FRAMEWORKS_FOLDER)/$(OUTPUT_FRAMEWORK)" "$(PREFIX)/Frameworks/"
# Copy binary
cp -f "$(TEMPORARY_FOLDER)$(BINARIES_FOLDER)/spelt" "$(PREFIX)/bin/"
# Add runpath search path
install_name_tool -add_rpath "@executable_path/../Frameworks/$(OUTPUT_FRAMEWORK)/Versions/Current/Frameworks/" "$(PREFIX)/bin/spelt"
package: installables
pkgbuild \
--component-plist "$(COMPONENTS_PLIST)" \
--identifier "org.spelt.spelt" \
--install-location "/" \
--root "$(TEMPORARY_FOLDER)" \
--version "$(VERSION_STRING)" \
"$(OUTPUT_PACKAGE)"