-# XXX: objective-c exists on non-Darwin
-
dll := dylib
link += -lobjc -framework CoreFoundation
console += -framework Foundation
library += -install_name /usr/lib/libcycript.$(dll)
library += -framework Foundation
-library += -framework JavaScriptCore
+console += -framework JavaScriptCore
# XXX: do I just need WebCore?
-library += -framework WebKit
+console += -framework WebKit
+library += -undefined dynamic_lookup
library += -liconv
+flags += -I/usr/include/ffi
+apr_config := /usr/bin/apr-1-config
+flags += -arch i386 -arch x86_64 #-arch armv6
-flags += -DCY_ATTACH
+flags += -DCY_ATTACH -DCY_LIBRARY='"/usr/lib/libcycript.dylib"'
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 $< && { 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
+%.t.hpp: %.t.cpp trampoline.sh Baton.hpp Trampoline.hpp Darwin.mk
+ ./trampoline.sh $@ $*.t.dylib $* sed $(target){otool,lipo,nm,gcc} $(flags) -dynamiclib -g0 -fno-stack-protector -fno-exceptions -Iinclude $< -o $*.t.dylib
+
+clean::
+ rm -f Trampoline.t.hpp
include Execute.mk
include ObjectiveC.mk