-extra:
- mkdir -p package/usr/{bin,lib}
- mv package/Library/MobileSubstrate/DynamicLibraries/Cyrver.dylib package/usr/lib/libcyrver.dylib
- ln -s /usr/lib/libcyrver.dylib package/Library/MobileSubstrate/DynamicLibraries/Cyrver.dylib
- cp -a cyrver package/usr/bin
-
-cyrver: Application.mm Cyrver.dylib
- $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc Cyrver.dylib -framework JavaScriptCore -F${PKG_ROOT}/System/Library/PrivateFrameworks
- ldid -S cyrver
+%.l: %.l.in
+ ./Filter.sh <$< >$@ $(filters)
+
+Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
+ bison -v --report=state $<
+
+lex.cy.c: Cycript.l
+ flex $<
+
+#Parser.hpp: Parser.py Parser.dat
+# ./Parser.py <Parser.dat >$@
+
+Cycript.tab.o: Cycript.tab.cc $(header)
+ $(target)g++ $(flags) -c -o $@ $<
+
+lex.cy.o: lex.cy.c $(header)
+ $(target)g++ $(flags) -c -o $@ $<
+
+%.o: %.cpp $(header)
+ $(target)g++ $(flags) -c -o $@ $<
+
+#objc := -x c++
+%.o: %.mm $(header)
+ $(target)g++ $(objc) $(flags) -c -o $@ $<
+
+libcycript.$(dll): $(code)
+ $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) $(link)
+ $(ldid) $@
+
+cycript: Console.o libcycript.$(dll)
+ $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(console) $(link)
+ $(ldid) cycript
+
+package: $(deb)
+
+test: $(deb)
+ dpkg -i $(deb)
+ cycript test.cy
+
+.PHONY: all clean extra package