7 #flags := -g3 -O0 -DYYDEBUG=1
 
  10 flags += -Wall -Werror -I. -fno-common
 
  11 flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
 
  13 svn := $(shell svnversion)
 
  14 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_iphoneos-arm.deb
 
  15 all := cycript libcycript.dylib libcycript.plist Cycript.dylib #cyrver
 
  17 header := Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
 
  24         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 cyrver
 
  26 libcycript.plist: Bridge.def
 
  29             grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
 
  31             grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
 
  33             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\");/'; \
 
  37 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
 
  38         bison -v --report=state $<
 
  44         $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
 
  46 #Parser.hpp: Parser.py Parser.dat
 
  47 #       ./Parser.py <Parser.dat >$@
 
  50         $(target)g++ $(flags) -c -o $@ $<
 
  52 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
 
  53         $(target)g++ $(flags) -c -o $@ $<
 
  55 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
 
  56         $(target)g++ $(flags) -c -o $@ $<
 
  59         $(target)g++ $(flags) -c -o $@ $<
 
  62         $(target)g++ $(flags) -c -o $@ $<
 
  65         $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
 
  66             -lobjc -lapr-1 -lsubstrate \
 
  67             -framework CoreFoundation -framework CFNetwork
 
  70 Cycript.dylib: Connector.o
 
  71         $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
 
  72             -lobjc -lapr-1 -lsubstrate \
 
  73             -framework CoreFoundation
 
  76 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
 
  77         $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
 
  78             -install_name /usr/lib/libcycript.dylib \
 
  79             -lobjc -lapr-1 -lffi -lsubstrate \
 
  80             -framework CoreFoundation -framework Foundation \
 
  81             -framework CFNetwork \
 
  82             -framework JavaScriptCore -framework WebCore
 
  85 cycript: Console.o libcycript.dylib
 
  86         $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
 
  87             -lobjc -lapr-1 -lreadline \
 
  89             -framework Foundation -framework CoreFoundation \
 
  90             -framework JavaScriptCore -framework UIKit
 
  95         mkdir -p package/DEBIAN
 
  96         sed -e 's/#/$(svn)/' control >package/DEBIAN/control
 
  97         mkdir -p package/System/Library/LaunchDaemons
 
  98         cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
 
  99         mkdir -p package/Library/MobileSubstrate/DynamicLibraries
 
 100         if [[ -e Settings.plist ]]; then \
 
 101             mkdir -p package/Library/PreferenceLoader/Preferences; \
 
 102             cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
 
 103             cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
 
 105         if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
 
 106         cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
 
 107         mkdir -p package/usr/{bin,lib,sbin}
 
 108         cp -a libcycript.dylib package/usr/lib
 
 109         cp -a cycript package/usr/bin
 
 110         #cp -a cyrver package/usr/sbin
 
 111         cp -a libcycript.plist package/usr/lib
 
 112         dpkg-deb -b package $(deb)
 
 120 .PHONY: all clean extra package