]>
Commit | Line | Data |
---|---|---|
3370d0c0 JF |
1 | # Cycript - Optimizing JavaScript Compiler/Runtime |
2 | # Copyright (C) 2009-2013 Jay Freeman (saurik) | |
3 | ||
4 | # GNU General Public License, Version 3 {{{ | |
5 | # | |
6 | # Cycript is free software: you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published | |
8 | # by the Free Software Foundation, either version 3 of the License, | |
9 | # or (at your option) any later version. | |
10 | # | |
11 | # Cycript is distributed in the hope that it will be useful, but | |
12 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with Cycript. If not, see <http://www.gnu.org/licenses/>. | |
18 | # }}} | |
19 | ||
20 | .DELETE_ON_ERROR: | |
21 | SHELL := /bin/bash | |
22 | ||
23 | libs := | |
24 | libs += .libs/cycript | |
25 | libs += .libs/libcycript.dylib | |
26 | libs += .libs/libcycript-any.dylib | |
27 | libs += .libs/libcycript-sys.dylib | |
28 | libs += .libs/libcycript-sim.dylib | |
29 | libs += .libs/libcycript.o | |
30 | ||
31 | all: cycript $(libs) | |
32 | ||
33 | clean: | |
34 | rm -rf cycript .libs | |
35 | ||
3370d0c0 JF |
36 | # make stubbornly refuses to believe that these @'s are bugs |
37 | # http://osdir.com/ml/help-make-gnu/2012-04/msg00008.html | |
38 | ||
abc804fa JF |
39 | define build_mac |
40 | .PHONY: build-mac-$(1) | |
41 | build-mac-$(1): | |
42 | $(MAKE) -C build.mac-$(1) | |
43 | build.mac-$(1)/.libs/cycript: build-mac-$(1) | |
3370d0c0 | 44 | @ |
abc804fa | 45 | build.mac-$(1)/.libs/libcycript.dylib: build-mac-$(1) |
3370d0c0 | 46 | @ |
abc804fa | 47 | build.mac-$(1)/.libs/libcycript-any.dylib: build-mac-$(1) |
3370d0c0 | 48 | @ |
abc804fa | 49 | endef |
3370d0c0 | 50 | |
abc804fa JF |
51 | $(foreach arch,i386 x86_64,$(eval $(call build_mac,$(arch)))) |
52 | ||
53 | define build_ios | |
54 | .PHONY: build-ios-$(1) | |
55 | build-ios-$(1): | |
56 | $(MAKE) -C build.ios-$(1) | |
57 | build.ios-$(1)/.libs/cycript: build-ios-$(1) | |
3370d0c0 | 58 | @ |
abc804fa | 59 | build.ios-$(1)/.libs/libcycript.dylib: build-ios-$(1) |
3370d0c0 | 60 | @ |
abc804fa | 61 | build.ios-$(1)/.libs/libcycript-any.dylib: build-ios-$(1) |
3370d0c0 | 62 | @ |
abc804fa | 63 | build.ios-$(1)/.libs/libcycript.a: build-ios-$(1) |
3370d0c0 | 64 | @ |
abc804fa JF |
65 | endef |
66 | ||
67 | $(foreach arch,armv6 armv7,$(eval $(call build_ios,$(arch)))) | |
3370d0c0 | 68 | |
abc804fa JF |
69 | define build_sim |
70 | .PHONY: build-sim-$(1) | |
71 | build-sim-$(1): | |
72 | $(MAKE) -C build.sim-$(1) | |
73 | build.sim-$(1)/.libs/libcycript.dylib: build-sim-$(1) | |
3370d0c0 | 74 | @ |
abc804fa | 75 | build.sim-$(1)/.libs/libcycript.a: build-sim-$(1) |
3370d0c0 | 76 | @ |
abc804fa JF |
77 | endef |
78 | ||
79 | $(foreach arch,i386,$(eval $(call build_sim,$(arch)))) | |
3370d0c0 | 80 | |
abc804fa | 81 | .libs/%: build.mac-i386/.libs/% build.mac-x86_64/.libs/% build.ios-armv6/.libs/% |
3370d0c0 JF |
82 | @mkdir -p .libs |
83 | lipo -create -output $@ $^ | |
84 | ||
abc804fa | 85 | .libs/%-ios.a: build.ios-armv6/.libs/%.a build.ios-armv7/.libs/%.a build.sim/.libs/%.a |
3370d0c0 JF |
86 | @mkdir -p .libs |
87 | lipo -create -output $@ $^ | |
88 | ||
89 | .libs/libcycript-sys.dylib: | |
90 | @mkdir -p .libs | |
91 | ln -sf libcycript.dylib $@ | |
92 | ||
abc804fa | 93 | .libs/libcycript-sim.dylib: build.sim-i386/.libs/libcycript.dylib |
3370d0c0 JF |
94 | @mkdir -p .libs |
95 | cp -af $< $@ | |
96 | ||
97 | .libs/libcycript-%.o: build.%/.libs/libcycript.a | |
98 | @mkdir -p .libs | |
99 | ld -r -arch $$(lipo -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a | |
100 | ||
abc804fa | 101 | .libs/libcycript.o: .libs/libcycript-ios-armv6.o .libs/libcycript-ios-armv7.o .libs/libcycript-sim-i386.o |
3370d0c0 JF |
102 | lipo -create -output $@ $^ |
103 | ||
104 | cycript: cycript.in | |
105 | cp -af $< $@ | |
106 | chmod 755 $@ | |
107 | ||
abc804fa | 108 | .PHONY: all clean |