]> git.saurik.com Git - cydia.git/blame - makefile
Prefer $@ to hardcode.
[cydia.git] / makefile
CommitLineData
0263db76 1sdks := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
ea958716 2ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
0263db76 3
ea958716 4ios := $(word $(words $(ioss)),$(ioss))
670fdb01 5gcc := 4.2
c21004b9
JF
6
7flags :=
8link :=
9
d1ba8fd3
JF
10ifeq (o,O) # gzip is actually better
11dpkg := /Library/Cydia/bin/dpkg-deb
12ifeq ($(wildcard $(dpkg)),$(dpkg))
13dpkg := $(dpkg) -zlzma
14else
15dpkg := dpkg-deb -zbzip2
16endif
17else
c21004b9 18dpkg := dpkg-deb
d1ba8fd3 19endif
c21004b9 20
0263db76 21sdk := $(sdks)/iPhoneOS$(ios).sdk
ee4120ad
JF
22
23flags += -F$(sdk)/System/Library/PrivateFrameworks
c21004b9
JF
24flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib
25flags += -Wall -Werror -Wno-deprecated-declarations
26flags += -fmessage-length=0
27flags += -g0 -O2
7c8912f8 28flags += -fobjc-exceptions
443b9e05 29flags += -fno-guess-branch-probability
9f9ae81c 30flags += -fvisibility=hidden
7c8912f8
JF
31
32xflags :=
33xflags += -fobjc-call-cxx-cdtors
9f9ae81c 34xflags += -fvisibility-inlines-hidden
c21004b9
JF
35
36link += -framework CoreFoundation
37link += -framework CoreGraphics
38link += -framework Foundation
39link += -framework GraphicsServices
40link += -framework IOKit
41link += -framework JavaScriptCore
42link += -framework QuartzCore
0e371502 43link += -framework SpringBoardServices
c21004b9 44link += -framework SystemConfiguration
c21004b9
JF
45link += -framework WebCore
46link += -framework WebKit
47
48link += -lapr-1
49link += -lapt-pkg
50link += -lpcre
51
52link += -multiply_defined suppress
5f6bff8c 53
e17a8c4f
JF
54uikit :=
55uikit += -framework UIKit
56
57backrow :=
58backrow += -FAppleTV -framework BackRow -framework AppleTV
59
f9ba524a
JF
60version := $(shell ./version.sh)
61
ee4120ad 62#cycc = cycc -r4.2 -i$(ios) -o$@
89b0ea4a 63gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc)
435cb857 64cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
ee4120ad 65
7c8912f8
JF
66dirs := Menes CyteKit Cydia SDURLCache
67
68code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
69code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
25c1dafb 70code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
7c8912f8
JF
71
72source := $(filter %.m,$(code)) $(filter %.mm,$(code))
73source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
74header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
75
76object := $(source)
77object := $(object:.c=.o)
78object := $(object:.cpp=.o)
79object := $(object:.m=.o)
80object := $(object:.mm=.o)
81object := $(object:%=Objects/%)
82
4339c9ef 83images := $(shell find MobileCydia.app/ -type f -name '*.png')
8a4d4662
JF
84images := $(images:%=Images/%)
85
915284a6
JF
86lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
87
e17a8c4f 88all: MobileCydia
dc5812ec 89
5f6bff8c 90clean:
eaa9f122 91 rm -f MobileCydia postinst
8a4d4662 92 rm -rf Objects/ Images/
7c8912f8
JF
93
94Objects/%.o: %.c $(header)
95 @mkdir -p $(dir $@)
96 @echo "[cycc] $<"
97 @$(cycc) -c -o $@ -x c $<
98
99Objects/%.o: %.m $(header)
100 @mkdir -p $(dir $@)
101 @echo "[cycc] $<"
102 @$(cycc) -c -o $@ $< $(flags)
5f6bff8c 103
7c8912f8
JF
104Objects/%.o: %.mm $(header)
105 @mkdir -p $(dir $@)
106 @echo "[cycc] $<"
107 @$(cycc) -c -o $@ $< $(flags) $(xflags)
e95a1972 108
3d45bad1 109Objects/Version.o: version.h
e61d7bfc 110
8a4d4662
JF
111Images/%.png: %.png
112 @mkdir -p $(dir $@)
113 @echo "[pngc] $<"
114 @./pngcrush.sh $< $@
115
0d5393af
JF
116sysroot: sysroot.sh
117 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
8a2c6d14
JF
118 @echo 1>&2
119 @exit 1
120
7c8912f8
JF
121MobileCydia: sysroot $(object)
122 @echo "[link] $(object:Objects/%=%)"
123 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(uikit)
e1b682c5 124 @cp -a $@ $@-$(version)
443b9e05
JF
125 @echo "[strp] $@"
126 @strip -no_uuid $@
7c8912f8 127 @echo "[sign] $@"
443b9e05 128 @ldid -T0 -Slaunch.xml $@ || { rm -f $@ && false; }
03c0f7a9 129
e17a8c4f
JF
130CydiaAppliance: CydiaAppliance.mm
131 $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
132
eaa9f122
JF
133postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
134 $(cycc) $(filter %.mm,$^) $(flags) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
2d46d29e 135 @ldid -T0 -S $@
eaa9f122
JF
136
137debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst $(images) $(shell find MobileCydia.app) cydia.control
7e2bd591 138 sudo rm -rf _
03c0f7a9
JF
139 mkdir -p _/var/lib/cydia
140
33e30380
JF
141 mkdir -p _/etc/apt
142 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
143 cp -a Sources.list _/etc/apt/sources.list.d
144
03c0f7a9 145 mkdir -p _/usr/libexec
c21004b9 146 cp -a Library _/usr/libexec/cydia
7e2bd591 147 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
03c0f7a9
JF
148
149 mkdir -p _/System/Library
c21004b9 150 cp -a LaunchDaemons _/System/Library/LaunchDaemons
03c0f7a9
JF
151
152 mkdir -p _/Applications
e17a8c4f 153 cp -a MobileCydia.app _/Applications/Cydia.app
915284a6 154 rm -rf _/Applications/Cydia.app/*.lproj
e17a8c4f
JF
155 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
156
8a4d4662
JF
157 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
158
4339c9ef
JF
159 mkdir -p _/Applications/Cydia.app/Sources
160 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
5ad3e6d9
JF
161 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
162
e2b57be4
JF
163 #mkdir -p _/Applications/AppleTV.app/Appliances
164 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
165 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
166
e17a8c4f 167 #mkdir -p _/Applications/Lowtide.app/Appliances
e2b57be4 168 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
03c0f7a9 169
03c0f7a9 170 mkdir -p _/DEBIAN
915284a6 171 ./control.sh cydia.control _ >_/DEBIAN/control
eaa9f122 172 cp -a preinst postinst _/DEBIAN/
03c0f7a9 173
8fec9d25 174 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
7fc02989 175
7e2bd591
JF
176 sudo chown -R 0 _
177 sudo chgrp -R 0 _
e17a8c4f 178 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
7e2bd591 179
3adcfba7 180 mkdir -p debs
f9ba524a 181 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
3adcfba7 182 $(dpkg) -b _ Cydia.deb
ce0372db 183 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
8cc774c5 184
33e30380 185$(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
915284a6
JF
186 sudo rm -rf __
187 mkdir -p __/Applications/Cydia.app
188
189 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
190
191 mkdir -p __/DEBIAN
192 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
915284a6
JF
193
194 sudo chown -R 0 __
195 sudo chgrp -R 0 __
196
197 mkdir -p debs
198 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
199 $(dpkg) -b __ Cydia_.deb
200 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
201
202package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
aa60b57b 203
10ff7664 204.PHONY: all clean package