Makefile 6.09 KB
Newer Older
georgen@google.com's avatar
georgen@google.com committed
1
2
PATH := /usr/bin:/bin:/usr/sbin:/sbin

3
4
ORIG_PATH := $(PATH)
PATH := /usr/bin:/bin:/usr/sbin:/sbin
George Nachman's avatar
George Nachman committed
5
ITERM_PID=$(shell pgrep "iTerm2")
6
7
APPS := /Applications
ITERM_CONF_PLIST = $(HOME)/Library/Preferences/com.googlecode.iterm2.plist
George Nachman's avatar
George Nachman committed
8
9
10
COMPACTDATE=$(shell date +"%Y%m%d")
VERSION = $(shell cat version.txt | sed -e "s/%(extra)s/$(COMPACTDATE)/")
NAME=$(shell echo $(VERSION) | sed -e "s/\\./_/g")
11
CMAKE=/usr/local/bin/cmake
12
13
14

.PHONY: clean all backup-old-iterm restart

15
all: Development
16
dev: Development
17
prod: Deployment
18
debug: Development
George Nachman's avatar
George Nachman committed
19
	/Developer/usr/bin/gdb build/Development/iTerm2.app/Contents/MacOS/iTerm
20
21
22
23
24

TAGS:
	find . -name "*.[mhMH]" -exec etags -o ./TAGS -a '{}' +

install: | Deployment backup-old-iterm
George Nachman's avatar
George Nachman committed
25
	cp -R build/Deployment/iTerm2.app $(APPS)
26

georgen@google.com's avatar
georgen@google.com committed
27
Development:
28
	echo "Using PATH for build: $(PATH)"
George Nachman's avatar
George Nachman committed
29
	xcodebuild -parallelizeTargets -target iTerm2 -configuration Development && \
georgen@google.com's avatar
georgen@google.com committed
30
31
	chmod -R go+rX build/Development

32
Dep:
George Nachman's avatar
George Nachman committed
33
	xcodebuild -parallelizeTargets -target iTerm2 -configuration Deployment
34

35
Beta:
36
	cp plists/beta-iTerm2.plist plists/iTerm2.plist
37
	xcodebuild -parallelizeTargets -target iTerm2 -configuration Beta && \
38
	chmod -R go+rX build/Beta
39

georgen@google.com's avatar
georgen@google.com committed
40
Deployment:
George Nachman's avatar
George Nachman committed
41
	xcodebuild -parallelizeTargets -target iTerm2 -configuration Deployment && \
georgen@google.com's avatar
georgen@google.com committed
42
43
	chmod -R go+rX build/Deployment

44
Nightly: force
45
	cp plists/nightly-iTerm2.plist plists/iTerm2.plist
46
	xcodebuild -parallelizeTargets -target iTerm2 -configuration Nightly && git checkout -- plists/iTerm2.plist
47
48
	chmod -R go+rX build/Nightly

georgen@google.com's avatar
georgen@google.com committed
49
run: Development
50
	build/Development/iTerm2.app/Contents/MacOS/iTerm2
georgen@google.com's avatar
georgen@google.com committed
51

George Nachman's avatar
George Nachman committed
52
53
devzip: Development
	cd build/Development && \
George Nachman's avatar
George Nachman committed
54
	zip -r iTerm2-$(NAME).zip iTerm2.app
George Nachman's avatar
George Nachman committed
55

georgen@google.com's avatar
georgen@google.com committed
56
57
zip: Deployment
	cd build/Deployment && \
George Nachman's avatar
George Nachman committed
58
	zip -r iTerm2-$(NAME).zip iTerm2.app
georgen@google.com's avatar
georgen@google.com committed
59
60
61
62
63

clean:
	rm -rf build
	rm -f *~

64
backup-old-iterm:
George Nachman's avatar
George Nachman committed
65
66
67
68
	if [[ -d $(APPS)/iTerm2.app.bak ]] ; then rm -fr $(APPS)/iTerm2.app.bak ; fi
	if [[ -d $(APPS)/iTerm2.app ]] ; then \
	/bin/mv $(APPS)/iTerm2.app $(APPS)/iTerm2.app.bak ;\
	 cp $(ITERM_CONF_PLIST) $(APPS)/iTerm2.app.bak/Contents/ ; \
69
70
71
	fi

restart:
George Nachman's avatar
George Nachman committed
72
	PATH=$(ORIG_PATH) /usr/bin/open /Applications/iTerm2.app &
73
	/bin/kill -TERM $(ITERM_PID)
georgen@google.com's avatar
georgen@google.com committed
74

75
canary:
George Nachman's avatar
George Nachman committed
76
	cp canary-iTerm2.plist iTerm2.plist
77
78
79
80
	make Deployment
	./canary.sh

release:
81
	cp plists/release-iTerm2.plist plists/iTerm2.plist
82
	make Deployment
83

84
85
86
87
preview:
	cp plists/preview-iTerm2.plist plists/iTerm2.plist
	make Deployment

88
x86libsixel: force
89
	cd submodules/libsixel && make clean
90
	cd submodules/libsixel && CFLAGS="-target x86_64-apple-macos10.14" ./configure --prefix=${PWD}/ThirdParty/libsixel --without-libcurl --without-jpeg --without-png --disable-python && make && make install
