diff options
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | main.c | 8 |
2 files changed, 17 insertions, 2 deletions
@@ -1,7 +1,14 @@ CFLAGS = -O0 -g3 -mach_print: main.o mach_print.o - gcc -o mach_print main.o mach_print.o +DEPS = main.o + +# Uncomment to include the portable assembly file. If commented out, the +# inline x86 code is included in main.o instead. +#DEPS += mach_print.o +#CFLAGS += -DEXTERNAL_MACH_PRINT + +mach_print: $(DEPS) + gcc -o $@ $^ clean: rm -f mach_print *.o @@ -7,6 +7,14 @@ void mach_print(const char *); +#ifndef EXTERNAL_MACH_PRINT +asm (".global mach_print;" + " mach_print:;" + " mov $0xffffffe2, %eax;" + " lcall $0x7, $0x0;" + " ret;"); +#endif /* EXTERNAL_MACH_PRINT */ + static void mach_printf(const char *format, ...) { |