equal
deleted
inserted
replaced
|
1 CC = gcc -g -ggdb |
|
2 LD = ld |
|
3 ARCH = -arch i386 |
|
4 CFLAGS = -Wall -O2 -Iinclude |
|
5 LDFLAGS = $(ARCH) |
|
6 NASM = /usr/local/bin/nasm -f macho -Iinclude/ |
|
7 |
|
8 TARGETS = helloASM |
|
9 #TARGETS+= helloC |
|
10 |
|
11 OBJECTS = hello.o main.o |
|
12 ENTRYPOINT = entryPoint |
|
13 |
|
14 .SUFFIXES: .c .asm |
|
15 |
|
16 .c.o: |
|
17 @echo Compiling $< ... |
|
18 @$(CC) -c $(CFLAGS) $(ARCH) -o $@ $< |
|
19 |
|
20 .asm.o: |
|
21 @echo Assembling $< ... |
|
22 @$(NASM) $< -o $@ |
|
23 |
|
24 all: $(TARGETS) |
|
25 |
|
26 helloC: $(OBJECTS) |
|
27 @echo Linking $(OBJECTS) ... |
|
28 $(CC) $(LDFLAGS) $(OBJECTS) -e $(ENTRYPOINT) -o $@ |
|
29 |
|
30 helloASM: hello.o |
|
31 @echo Linking $(OBJECTS) ... |
|
32 $(LD) -static -e $(ENTRYPOINT) $< -o $@ |
|
33 |
|
34 .PHONY: clean uninstall |
|
35 |
|
36 clean: |
|
37 $(RM) *.o *~ $(TARGETS) |