1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

make: use variable for pkg subdir

This commit is contained in:
Kaspar Schleiser 2016-03-05 00:53:05 +01:00
parent 32d48bb16b
commit 8b7ddb2f70
3 changed files with 18 additions and 10 deletions

View File

@ -55,6 +55,7 @@ buildtest:
RIOTBASE=$${RIOTBASE} \ RIOTBASE=$${RIOTBASE} \
RIOTBOARD=$${RIOTBOARD} \ RIOTBOARD=$${RIOTBOARD} \
RIOTCPU=$${RIOTCPU} \ RIOTCPU=$${RIOTCPU} \
RIOTPKG=$${RIOTPKG} \
BINDIRBASE=$${BINDIRBASE} \ BINDIRBASE=$${BINDIRBASE} \
RIOTNOLINK=$${RIOTNOLINK} \ RIOTNOLINK=$${RIOTNOLINK} \
RIOT_VERSION=$${RIOT_VERSION} \ RIOT_VERSION=$${RIOT_VERSION} \
@ -90,6 +91,7 @@ buildtest:
RIOTBASE=$${RIOTBASE} \ RIOTBASE=$${RIOTBASE} \
RIOTBOARD=$${RIOTBOARD} \ RIOTBOARD=$${RIOTBOARD} \
RIOTCPU=$${RIOTCPU} \ RIOTCPU=$${RIOTCPU} \
RIOTPKG=$${RIOTPKG} \
BINDIRBASE=$${BINDIRBASE} \ BINDIRBASE=$${BINDIRBASE} \
RIOTNOLINK=$${RIOTNOLINK} \ RIOTNOLINK=$${RIOTNOLINK} \
RIOT_VERSION=$${RIOT_VERSION} \ RIOT_VERSION=$${RIOT_VERSION} \
@ -127,6 +129,7 @@ info-buildsizes:
RIOTBASE=$${RIOTBASE} \ RIOTBASE=$${RIOTBASE} \
RIOTBOARD=$${RIOTBOARD} \ RIOTBOARD=$${RIOTBOARD} \
RIOTCPU=$${RIOTCPU} \ RIOTCPU=$${RIOTCPU} \
RIOTPKG=$${RIOTPKG} \
BINDIRBASE=$${BINDIRBASE} \ BINDIRBASE=$${BINDIRBASE} \
$(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${BOARD}"; \ $(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${BOARD}"; \
done; done;
@ -143,6 +146,7 @@ info-buildsizes-diff:
RIOTBASE=$${RIOTBASE} \ RIOTBASE=$${RIOTBASE} \
RIOTBOARD=$${RIOTBOARD} \ RIOTBOARD=$${RIOTBOARD} \
RIOTCPU=$${RIOTCPU} \ RIOTCPU=$${RIOTCPU} \
RIOTPKG=$${RIOTPKG} \
BINDIRBASE=$${BINDIRBASE} \ BINDIRBASE=$${BINDIRBASE} \
$(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4; \ $(MAKE) info-buildsize 2>/dev/null | tail -n-1 | cut -f-4; \
done | \ done | \
@ -176,6 +180,7 @@ info-build:
@echo 'RIOTBASE: $(RIOTBASE)' @echo 'RIOTBASE: $(RIOTBASE)'
@echo 'RIOTBOARD: $(RIOTBOARD)' @echo 'RIOTBOARD: $(RIOTBOARD)'
@echo 'RIOTCPU: $(RIOTCPU)' @echo 'RIOTCPU: $(RIOTCPU)'
@echo 'RIOTPKG: $(RIOTPKG)'
@echo '' @echo ''
@echo 'DEFAULT_MODULE: $(sort $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)))' @echo 'DEFAULT_MODULE: $(sort $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)))'
@echo 'DISABLE_MODULE: $(sort $(DISABLE_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 dirname -- | sort | uniq | xargs -I{} find {} -name "Makefile*"; \
echo "$$CPPSRC" | xargs $(CXX) $(CXXFLAGS) $(INCLUDES) -MM 2> /dev/null | grep -o "[^ ]\+\.h"; \ echo "$$CPPSRC" | xargs $(CXX) $(CXXFLAGS) $(INCLUDES) -MM 2> /dev/null | grep -o "[^ ]\+\.h"; \
fi; \ fi; \
$(foreach pkg,$(USEPKG),find $(RIOTBASE)/pkg/$(pkg) -type f;) \ $(foreach pkg,$(USEPKG),find $(RIOTPKG)/$(pkg) -type f;) \
) | sort | uniq | sed 's#$(RIOTBASE)/##' ) | sort | uniq | sed 's#$(RIOTBASE)/##'

View File

@ -15,6 +15,8 @@ RIOTCPU := $(abspath $(RIOTCPU))
RIOTBOARD ?= $(RIOTBASE)/boards RIOTBOARD ?= $(RIOTBASE)/boards
RIOTBOARD := $(abspath $(RIOTBOARD)) RIOTBOARD := $(abspath $(RIOTBOARD))
RIOTPKG ?= $(RIOTBASE)/pkg
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd) RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
RIOTPROJECT := $(abspath $(RIOTPROJECT)) RIOTPROJECT := $(abspath $(RIOTPROJECT))
@ -247,33 +249,33 @@ INCLUDES += $(USEMODULE_INCLUDES_:%=-I%)
# The `clean` needs to be serialized before everything else. # The `clean` needs to be serialized before everything else.
ifneq (, $(filter clean, $(MAKECMDGOALS))) ifneq (, $(filter clean, $(MAKECMDGOALS)))
all $(BASELIBS) $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include): clean all $(BASELIBS) $(USEPKG:%=$(RIOTPKG)/%/Makefile.include): clean
endif endif
# include Makefile.includes for packages in $(USEPKG) # include Makefile.includes for packages in $(USEPKG)
$(RIOTBASE)/pkg/%/Makefile.include:: $(RIOTPKG)/%/Makefile.include::
$(AD)"$(MAKE)" -C $(RIOTBASE)/pkg/$* Makefile.include $(AD)"$(MAKE)" -C $(RIOTPKG)/$* Makefile.include
.PHONY: $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include) .PHONY: $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
-include $(USEPKG:%=$(RIOTBASE)/pkg/%/Makefile.include) -include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
.PHONY: $(USEPKG:%=${BINDIR}%.a) .PHONY: $(USEPKG:%=${BINDIR}%.a)
$(USEPKG:%=${BINDIR}%.a): $(USEPKG:%=${BINDIR}%.a):
@mkdir -p ${BINDIR} @mkdir -p ${BINDIR}
"$(MAKE)" -C $(RIOTBASE)/pkg/$(patsubst ${BINDIR}%.a,%,$@) "$(MAKE)" -C $(RIOTPKG)/$(patsubst ${BINDIR}%.a,%,$@)
clean: 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 $(BINDIR)
-@rm -rf $(SCANBUILD_OUTPUTDIR) -@rm -rf $(SCANBUILD_OUTPUTDIR)
# Remove intermediates, but keep the .elf, .hex and .map etc. # Remove intermediates, but keep the .elf, .hex and .map etc.
clean-intermediates: 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)/*/ -@rm -rf $(BINDIR)/*.a $(BINDIR)/*/
distclean: 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) -@rm -rf $(BINDIRBASE)
flash: all flash: all

View File

@ -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 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 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 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 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 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. export BINDIR # This is the folder where the application should be built in.