shithub: scc

Download patch

ref: f407880e9682d9d44280a5ea3159d5bbde1d7318
parent: 30cae77283e7835928d0f3e1e67eca5c1efa2b18
author: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>
date: Wed Jun 15 09:48:51 EDT 2016

Remove MAKEFLAGS use in Makefiles

Per POSIX, "Macros are not exported to the environment of commands to be
run. This was never the case in any historical make and would have
serious consequences. The environment is the same as the environment to
make except that MAKEFLAGS and macros defined on the make command line
are added.", so there is no need to use MAKEFLAGS at all in these cases.

Signed-off-by: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>

--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
 all:
 	for i in $(DIRS); \
 	do \
-		(cd $$i && $(MAKE) -e -$(MAKEFLAGS)); \
+		(cd $$i && $(MAKE) -e); \
 	done
 	cp -f cc1/cc1 bin/cc1
 	cp -f cc2/cc2 bin/cc2
@@ -19,7 +19,7 @@
 multi:
 	for i in $(ARCHS); \
 	do \
-		$(MAKE) -$(MAKEFLAGS) $$i || exit; \
+		$(MAKE) $$i || exit; \
 	done
 
 $(ARCHS):
@@ -26,7 +26,7 @@
 	for i in cc1 cc2; \
 	do \
 		(cd $$i; \
-		ARCH=$@ $(MAKE) -e -$(MAKEFLAGS) clean; \
+		ARCH=$@ $(MAKE) -e clean; \
 		ARCH=$@ $(MAKE) -e $$i || exit); \
 	done
 	ln -f cc1/cc1 bin/cc1-$@
@@ -49,13 +49,13 @@
 clean:
 	for i in $(DIRS); \
 	do \
-		(cd $$i && $(MAKE) -$(MAKEFLAGS) $@ || exit); \
+		(cd $$i && $(MAKE) $@ || exit); \
 	done
 
 multi-clean:
 	for i in $(ARCHS); \
 	do \
-		ARCH=$$i $(MAKE) -e -$(MAKEFLAGS) clean || exit; \
+		ARCH=$$i $(MAKE) -e clean || exit; \
 	done
 
 distclean: multi-clean
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -14,7 +14,7 @@
 $(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h arch/$(ARCH)/arch.h
 
 ../lib/libcc.a:
-	cd ../lib && $(MAKE) -e -$(MAKEFLAGS)
+	cd ../lib && $(MAKE) -e
 
 cc1: $(OBJS) ../lib/libcc.a
 	$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -21,7 +21,7 @@
 $(OBJS): cc2.h ../inc/sizes.h
 
 ../lib/libcc.a:
-	cd ../lib && $(MAKE) -e -$(MAKEFLAGS)
+	cd ../lib && $(MAKE) -e
 
 cc2: $(OBJS) ../lib/libcc.a
 	$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -10,7 +10,7 @@
 $(OBJS): ../../inc/cc.h
 
 ../../lib/libcc.a:
-	cd ../../lib && $(MAKE) -e -$(MAKEFLAGS)
+	cd ../../lib && $(MAKE) -e
 
 scc: $(OBJS) ../../lib/libcc.a
 	$(CC) $(SCC_LDFLAGS) $(OBJS) ../../lib/libcc.a -o $@