shithub: scc

Download patch

ref: 889a895a11e7caf277c91613df65607e715641a2
parent: 5eb497b0e16849c52bc45af5a7a5813c779da0e0
author: Roberto E. Vargas Caballero <[email protected]>
date: Tue Nov 29 08:36:17 EST 2016

Remove multi targets in Makefile

This way of building was crappy because it had to clean
all the files in every step, and it was very easy to merge
files from different architectures. After the last changes
the common objects are totally independent of the architecture
so they can be used without problems.

The default target build all the architectures instead of building
only the one controlled by the ARCH variable.

--- a/Makefile
+++ b/Makefile
@@ -8,15 +8,6 @@
 ARCHS = z80 i386-sysv amd64-sysv qbe
 
 all:
-	for i in $(DIRS); \
-	do \
-		(cd $$i && $(MAKE) -e); \
-	done
-	cp -f cc1/cc1 bin/cc1
-	cp -f cc2/cc2 bin/cc2
-	cp -f driver/$(DRIVER)/scc bin/scc
-
-multi:
 	for i in $(ARCHS); \
 	do \
 		$(MAKE) $$i || exit; \
@@ -26,7 +17,6 @@
 	for i in cc1 cc2; \
 	do \
 		(cd $$i; \
-		ARCH=$@ $(MAKE) -e clean; \
 		ARCH=$@ $(MAKE) -e $$i || exit); \
 	done
 	ln -f cc1/cc1 bin/cc1-$@
@@ -49,18 +39,19 @@
 	rm -f $(PREFIX)/bin/scc
 	rm -f $(PREFIX)/bin/cpp
 
-clean:
+clean-helper:
 	for i in $(DIRS); \
 	do \
-		(cd $$i && $(MAKE) $@ || exit); \
+		(cd $$i && $(MAKE) clean || exit); \
 	done
 
-multi-clean:
+clean:
 	for i in $(ARCHS); \
 	do \
-		ARCH=$$i $(MAKE) -e clean || exit; \
+		ARCH=$$i $(MAKE) -e clean-helper || exit; \
 	done
-
-distclean: multi-clean
 	rm -f bin/cc* bin/scc
+
+distclean: clean
+	rm -rf bin
 	rm inc/sizes.h