scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 2f972eea17a78f21c5ffbce5be12b42ca91cb80c
parent 9c999e2862eb82d8a19b7ba8b2bd42a0256f860e
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sun,  4 Dec 2016 10:34:37 +0100

Makefiles: build a binary for each arch target

This fixes a build issue when common code would be modified while having
a pre-built arch .o file, the arch-specific binary wouldn't be rebuilt.

Diffstat:
MMakefile | 6+++---
Mcc1/Makefile | 10+++++-----
Mcc2/Makefile | 6+++---
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile @@ -20,10 +20,10 @@ $(ARCHS): bin for i in cc1 cc2; \ do \ (cd $$i; \ - ARCH=$@ $(MAKE) -e $$i || exit); \ + ARCH=$@ $(MAKE) -e $$i-$@ || exit); \ done - ln -f cc1/cc1 bin/cc1-$@ - ln -f cc2/cc2 bin/cc2-$@ + ln -f cc1/cc1-$@ bin/ + ln -f cc2/cc2-$@ bin/ bin: mkdir -p bin diff --git a/cc1/Makefile b/cc1/Makefile @@ -6,7 +6,7 @@ include ../config.mk OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \ code.o stmt.o cpp.o fold.o init.o arch/$(ARCH)/arch.o -all: cc1 +all: cc1-$(ARCH) cpp.o: stallman.msg $(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h @@ -17,15 +17,15 @@ $(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h ../lib/libcc.a: cd ../lib && $(MAKE) -e -cc1: $(OBJS) ../lib/libcc.a +cc1-$(ARCH): $(OBJS) ../lib/libcc.a $(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@ -cpp: cc1 - ln -f cc1 cpp +cpp: cc1-$(ARCH) + ln -f $< cpp test: cd tests && ./chktest.sh *.c clean: rm -f $(OBJS) - rm -f cc1 cpp + rm -f cc1-* cpp diff --git a/cc2/Makefile b/cc2/Makefile @@ -7,7 +7,7 @@ OBJS = main.o parser.o peep.o symbol.o node.o code.o optm.o\ arch/$(ARCH)/code.o arch/$(ARCH)/cgen.o \ arch/$(ARCH)/types.o arch/$(ARCH)/optm.o -all: cc2 +all: cc2-$(ARCH) main.o: error.h $(OBJS): cc2.h ../inc/sizes.h ../inc/cc.h @@ -24,9 +24,9 @@ error.h: cc2.h ../inc/sizes.h: cp ../inc/sizes_$(STD).h $@ -cc2: $(OBJS) ../lib/libcc.a +cc2-$(ARCH): $(OBJS) ../lib/libcc.a $(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@ clean: rm -f $(OBJS) - rm -f cc2 error.h + rm -f cc2-* error.h