7 flags := -mthumb -g0 -O3 -Wall -Werror -I. -fno-common
 
   8 flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
 
  10 svn := $(shell svnversion)
 
  11 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_iphoneos-arm.deb
 
  12 all := cycript libcycript.dylib libcycript.plist Cycript.dylib #cyrver
 
  14 header := Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
 
  21         rm -f *.o libcycript.dylib cycript libcycript.plist Struct.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh
 
  23 libcycript.plist: Bridge.def
 
  26             grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
 
  28             grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
 
  30             grep '^[EST]' Bridge.def | sed -e 's/^S/0/;s/^T/1/;s/^E/2/' | sed -e 's/^2\(.*\)$$/1\1 i/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
 
  34 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
 
  35         bison -v --report=state $<
 
  41         $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
 
  43 #Parser.hpp: Parser.py Parser.dat
 
  44 #       ./Parser.py <Parser.dat >$@
 
  47         $(target)g++ $(flags) -c -o $@ $<
 
  49 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
 
  50         $(target)g++ $(flags) -c -o $@ $<
 
  52 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
 
  53         $(target)g++ $(flags) -c -o $@ $<
 
  56         $(target)g++ $(flags) -c -o $@ $<
 
  59         $(target)g++ $(flags) -c -o $@ $<
 
  62         $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
 
  63             -lobjc -lapr-1 -lsubstrate \
 
  64             -framework CoreFoundation -framework CFNetwork
 
  67 Cycript.dylib: Connector.o
 
  68         $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
 
  69             -lobjc -lapr-1 -lsubstrate \
 
  70             -framework CoreFoundation
 
  73 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
 
  74         $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
 
  75             -install_name /usr/lib/libcycript.dylib \
 
  76             -lobjc -lapr-1 -lffi -lsubstrate \
 
  77             -framework CoreFoundation -framework Foundation \
 
  78             -framework CFNetwork \
 
  79             -framework JavaScriptCore -framework WebCore
 
  82 cycript: Console.o libcycript.dylib
 
  83         $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
 
  84             -lobjc -lapr-1 -lreadline \
 
  86             -framework Foundation -framework CoreFoundation \
 
  87             -framework JavaScriptCore -framework UIKit
 
  92         mkdir -p package/DEBIAN
 
  93         sed -e 's/#/$(svn)/' control >package/DEBIAN/control
 
  94         mkdir -p package/System/Library/LaunchDaemons
 
  95         cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
 
  96         mkdir -p package/Library/MobileSubstrate/DynamicLibraries
 
  97         if [[ -e Settings.plist ]]; then \
 
  98             mkdir -p package/Library/PreferenceLoader/Preferences; \
 
  99             cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
 
 100             cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
 
 102         if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
 
 103         cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
 
 104         mkdir -p package/usr/{bin,lib,sbin}
 
 105         cp -a libcycript.dylib package/usr/lib
 
 106         cp -a cycript package/usr/bin
 
 107         #cp -a cyrver package/usr/sbin
 
 108         cp -a libcycript.plist package/usr/lib
 
 109         dpkg-deb -b package $(deb)
 
 117 .PHONY: all clean extra package