file move
[neatcc/cc.git] / Makefile
blobf487d9e761217f8384b4c15b114e5a32504f8371
1 # for arm build
2 ARCH = -DNEATCC_ARM
3 GEN = arch/arm.o
5 # for x86 build
6 #ARCH = -DNEATCC_X86
7 #GEN = arch/x86.o
9 # for x86_64 build
10 #ARCH = -DNEATCC_X64
11 #GEN = arch/x64.o
13 CC = clang
14 CFLAGS = -Wall -Werror -Wno-macro-redefined -Wfatal-errors -O2 $(ARCH)
16 #CC = gcc
17 #CFLAGS = -Wall -Werror -Wfatal-errors -O2 $(ARCH)
19 #CC = musl-gcc
20 #CFLAGS = -Wall -Werror -Wfatal-errors -O2 $(ARCH)
22 LDFLAGS =
24 all: ncc npp
25 %.o: %.c ncc.h
26 $(CC) -c $(CFLAGS) $< -o $*.o
28 # $^ "internal macro" gives a space separated list of command prerequisites
29 # however this feature doesn't seem to be required in POSIX
30 # http://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html
32 ncc: ncc.o tok.o out.o cpp.o gen.o reg.o mem.o $(GEN)
33 $(CC) ncc.o tok.o out.o cpp.o gen.o reg.o mem.o $(GEN) $(LDFLAGS) -o $@
34 npp: npp.o cpp.o
35 $(CC) npp.o cpp.o $(LDFLAGS) -o $@
37 clean:
38 rm -f arch/*.o *.o
40 distclean:
41 rm -f arch/*.o *.o ncc npp