From 8b7ddb2f7018da6c717610694a0384e9a82195b0 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Sat, 5 Mar 2016 00:53:05 +0100 Subject: [PATCH 1/2] make: use variable for pkg subdir --- Makefile.buildtests | 7 ++++++- Makefile.include | 20 +++++++++++--------- Makefile.vars | 1 + 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Makefile.buildtests b/Makefile.buildtests index 6845f89a7f..5dc662e71c 100644 --- a/Makefile.buildtests +++ b/Makefile.buildtests @@ -55,6 +55,7 @@ buildtest: RIOTBASE=$${RIOTBASE} \ RIOTBOARD=$${RIOTBOARD} \ RIOTCPU=$${RIOTCPU} \ + RIOTPKG=$${RIOTPKG} \ BINDIRBASE=$${BINDIRBASE} \ RIOTNOLINK=$${RIOTNOLINK} \ RIOT_VERSION=$${RIOT_VERSION} \ @@ -90,6 +91,7 @@ buildtest: RIOTBASE=$${RIOTBASE} \ RIOTBOARD=$${RIOTBOARD} \ RIOTCPU=$${RIOTCPU} \ + RIOTPKG=$${RIOTPKG} \ BINDIRBASE=$${BINDIRBASE} \ RIOTNOLINK=$${RIOTNOLINK} \ RIOT_VERSION=$${RIOT_VERSION} \ @@ -127,6 +129,7 @@ info-buildsizes: RIOTBASE=$${RIOTBASE} \ RIOTBOARD=$${RIOTBOARD} \ RIOTCPU=$${RIOTCPU} \ + RIOTPKG=$${RIOTPKG} \ BINDIRBASE=$${BINDIRBASE} \ $(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${BOARD}"; \ done; @@ -143,6 +146,7 @@ info-buildsizes-diff: RIOTBASE=$${RIOTBASE} \ RIOTBOARD=$${RIOTBOARD} \ RIOTCPU=$${RIOTCPU} \ + RIOTPKG=$${RIOTPKG} \ BINDIRBASE=$${BINDIRBASE} \ $(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4; \ done | \ @@ -176,6 +180,7 @@ info-build: @echo 'RIOTBASE: $(RIOTBASE)' @echo 'RIOTBOARD: $(RIOTBOARD)' @echo 'RIOTCPU: $(RIOTCPU)' + @echo 'RIOTPKG: $(RIOTPKG)' @echo '' @echo 'DEFAULT_MODULE: $(sort $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)))' @echo 'DISABLE_MODULE: $(sort $(DISABLE_MODULE))' @@ -296,5 +301,5 @@ info-files: echo "$$CPPSRC" | xargs dirname -- | sort | uniq | xargs -I{} find {} -name "Makefile*"; \ echo "$$CPPSRC" | xargs $(CXX) $(CXXFLAGS) $(INCLUDES) -MM 2> /dev/null | grep -o "[^ ]\+\.h"; \ fi; \ - $(foreach pkg,$(USEPKG),find $(RIOTBASE)/pkg/$(pkg) -type f;) \ + $(foreach pkg,$(USEPKG),find $(RIOTPKG)/$(pkg) -type f;) \ ) | sort | uniq | sed 's#$(RIOTBASE)/##' diff --git a/Makefile.include b/Makefile.include index 182f632922..5c642bd378 100644 --- a/Makefile.include +++ b/Makefile.include @@ -15,6 +15,8 @@ RIOTCPU := $(abspath $(RIOTCPU)) RIOTBOARD ?= $(RIOTBASE)/boards RIOTBOARD := $(abspath $(RIOTBOARD)) +RIOTPKG ?= $(RIOTBASE)/pkg + RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd) RIOTPROJECT := $(abspath $(RIOTPROJECT)) @@ -247,33 +249,33 @@ INCLUDES += $(USEMODULE_INCLUDES_:%=-I%) # The `clean` needs to be serialized before everything else. ifneq (, $(filter clean, $(MAKECMDGOALS))) - all $(BASELIBS) $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include): clean + all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include): clean endif # include Makefile.includes for packages in $(USEPKG) -$(RIOTBASE)/pkg/%/Makefile.include:: - $(AD)"$(MAKE)" -C $(RIOTBASE)/pkg/$* Makefile.include +$(RIOTPKG)/%/Makefile.include:: + $(AD)"$(MAKE)" -C $(RIOTPKG)/$* Makefile.include -.PHONY: $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include) --include $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include) +.PHONY: $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) +-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include) .PHONY: $(USEPKG:%=${BINDIR}%.a) $(USEPKG:%=${BINDIR}%.a): @mkdir -p ${BINDIR} - "$(MAKE)" -C $(RIOTBASE)/pkg/$(patsubst ${BINDIR}%.a,%,$@) + "$(MAKE)" -C $(RIOTPKG)/$(patsubst ${BINDIR}%.a,%,$@) clean: - -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTBASE)/pkg/$$i clean ; done + -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done -@rm -rf $(BINDIR) -@rm -rf $(SCANBUILD_OUTPUTDIR) # Remove intermediates, but keep the .elf, .hex and .map etc. clean-intermediates: - -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTBASE)/pkg/$$i clean ; done + -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done -@rm -rf $(BINDIR)/*.a $(BINDIR)/*/ distclean: - -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTBASE)/pkg/$$i distclean ; done + -@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done -@rm -rf $(BINDIRBASE) flash: all diff --git a/Makefile.vars b/Makefile.vars index ba5e8d0e06..73f33d835b 100644 --- a/Makefile.vars +++ b/Makefile.vars @@ -16,6 +16,7 @@ export APPDEPS # Files / Makefile targets that need to be created export RIOTBASE # The root folder of RIOT. The folder where this very file lives in. export RIOTCPU # For third party CPUs this folder is the base of the CPUs. export RIOTBOARD # For third party BOARDs this folder is the base of the BOARDs. +export RIOTPKG # For overriding RIOT's pkg directory export RIOTPROJECT # Top level git root of the project being built, or PWD if not a git repository export BINDIRBASE # This is the folder where the application should be built in. For each BOARD a different subfolder is used. export BINDIR # This is the folder where the application should be built in. From c63a9247789d210b9b405cbc461f36e809e56775 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Sat, 5 Mar 2016 01:05:48 +0100 Subject: [PATCH 2/2] pkg: adapt to RIOTPKG --- pkg/ccn-lite/Makefile.include | 2 +- pkg/cmsis-dsp/Makefile.include | 2 +- pkg/doc.txt | 2 +- pkg/libcoap/Makefile.include | 2 +- pkg/micro-ecc/Makefile.include | 2 +- pkg/microcoap/Makefile.include | 2 +- pkg/oonf_api/Makefile.include | 2 +- pkg/relic/Makefile.include | 2 +- pkg/tlsf/Makefile.include | 2 +- pkg/wakaama/Makefile.include | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/ccn-lite/Makefile.include b/pkg/ccn-lite/Makefile.include index 4751bbd926..40c18ee967 100644 --- a/pkg/ccn-lite/Makefile.include +++ b/pkg/ccn-lite/Makefile.include @@ -1,2 +1,2 @@ -INCLUDES += -I$(RIOTBASE)/pkg/ccn-lite -I$(RIOTBASE)/pkg/ccn-lite/ccn-lite/src +INCLUDES += -I$(RIOTPKG)/ccn-lite -I$(RIOTPKG)/ccn-lite/ccn-lite/src INCLUDES += -I$(RIOTBASE)/sys/posix/include diff --git a/pkg/cmsis-dsp/Makefile.include b/pkg/cmsis-dsp/Makefile.include index 8840a328af..835c7b44b7 100644 --- a/pkg/cmsis-dsp/Makefile.include +++ b/pkg/cmsis-dsp/Makefile.include @@ -1 +1 @@ -INCLUDES += -I$(RIOTBASE)/pkg/cmsis-dsp/cmsis-dsp/include +INCLUDES += -I$(RIOTPKG)/cmsis-dsp/cmsis-dsp/include diff --git a/pkg/doc.txt b/pkg/doc.txt index 8ee8f21c31..158dbe785d 100644 --- a/pkg/doc.txt +++ b/pkg/doc.txt @@ -11,7 +11,7 @@ * * ~~~~~~~~ {.mk} * USEPKG += - * INCLUDE += $(RIOTBASE)/pkg//... + * INCLUDE += $(RIOTPKG)//... * ~~~~~~~~ * * Porting an external library diff --git a/pkg/libcoap/Makefile.include b/pkg/libcoap/Makefile.include index dab6b7a26a..1370285f4d 100644 --- a/pkg/libcoap/Makefile.include +++ b/pkg/libcoap/Makefile.include @@ -1,3 +1,3 @@ -INCLUDES += -I$(RIOTBASE)/pkg/libcoap/libcoap \ +INCLUDES += -I$(RIOTPKG)/libcoap/libcoap \ -I$(RIOTBASE)/sys/posix/include \ -I$(RIOTBASE)/sys/net/include diff --git a/pkg/micro-ecc/Makefile.include b/pkg/micro-ecc/Makefile.include index 4fc603e350..2bdc475905 100644 --- a/pkg/micro-ecc/Makefile.include +++ b/pkg/micro-ecc/Makefile.include @@ -1 +1 @@ -INCLUDES += -I $(RIOTBASE)/pkg/micro-ecc/micro-ecc +INCLUDES += -I$(RIOTPKG)/micro-ecc/micro-ecc diff --git a/pkg/microcoap/Makefile.include b/pkg/microcoap/Makefile.include index 53b1fa4e47..e1998cb617 100644 --- a/pkg/microcoap/Makefile.include +++ b/pkg/microcoap/Makefile.include @@ -1 +1 @@ -INCLUDES += -I$(RIOTBASE)/pkg/microcoap/microcoap +INCLUDES += -I$(RIOTPKG)/microcoap/microcoap diff --git a/pkg/oonf_api/Makefile.include b/pkg/oonf_api/Makefile.include index 3cf84c68c4..041a62ad77 100644 --- a/pkg/oonf_api/Makefile.include +++ b/pkg/oonf_api/Makefile.include @@ -1 +1 @@ -INCLUDES += -I $(RIOTBASE)/pkg/oonf_api/oonf_api/src-api +INCLUDES += -I$(RIOTPKG)/oonf_api/oonf_api/src-api diff --git a/pkg/relic/Makefile.include b/pkg/relic/Makefile.include index fa0985b127..c9c20ba248 100644 --- a/pkg/relic/Makefile.include +++ b/pkg/relic/Makefile.include @@ -1 +1 @@ -INCLUDES += -I$(RIOTBASE)/pkg/relic/relic/include +INCLUDES += -I$(RIOTPKG)/relic/relic/include diff --git a/pkg/tlsf/Makefile.include b/pkg/tlsf/Makefile.include index 7ce51bc734..15ce4f1252 100644 --- a/pkg/tlsf/Makefile.include +++ b/pkg/tlsf/Makefile.include @@ -1 +1 @@ -INCLUDES += -I$(RIOTBASE)/pkg/tlsf/tlsf +INCLUDES += -I$(RIOTPKG)/tlsf/tlsf diff --git a/pkg/wakaama/Makefile.include b/pkg/wakaama/Makefile.include index 017dae1841..1bfb90a655 100644 --- a/pkg/wakaama/Makefile.include +++ b/pkg/wakaama/Makefile.include @@ -1 +1 @@ -INCLUDES += -I$(RIOTBASE)/pkg/wakaama/wakaama +INCLUDES += -I$(RIOTPKG)/wakaama/wakaama