shithub: scc

Download patch

ref: b9cb327657d4888777c4dc834f74ff99391852f0
parent: 7e6ce07370ef4b1f8c53131ae340b3c951a0fdac
author: Quentin Rameau <quinq@fifth.space>
date: Thu May 12 15:16:13 EDT 2016

Fix Makefiles

Move the dependency on libcc.a to the cc1/cc2 Makefile which actually
need it to build.
Correct some indentation and ordering too.

--- a/Makefile
+++ b/Makefile
@@ -8,9 +8,9 @@
 ARCHS = z80 i386-sysv amd64-sysv qbe
 
 all:
-	for i in $(DIRS) ; \
-	do  \
-		(cd $$i && $(MAKE) -e -$(MAKEFLAGS)) ;\
+	for i in $(DIRS); \
+	do \
+		(cd $$i && $(MAKE) -e -$(MAKEFLAGS)); \
 	done
 	cp -f cc1/cc1 bin/cc1
 	cp -f cc2/cc2 bin/cc2
@@ -18,10 +18,9 @@
 	strip bin/cc1 bin/cc2 bin/scc
 
 multi:
-	cd lib && $(MAKE) -e $(MAKEFLAGS)
-	for i in $(ARCHS) ; \
+	for i in $(ARCHS); \
 	do \
-		$(MAKE) -$(MAKEFLAGS) $$i || exit ;\
+		$(MAKE) -$(MAKEFLAGS) $$i || exit; \
 	done
 
 $(ARCHS):
@@ -28,8 +27,8 @@
 	for i in cc1 cc2; \
 	do \
 		(cd $$i; \
-		 ARCH=$@ ${MAKE} -e -$(MAKEFLAGS) clean ;\
-		 ARCH=$@ $(MAKE) -e $$i || exit); \
+		ARCH=$@ $(MAKE) -e -$(MAKEFLAGS) clean; \
+		ARCH=$@ $(MAKE) -e $$i || exit); \
 	done
 	ln -f cc1/cc1 bin/cc1-$@
 	ln -f cc2/cc2 bin/cc2-$@
@@ -50,13 +49,13 @@
 	rm -f $(PREFIX)/bin/cpp
 
 clean:
-	for i in ${DIRS};\
+	for i in $(DIRS); \
 	do \
-		(cd $$i; ${MAKE} -$(MAKEFLAGS) $@ || exit); \
+		(cd $$i && $(MAKE) -$(MAKEFLAGS) $@ || exit); \
 	done
 
 multi-clean:
-	for i in $(ARCHS) ; \
+	for i in $(ARCHS); \
 	do \
 		ARCH=$$i $(MAKE) -e -$(MAKEFLAGS) clean || exit; \
 	done
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -13,6 +13,9 @@
 
 $(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h arch/$(ARCH)/arch.h
 
+../lib/libcc.a:
+	cd ../lib && $(MAKE) -e -$(MAKEFLAGS)
+
 cc1: $(OBJS) ../lib/libcc.a
 	$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
 
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -9,16 +9,19 @@
 
 all: cc2
 
+error.h: cc2.h
+	rm -f $@; trap 'rm -f $$$$.h' EXIT INT QUIT ;\
+	awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@
+
+main.o: error.h
+
 ../inc/sizes.h:
 	cp ../inc/sizes_$(STD).h $@
 
 $(OBJS): cc2.h ../inc/sizes.h
 
-main.o: error.h
-
-error.h: cc2.h
-	rm -f $@; trap 'rm -f $$$$.h' EXIT INT QUIT ;\
-	awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@
+../lib/libcc.a:
+	cd ../lib && $(MAKE) -e -$(MAKEFLAGS)
 
 cc2: $(OBJS) ../lib/libcc.a
 	$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@