[hackers] [scc] Makefiles: build a binary for each arch target || Quentin Rameau
commit 2f972eea17a78f21c5ffbce5be12b42ca91cb80c
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Sun Dec 4 10:34:37 2016 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Sun Dec 4 12:30:59 2016 +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.
diff --git a/Makefile b/Makefile
index 98e5f0b..588d808 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -20,10 +20,10 @@ $(ARCHS): bin
for i in cc1 cc2; \
do \
(cd $$i; \
- ARCH=$_AT_ $(MAKE) -e $$i || exit); \
+ ARCH=$_AT_ $(MAKE) -e $$i-$@ || exit); \
done
- ln -f cc1/cc1 bin/cc1-$_AT_
- ln -f cc2/cc2 bin/cc2-$_AT_
+ ln -f cc1/cc1-$_AT_ bin/
+ ln -f cc2/cc2-$_AT_ bin/
bin:
mkdir -p bin
diff --git a/cc1/Makefile b/cc1/Makefile
index 25df906..8b36fb1 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -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
_AT_@ -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 $_AT_
-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
index ee0f35d..244b137 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -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
_AT_@ -24,9 +24,9 @@ error.h: cc2.h
../inc/sizes.h:
cp ../inc/sizes_$(STD).h $_AT_
-cc2: $(OBJS) ../lib/libcc.a
+cc2-$(ARCH): $(OBJS) ../lib/libcc.a
$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
clean:
rm -f $(OBJS)
- rm -f cc2 error.h
+ rm -f cc2-* error.h
Received on Sun Dec 04 2016 - 12:54:35 CET
This archive was generated by hypermail 2.3.0
: Sun Dec 04 2016 - 13:00:29 CET