Browse code

Makefile: root - remove src/ if provided in the value of modules variable

Daniel-Constantin Mierla authored on 08/12/2016 17:34:38
Showing 1 changed files
... ...
@@ -3,20 +3,32 @@
3 3
 # - forward all commands to the Makefile in the src/ subfolder
4 4
 #
5 5
 
6
+
6 7
 # path to the source code folder
7 8
 KSR_DIR ?= src/
8 9
 
9 10
 # default target for makefile
10 11
 .DEFAULT_GOAL := default
11 12
 
13
+
14
+# strip the src/ from the path to modules
15
+SMODPARAM=
16
+ifneq ($(modules),)
17
+ifneq (,$(findstring src/,$(modules)))
18
+smodules=$(subst src/,,$(modules))
19
+SMODPARAM=modules=$(smodules)
20
+endif
21
+endif
22
+
12 23
 # forward all named targets
13 24
 %:
14
-	$(MAKE) -C $(KSR_DIR) $@
25
+	$(MAKE) -C $(KSR_DIR) $@ $(SMODPARAM)
15 26
 
16 27
 # forward the default target
17 28
 default:
18 29
 	$(MAKE) -C $(KSR_DIR)
19 30
 
31
+# forward the install target
20 32
 .PHONY: install
21 33
 install:
22
-	$(MAKE) -C $(KSR_DIR) $@
34
+	$(MAKE) -C $(KSR_DIR) $@ $(SMODPARAM)