diff --git a/osx/Makefile b/osx/Makefile new file mode 100644 --- /dev/null +++ b/osx/Makefile @@ -0,0 +1,37 @@ + CC = gcc -g -ggdb + LD = ld + ARCH = -arch i386 + CFLAGS = -Wall -O2 -Iinclude + LDFLAGS = $(ARCH) + NASM = /usr/local/bin/nasm -f macho -Iinclude/ + + TARGETS = helloASM + #TARGETS+= helloC + +OBJECTS = hello.o main.o +ENTRYPOINT = entryPoint + +.SUFFIXES: .c .asm + +.c.o: + @echo Compiling $< ... + @$(CC) -c $(CFLAGS) $(ARCH) -o $@ $< + +.asm.o: + @echo Assembling $< ... + @$(NASM) $< -o $@ + +all: $(TARGETS) + +helloC: $(OBJECTS) + @echo Linking $(OBJECTS) ... + $(CC) $(LDFLAGS) $(OBJECTS) -e $(ENTRYPOINT) -o $@ + +helloASM: hello.o + @echo Linking $(OBJECTS) ... + $(LD) -static -e $(ENTRYPOINT) $< -o $@ + +.PHONY: clean uninstall + +clean: + $(RM) *.o *~ $(TARGETS)