1 # Cycript - Optimizing JavaScript Compiler/Runtime
2 # Copyright (C) 2009-2013 Jay Freeman (saurik)
4 # GNU General Public License, Version 3 {{{
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.
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.
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/>.
25 lipo := $(shell xcrun --sdk iphoneos -f lipo)
28 cycript += Cycript_/cycript
29 cycript += Cycript_/libcycript.dylib
30 cycript += Cycript_/libcycript-any.dylib
31 cycript += Cycript_/libcycript-sys.dylib
32 cycript += Cycript_/libcycript-sim.dylib
35 framework += Cycript.framework/Cycript
36 framework += Cycript.framework/Headers/Cycript.h
38 all: cycript $(cycript) $(framework)
42 zip -r9y $@ cycript Cycript_ Cycript.framework
47 rm -rf cycript Cycript_ libcycript*.o
49 # make stubbornly refuses to believe that these @'s are bugs
50 # http://osdir.com/ml/help-make-gnu/2012-04/msg00008.html
53 .PHONY: build-mac-$(1)
55 $(MAKE) -C build.mac-$(1)
56 build.mac-$(1)/.libs/cycript: build-mac-$(1)
58 build.mac-$(1)/.libs/libcycript.dylib: build-mac-$(1)
60 build.mac-$(1)/.libs/libcycript-any.dylib: build-mac-$(1)
64 $(foreach arch,i386 x86_64,$(eval $(call build_mac,$(arch))))
67 .PHONY: build-ios-$(1)
69 $(MAKE) -C build.ios-$(1)
70 build.ios-$(1)/.libs/libcycript.a: build-ios-$(1)
74 $(foreach arch,armv6 armv7 armv7s,$(eval $(call build_ios,$(arch))))
77 .PHONY: build-sim-$(1)
79 $(MAKE) -C build.sim-$(1)
80 build.sim-$(1)/.libs/libcycript.dylib: build-sim-$(1)
82 build.sim-$(1)/.libs/libcycript.a: build-sim-$(1)
86 $(foreach arch,i386,$(eval $(call build_sim,$(arch))))
89 build.ios-$(1)/.libs/cycript: build-ios-$(1)
91 build.ios-$(1)/.libs/libcycript.dylib: build-ios-$(1)
93 build.ios-$(1)/.libs/libcycript-any.dylib: build-ios-$(1)
97 $(foreach arch,armv6,$(eval $(call build_arm,$(arch))))
99 Cycript_/%: build.mac-i386/.libs/% build.mac-x86_64/.libs/% build.ios-armv6/.libs/%
101 $(lipo) -create -output $@ $^
102 # XXX: this should probably not entitle the dylibs
103 codesign -s $(codesign) --entitlement cycript.xml $@
105 Cycript_/libcycript-sys.dylib:
107 ln -sf libcycript.dylib $@
109 Cycript_/libcycript-sim.dylib: build.sim-i386/.libs/libcycript.dylib
112 codesign -s $(codesign) $@
114 libcycript-%.o: build.%/.libs/libcycript.a
116 ld -r -arch $$($(lipo) -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a
118 libcycript.o: libcycript-ios-armv6.o libcycript-ios-armv7.o libcycript-ios-armv7s.o libcycript-sim-i386.o
119 $(lipo) -create -output $@ $^
121 Cycript.framework/Cycript: libcycript.o
125 Cycript.framework/Headers/Cycript.h: Cycript.h
133 .PHONY: all clean package