aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 26 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9b3aa10..38e846e 100644
--- a/Makefile
+++ b/Makefile
@@ -39,9 +39,11 @@ out/transform-dis.o: $(GENERATED)
LIB_OBJS := \
out/darwin/find-syms.o \
out/darwin/inject.o \
+ out/darwin/inject-asm.o \
out/darwin/interpose.o \
out/darwin/objc-asm.o \
out/darwin/objc.o \
+ out/darwin/read.o \
out/darwin/substrate-compat.o \
out/jump-dis.o \
out/transform-dis.o
@@ -49,6 +51,28 @@ LIB_OBJS := \
out/libsubstitute.dylib: $(LIB_OBJS)
$(CC) -o $@ $(LIB_OBJS) $(LIB_LDFLAGS)
+# this doesn't need to be done on the building machine, just in case someone is
+# trying to build with some Linux compiler that doesn't support all the
+# architectures or something - meh
+ASCLANG := clang -dynamiclib -nostartfiles -nodefaultlibs
+out/inject-asm-raw-x86_64.o: lib/darwin/inject-asm-raw.S Makefile
+ $(ASCLANG) -arch x86_64 -o $@ $<
+out/inject-asm-raw-i386.o: lib/darwin/inject-asm-raw.S Makefile
+ $(ASCLANG) -arch i386 -o $@ $<
+out/inject-asm-raw-arm.o: lib/darwin/inject-asm-raw.S Makefile
+ $(ASCLANG) -arch armv7 -o $@ $<
+out/inject-asm-raw-arm64.o: lib/darwin/inject-asm-raw.S Makefile
+ $(ASCLANG) -arch arm64 -o $@ $<
+IAR_BINS := out/inject-asm-raw-x86_64.bin out/inject-asm-raw-i386.bin out/inject-asm-raw-arm.bin out/inject-asm-raw-arm64.bin
+out/inject-asm.S: $(IAR_BINS) Makefile
+ for i in x86_64 i386 arm arm64; do \
+ echo ".globl inject_start_$$i"; \
+ echo "inject_start_$$i:"; \
+ echo ".align 2"; \
+ printf ".byte "; \
+ xxd -i < out/inject-asm-raw-$$i.bin | xargs echo; \
+ done > $@
+
define define_test
out/test-$(1): test/test-$(2).[cm]* $(HEADERS) $(GENERATED) Makefile out/libsubstitute.dylib
$(3) -g -o $$@ $$< -Ilib -Isubstrate -Lout -lsubstitute
@@ -70,6 +94,7 @@ $(eval $(call define_test,substrate,substrate,$(CXX) -std=c++98))
$(eval $(call define_test,imp-forwarding,imp-forwarding,$(CC) -std=c11 -framework Foundation -lobjc))
$(eval $(call define_test,objc-hook,objc-hook,$(CC) -std=c11 -framework Foundation -lsubstitute))
$(eval $(call define_test,interpose,interpose,$(CC) -std=c11 -lsubstitute))
+$(eval $(call define_test,inject,inject,$(CC) -std=c11 -lsubstitute))
out/insns-arm.o: test/insns-arm.S Makefile
clang -arch armv7 -c -o $@ $<
@@ -81,7 +106,7 @@ out/insns-libz-arm.o: test/insns-libz-arm.S Makefile
out/insns-libz-thumb2.o: test/insns-libz-arm.S Makefile
clang -arch armv7 -c -o $@ $< -DTHUMB2
-out/insns-%.bin: out/insns-%.o Makefile
+out/%.bin: out/%.o Makefile
segedit -extract __TEXT __text $@ $<
clean: