]> git.saurik.com Git - cycript.git/blobdiff - Darwin.mk
Found a memory management mistake (new Instance should not be transient) while workin...
[cycript.git] / Darwin.mk
index 0d9a08383779dbcd42f9882d091999c525c21694..c95a5947ff2b0ba5dd483418095947525af3ebcd 100644 (file)
--- a/Darwin.mk
+++ b/Darwin.mk
@@ -1,16 +1,29 @@
-# XXX: objective-c exists on non-Darwin
-
 dll := dylib
 dll := dylib
-header += Struct.hpp ObjectiveC.hpp
-code += ObjectiveC.o Library.o
-filters += ObjC
-flags += -DCY_ATTACH -DCY_EXECUTE
 link += -lobjc -framework CoreFoundation
 console += -framework Foundation
 library += -install_name /usr/lib/libcycript.$(dll)
 link += -lobjc -framework CoreFoundation
 console += -framework Foundation
 library += -install_name /usr/lib/libcycript.$(dll)
-library += -framework Foundation -framework CFNetwork
-library += -framework JavaScriptCore -framework WebCore
-library += -lsubstrate
+library += -framework Foundation
+library += -framework JavaScriptCore
+# XXX: do I just need WebCore?
+library += -framework WebKit
+library += -liconv
+flags += -I/usr/include/ffi
+apr_config := /usr/bin/apr-1-config
+
+ifeq ($(uname_p),i386)
+flags += -m32
+endif
+
+flags += -DCY_ATTACH
+code += Handler.o
+inject += Mach/Inject.o
+Mach/Inject.o: Trampoline.t.hpp Baton.hpp
+
+%.t.hpp: %.t.cpp
+       $(target)gcc -c -fno-exceptions -Iinclude -o $*.t.o $< $(flags) && { file=($$($(target)otool -l $*.t.o | sed -e 'x; /^1/ { x; /^ *filesize / { s/^.* //; p; }; /^ *fileoff / { s/^.* //; p; }; x; }; x; /^ *cmd LC_SEGMENT$$/ { s/.*/1/; x; }; d;')); od -t x1 -j $${file[0]} -N $${file[1]} $*.t.o | sed -e 's/^[^ ]*//' | tr $$'\n' ' ' | sed -e 's/  */ /g;s/^ *//;s/ $$//;s/ /,/g;s/\([^,][^,]\)/0x\1/g' | sed -e 's/^/static const char $*_[] = {/;s/$$/};/' && echo && echo "/*" && $(target)otool -vVt $*.t.o && echo "*/"; } >$@ && rm -f $*.t.o
+
+clean::
+       rm -f Trampoline.t.hpp
 
 
-Struct.hpp:
-       $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
+include Execute.mk
+include ObjectiveC.mk