[PATCH 2/5] CodeSamples: Use $(MAKE) for recursive make

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From e227572a57eaa6c14636c1d197a6d40254bcfa5c Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Tue, 6 Jun 2017 00:24:15 +0900
Subject: [PATCH 2/5] CodeSamples: Use $(MAKE) for recursive make

For recursive make, "$(MAKE)" is recommended.[1]
By this change, options such as "-j4" can be transferred to builds
under subdirectories.

Also convert the list of recursive "make"s to a "for" loop by
defining a variable "subdirs".

[1] https://www.gnu.org/software/make/manual/html_node/Recursion.html

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 CodeSamples/Makefile   | 16 ++++++++--------
 CodeSamples/depends.mk |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/CodeSamples/Makefile b/CodeSamples/Makefile
index e1593a7..ec9e9a6 100644
--- a/CodeSamples/Makefile
+++ b/CodeSamples/Makefile
@@ -1,24 +1,24 @@
+subdirs = SMPdesign advsync count defer intro toolsoftrade
+
 .PHONY: all clean pthreads pthreads-x86 pthreads-ppc64 pthreads-arm
 
 top := .
 
 all:
-	(cd SMPdesign; make)
-	(cd advsync; make)
-	(cd count; make)
-	(cd defer; make)
-	(cd intro; make)
-	(cd toolsoftrade; make)
+	for d in $(subdirs); \
+	do \
+		$(MAKE) -C $$d; \
+	done
 
 include depends.mk
 
 api.h Makefile.arch:
 ifeq ($(strip $(target)),)
-	make pthreads
+	$(MAKE) pthreads
 	$(warning "Could not figure out which target to use (arch:$(arch)).\
 		   Used 'make pthreads' in CodeSamples/Makefile.")
 else
-	make pthreads-$(target)
+	$(MAKE) pthreads-$(target)
 endif
 
 pthreads:
diff --git a/CodeSamples/depends.mk b/CodeSamples/depends.mk
index f3a325d..9d2691b 100644
--- a/CodeSamples/depends.mk
+++ b/CodeSamples/depends.mk
@@ -35,10 +35,10 @@ endif
 
 ifneq ($(top),.)
 $(top)/api.h: $(api_depend) $(api_depend_common)
-	make -C $(top) api.h
+	$(MAKE) -C $(top) api.h
 
 $(top)/Makefile.arch: $(arch_depend)
-	make -C $(top) Makefile.arch
+	$(MAKE) -C $(top) Makefile.arch
 else
 $(top)/api.h: $(api_depend) $(api_depend_common)
 $(top)/Makefile.arch: $(arch_depend)
-- 
2.7.4


--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux