shithub: scc

Download patch

ref: 039acf988f466547db782f2d96a4c0a2a251e9e7
parent: 48b05725f5d67734a60efbb2676051af15f1c647
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 15 11:55:59 EST 2018

Use + in recursive make actions

The rules that have the prefix + are executed always, even when make is
executed with -n. This prefix gives to make the information that this
line is going to execute a recursive make and it sets the correct
flags in MAKEFLAG for the children make, which will use the jobserver
of its parent.

--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@
 	$(FORALL)
 
 tests: all
-	cd tests && $(MAKE) -e all
+	+cd tests && $(MAKE) -e all
 
 install: all
 	cp -r rootdir/* $(DESTDIR)$(PREFIX)/
--- a/ar/Makefile
+++ b/ar/Makefile
@@ -17,7 +17,7 @@
 $(DRIVER)/stat.o: $(DRIVER)/stat.h
 
 $(LIBDIR)/libscc.a: $(LIB-OBJ)
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 main.o: $(DRIVER)/stat.h
 
--- a/as/Makefile
+++ b/as/Makefile
@@ -18,7 +18,7 @@
 myro.o: ../inc/myro.h
 
 $(LIBDIR)/libscc.a: $(LIB-OBJ)
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 dep:
 	./gendep.sh $(TARGETS)
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -19,7 +19,7 @@
 	cp cc1-* ../rootdir/libexec/scc/
 
 $(LIBDIR)/libscc.a: $(LIB-OBJ)
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 dep:
 	./gendep.sh $(TARGETS)
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -20,7 +20,7 @@
 	MKQBE=${MKQBE} ./gendep.sh $(TARGETS)
 
 $(LIBDIR)/libscc.a: $(LIB-OBJ)
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 main.o: error.h
 
--- a/config.mk.def
+++ b/config.mk.def
@@ -48,7 +48,7 @@
 	$(CC) $(SCC_CFLAGS) $(SCC_LDFLAGS) -o $@ $<
 
 # helper macro to run over all the directories
-FORALL = @set -e ;\
+FORALL = +@set -e ;\
 	pwd=$$PWD; \
 	for i in $(DIRS); \
 	do \
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -6,4 +6,4 @@
 include ../config.mk
 
 all dep clean distclean:
-	cd $(DRIVER) && $(MAKE) $@
+	+cd $(DRIVER) && $(MAKE) $@
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -32,7 +32,7 @@
 	mv $$$$.sh scpp
 
 $(LIBDIR)/libscc.a:
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 clean:
 	rm -f $(OBJ)
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,10 +5,4 @@
 DIRS = scc
 
 all dep clean distclean:
-	@pwd=$$PWD; \
-	for i in $(DIRS); \
-	do \
-		cd $$i; \
-		$(MAKE) $@; \
-		cd $$pwd; \
-	done
+	$(FORALL)
--- a/lib/c/Makefile
+++ b/lib/c/Makefile
@@ -1,4 +1,4 @@
 .POSIX:
 
 all dep clean distclean:
-	cd target && $(MAKE) $@
+	+cd target && $(MAKE) $@
--- a/lib/sys/Makefile
+++ b/lib/sys/Makefile
@@ -3,7 +3,7 @@
 include ../../config.mk
 
 all clean distclean:
-	pwd=$$PWD ;\
+	+@pwd=$$PWD ;\
 	for i in $(SYSS); \
 	do \
 		cd $$i; \
--- a/lib/sys/common.mk
+++ b/lib/sys/common.mk
@@ -3,7 +3,7 @@
 include ../../../config.mk
 
 all clean distclean: system.mk
-	$(MAKE) ABI=$(ABI) -f ../libsys.mk $@
+	+$(MAKE) ABI=$(ABI) -f ../libsys.mk $@
 
 system.mk: syscall.lst
 	rm -f $@; trap "rm -f $$$$.mk" 0 2 3; \
--- a/nm/Makefile
+++ b/nm/Makefile
@@ -14,7 +14,7 @@
 main.o: ../inc/scc.h ../inc/ar.h ../inc/myro.h
 
 $(LIBDIR)/libscc.a: $(LIB-OBJ)
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 dep:
 clean:
--- a/objdump/Makefile
+++ b/objdump/Makefile
@@ -14,7 +14,7 @@
 main.o: ../inc/scc.h ../inc/myro.h ../inc/arg.h
 
 $(LIBDIR)/libscc.a: $(LIB-OBJ)
-	cd $(LIBDIR) && $(MAKE)
+	+cd $(LIBDIR) && $(MAKE)
 
 dep:
 clean: