~pixelherodev/zyg

70345adf2a3819f7cbe045b7f9078e307cdc4f2d — Noam Preil 5 months ago a5c2d48
smarter makefile
2 files changed, 7 insertions(+), 7 deletions(-)

M Makefile
M profile.sh -rw-r--r-- => -rwxr-xr-x
M Makefile => Makefile +7 -7
@@ 4,16 4,16 @@ CFLAGS=-std=c99 -pedantic -Wall -O2 -march=native -g -D _POSIX_C_SOURCE=200809 -

all:zyg

zyg: driver.o parser.o lexer.o queue.o sema.o lib/z80e/cpu.o lib/z80e/log.o lib/z80e/registers.o
	$(CC) -o $@ $^ -lrt -lc3 $(CFLAGS)
zyg: driver.o parser.o lexer.o queue.o sema.o lib/z80e/cpu.o lib/z80e/log.o lib/z80e/registers.o ../lib/libc3.a
	$(CC) -o $@ $^ -lrt $(CFLAGS)

driver.o lib/z80e/cpu.o lib/z80e/log.o lib/z80e/registers.o: EXTRA_CFLAGS := -Wno-pedantic
../lib/libc3.a: ../lib/*.c ../lib/codegen/*.c ../lib/sema/*.c
	$(MAKE) -C ../lib

make.conf:
	uname -m >make.conf
driver.o lib/z80e/cpu.o lib/z80e/log.o lib/z80e/registers.o: EXTRA_CFLAGS := -Wno-pedantic

%.o: %.c *.h make.conf
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DMACHINE=`cat make.conf` -c $< -o $@
%.o: %.c *.h
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DMACHINE=$(shell uname -m) -c $< -o $@

clean:
	rm -f *.o zyg lib/z80e/*.o

M profile.sh => profile.sh +0 -0