]> git.saurik.com Git - cycript.git/blob - xcode.mk
22716521c8be1cc09bbeb655ee25cb9fdfc6f9ad
[cycript.git] / xcode.mk
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
36 build-mac:
37 $(MAKE) -C build.mac
38
39 build-ios:
40 $(MAKE) -C build.ios
41
42 build-sim:
43 $(MAKE) -C build.sim
44
45 # make stubbornly refuses to believe that these @'s are bugs
46 # http://osdir.com/ml/help-make-gnu/2012-04/msg00008.html
47
48 build.mac/.libs/cycript: build-mac
49 @
50 build.mac/.libs/libcycript.dylib: build-mac
51 @
52 build.mac/.libs/libcycript-any.dylib: build-mac
53 @
54
55 build.ios/.libs/cycript: build-ios
56 @
57 build.ios/.libs/libcycript.dylib: build-ios
58 @
59 build.ios/.libs/libcycript-any.dylib: build-ios
60 @
61 build.ios/.libs/libcycript.a: build-ios
62 @
63
64 build.sim/.libs/libcycript.dylib: build-sim
65 @
66 build.sim/.libs/libcycript.a: build-sim
67 @
68
69 .libs/%: build.mac/.libs/% build.ios/.libs/%
70 @mkdir -p .libs
71 lipo -create -output $@ $^
72
73 .libs/%-ios.a: build.ios/.libs/%.a build.sim/.libs/%.a
74 @mkdir -p .libs
75 lipo -create -output $@ $^
76
77 .libs/libcycript-sys.dylib:
78 @mkdir -p .libs
79 ln -sf libcycript.dylib $@
80
81 .libs/libcycript-sim.dylib: build.sim/.libs/libcycript.dylib
82 @mkdir -p .libs
83 cp -af $< $@
84
85 .libs/libcycript-%.o: build.%/.libs/libcycript.a
86 @mkdir -p .libs
87 ld -r -arch $$(lipo -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a
88
89 .libs/libcycript.o: .libs/libcycript-ios.o .libs/libcycript-sim.o
90 lipo -create -output $@ $^
91
92 cycript: cycript.in
93 cp -af $< $@
94 chmod 755 $@
95
96 .PHONY: all clean build-mac build-ios build-sim