91
	rm ThirdParty/libsixel/lib/*dylib* ThirdParty/libsixel/bin/*
92
93
	mv ThirdParty/libsixel/lib/libsixel.a ThirdParty/libsixel/lib/libsixel-x86.a

94
armsixel: force
George Nachman's avatar
George Nachman committed
95
	cd submodules/libsixel && ./configure
96
	cd submodules/libsixel && make clean
97
	cd submodules/libsixel && CFLAGS="-target arm64-apple-macos10.14" ./configure --host=aarch64-apple-darwin --prefix=${PWD}/ThirdParty/libsixel-arm --without-libcurl --without-jpeg --without-png --disable-python --disable-shared && CFLAGS="-target arm64-apple-macos10.14" make && make install
98
99
100
	rm ThirdParty/libsixel-arm/bin/*

# Usage: go to an intel mac and run make x86libsixel and commit it. Go to an arm mac and run make armsixel && make libsixel.
101
102
103
fatlibsixel: force
	make armsixel
	make x86libsixel
104
105
	lipo -create -output ThirdParty/libsixel/lib/libsixel.a ThirdParty/libsixel-arm/lib/libsixel.a ThirdParty/libsixel/lib/libsixel-x86.a

106
armopenssl: force
107
	cd submodules/openssl && ./Configure darwin64-arm64-cc && make clean && make build_generated && make libcrypto.a libssl.a -j4 && mv libcrypto.a libcrypto-arm64.a && mv libssl.a libssl-arm64.a
108

109
x86openssl: force
110
	cd submodules/openssl && ./Configure darwin64-x86_64-cc && make clean && make build_generated && make libcrypto.a libssl.a -j4 && mv libcrypto.a libcrypto-x86_64.a && mv libssl.a libssl-x86_64.a
111

112
113
114
fatopenssl: force
	make x86openssl
	make armopenssl
115
116
117
	cd submodules/openssl/ && lipo -create -output libcrypto.a libcrypto-x86_64.a libcrypto-arm64.a
	cd submodules/openssl/ && lipo -create -output libssl.a libssl-x86_64.a libssl-arm64.a

118
x86libssh2: force
119
120
121
	mkdir -p submodules/libssh2/build_x86_64
	cd submodules/libssh2/build_x86_64 && /usr/local/bin/cmake -DOPENSSL_ROOT_DIR=${PWD}/submodules/openssl -DBUILD_EXAMPLES=NO -DBUILD_TESTING=NO -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCRYPTO_BACKEND=OpenSSL .. && make libssh2 -j4

122
armlibssh2: force
123
124
125
	mkdir -p submodules/libssh2/build_arm64
	cd submodules/libssh2/build_arm64 && /usr/local/bin/cmake -DOPENSSL_ROOT_DIR=${PWD}/submodules/openssl -DBUILD_EXAMPLES=NO -DBUILD_TESTING=NO -DCMAKE_OSX_ARCHITECTURES=arm64 -DCRYPTO_BACKEND=OpenSSL .. && make libssh2 -j4

126
fatlibssh2: force fatopenssl
127
128
	make x86libssh2
	make armlibssh2
129
130
131
	cd submodules/libssh2 && lipo -create -output libssh2.a build_arm64/src/libssh2.a build_x86_64/src/libssh2.a
	cp submodules/libssh2/libssh2.a submodules/NMSSH/NMSSH-OSX/Libraries/lib/libssh2.a
	cp submodules/openssl/libcrypto.a submodules/openssl/libssl.a submodules/NMSSH/NMSSH-OSX/Libraries/lib/
132

133
134
CoreParse: force
	rm -rf ThirdParty/CoreParse.framework
George Nachman's avatar
George Nachman committed
135
136
	cd submodules/CoreParse && xcodebuild -target CoreParse -configuration Release CONFIGURATION_BUILD_DIR=../../ThirdParty VALID_ARCHS="arm64 x86_64"
	cp "submodules/CoreParse//CoreParse/Tokenisation/Token Recognisers/CPRegexpRecogniser.h" ThirdParty/CoreParse.framework/Versions/A/Headers/CPRegexpRecogniser.h
137

138
NMSSH: force fatlibssh2
139
140
141
	rm -rf ThirdParty/NMSSH.framework
	cd submodules/NMSSH && xcodebuild -target NMSSH -project NMSSH.xcodeproj -configuration Release CONFIGURATION_BUILD_DIR=../../ThirdParty

142
143
144
145
libgit2: force
	mkdir -p submodules/libgit2/build
	MAKE=/usr/local/bin/cmake PATH=/usr/local/bin:${PATH} cd submodules/libgit2/build && ${CMAKE} -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" -DCMAKE_INSTALL_PREFIX=../../../ThirdParty/libgit2 .. && ${CMAKE} -j22 --build . && ${CMAKE} --build . -j22 --target install

146
147
148
149
150
151
152
deps: force
	make fatlibsixel
	make fatopenssl
	make fatlibssh2
	make CoreParse
	make NMSSH
       
153
154
155
powerline-extra-symbols: force
	cp submodules/powerline-extra-symbols/src/*eps ThirdParty/PowerlineExtraSymbols/

156
force: