]>
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 | ||
e9abea04 JF |
23 | lipo := $(shell xcrun --sdk iphoneos -f lipo) |
24 | ||
3370d0c0 JF |
25 | libs := |
26 | libs += .libs/cycript | |
27 | libs += .libs/libcycript.dylib | |
28 | libs += .libs/libcycript-any.dylib | |
29 | libs += .libs/libcycript-sys.dylib | |
30 | libs += .libs/libcycript-sim.dylib | |
31 | libs += .libs/libcycript.o | |
32 | ||
33 | all: cycript $(libs) | |
34 | ||
35 | clean: | |
36 | rm -rf cycript .libs | |
37 | ||
3370d0c0 JF |
38 | # make stubbornly refuses to believe that these @'s are bugs |
39 | # http://osdir.com/ml/help-make-gnu/2012-04/msg00008.html | |
40 | ||
abc804fa JF |
41 | define build_mac |
42 | .PHONY: build-mac-$(1) | |
43 | build-mac-$(1): | |
44 | $(MAKE) -C build.mac-$(1) | |
45 | build.mac-$(1)/.libs/cycript: build-mac-$(1) | |
3370d0c0 | 46 | @ |
abc804fa | 47 | build.mac-$(1)/.libs/libcycript.dylib: build-mac-$(1) |
3370d0c0 | 48 | @ |
abc804fa | 49 | build.mac-$(1)/.libs/libcycript-any.dylib: build-mac-$(1) |
3370d0c0 | 50 | @ |
abc804fa | 51 | endef |
3370d0c0 | 52 | |
abc804fa JF |
53 | $(foreach arch,i386 x86_64,$(eval $(call build_mac,$(arch)))) |
54 | ||
55 | define build_ios | |
56 | .PHONY: build-ios-$(1) | |
57 | build-ios-$(1): | |
58 | $(MAKE) -C build.ios-$(1) | |
abc804fa | 59 | build.ios-$(1)/.libs/libcycript.a: build-ios-$(1) |
3370d0c0 | 60 | @ |
abc804fa JF |
61 | endef |
62 | ||
e9abea04 | 63 | $(foreach arch,armv6 armv7 armv7s,$(eval $(call build_ios,$(arch)))) |
3370d0c0 | 64 | |
abc804fa JF |
65 | define build_sim |
66 | .PHONY: build-sim-$(1) | |
67 | build-sim-$(1): | |
68 | $(MAKE) -C build.sim-$(1) | |
69 | build.sim-$(1)/.libs/libcycript.dylib: build-sim-$(1) | |
3370d0c0 | 70 | @ |
abc804fa | 71 | build.sim-$(1)/.libs/libcycript.a: build-sim-$(1) |
3370d0c0 | 72 | @ |
abc804fa JF |
73 | endef |
74 | ||
75 | $(foreach arch,i386,$(eval $(call build_sim,$(arch)))) | |
3370d0c0 | 76 | |
1510e2d9 JF |
77 | define build_arm |
78 | build.ios-$(1)/.libs/cycript: build-ios-$(1) | |
79 | @ | |
80 | build.ios-$(1)/.libs/libcycript.dylib: build-ios-$(1) | |
81 | @ | |
82 | build.ios-$(1)/.libs/libcycript-any.dylib: build-ios-$(1) | |
83 | @ | |
84 | endef | |
85 | ||
86 | $(foreach arch,armv6,$(eval $(call build_arm,$(arch)))) | |
87 | ||
abc804fa | 88 | .libs/%: build.mac-i386/.libs/% build.mac-x86_64/.libs/% build.ios-armv6/.libs/% |
3370d0c0 | 89 | @mkdir -p .libs |
e9abea04 | 90 | $(lipo) -create -output $@ $^ |
3370d0c0 JF |
91 | |
92 | .libs/libcycript-sys.dylib: | |
93 | @mkdir -p .libs | |
94 | ln -sf libcycript.dylib $@ | |
95 | ||
abc804fa | 96 | .libs/libcycript-sim.dylib: build.sim-i386/.libs/libcycript.dylib |
3370d0c0 JF |
97 | @mkdir -p .libs |
98 | cp -af $< $@ | |
99 | ||
100 | .libs/libcycript-%.o: build.%/.libs/libcycript.a | |
101 | @mkdir -p .libs | |
e9abea04 | 102 | ld -r -arch $$($(lipo) -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a |
3370d0c0 | 103 | |
e9abea04 JF |
104 | .libs/libcycript.o: .libs/libcycript-ios-armv6.o .libs/libcycript-ios-armv7.o .libs/libcycript-ios-armv7s.o .libs/libcycript-sim-i386.o |
105 | $(lipo) -create -output $@ $^ | |
3370d0c0 JF |
106 | |
107 | cycript: cycript.in | |
108 | cp -af $< $@ | |
109 | chmod 755 $@ | |
110 | ||
abc804fa | 111 | .PHONY: all clean |