Browse Source

make: use variable for pkg subdir

pr/gpio
Kaspar Schleiser 7 years ago
parent
commit
8b7ddb2f70
  1. 7
      Makefile.buildtests
  2. 20
      Makefile.include
  3. 1
      Makefile.vars

7
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)/##'

20
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

1
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.

Loading…
Cancel
Save