diff --git a/examples/bindist/Makefile b/examples/bindist/Makefile index 1ff324976c..0e13eff029 100644 --- a/examples/bindist/Makefile +++ b/examples/bindist/Makefile @@ -18,13 +18,14 @@ QUIET ?= 1 # bindist specific stuff: # # build and use module "abc". -# use BINARY_DIRS instead of DIRS -BINARY_DIRS += abc -USEMODULE += abc +# use BIN_DIRS instead of DIRS, BIN_USEMODULE instead of USEMODULE, +# to flag that the directory should only be included when doing a normal build, +# and that the resulting .a should be saved when doing "make bindist" +BIN_DIRS += abc +BIN_USEMODULE += abc # include "abc" module +BIN_USEMODULE += bindist # include application module (named $APPLICATION) -# list of files to include in binary distribution -# "bin/$(BOARD)/$(APPLICATION).elf" will automatically be added +# list of extra files to include in binary distribution DIST_FILES += Makefile -DIST_FILES += bin/$(BOARD)/abc.a include $(RIOTBASE)/Makefile.include diff --git a/examples/bindist/README.md b/examples/bindist/README.md index fc214bb69f..b2b85a55ba 100644 --- a/examples/bindist/README.md +++ b/examples/bindist/README.md @@ -10,6 +10,8 @@ This application serves as simple example for "make bindist". It consists of an application module (bindist.a) and another example module (abc.a). +See https://github.com/RIOT-OS/RIOT/wiki/LGPL-guide for background information. + ## Instructions Calling "make bindist" creates a folder "bindist", which only contains the diff --git a/makefiles/bindist.inc.mk b/makefiles/bindist.inc.mk index da989fa25d..be5f13b496 100644 --- a/makefiles/bindist.inc.mk +++ b/makefiles/bindist.inc.mk @@ -1,9 +1,13 @@ -DIST_FILES += bin/$(BOARD)/$(APPLICATION).a +USEMODULE += $(BIN_USEMODULE) -ifneq (, $(filter check_bindist, $(MAKECMDGOALS))) +DIST_FILES += $(BIN_USEMODULE:%=bin/$(BOARD)/%.a) + +# if the file Makefile.distcheck exists, we're executing from within a folder +# generated by "make bindist". +ifneq (, $(wildcard Makefile.distcheck)) include Makefile.distcheck else - DIRS+=$(BINARY_DIRS) + DIRS+=$(BIN_DIRS) endif bindist: all @@ -15,12 +19,12 @@ bindist: all @cp -a bin/$(BOARD)/$(APPLICATION).elf bindist @echo "BINDIST_RIOT_VERSION=$(RIOT_VERSION)" > bindist/Makefile.distcheck - @echo "BINDIST_GIT_HEAD=$$(git --work-tree=$(RIOTBASE) describe)" >> bindist/Makefile.distcheck + @echo "BINDIST_GIT_HEAD=$$(git -C $(RIOTBASE) describe)" >> bindist/Makefile.distcheck prepare_check_bindist: @[ "$(BINDIST_RIOT_VERSION)" = "$(RIOT_VERSION)" ] || \ echo "Warning! RIOT_VERSION doesn't match!" - @[ "$(BINDIST_GIT_HEAD)" = "$$(git --work-tree=$(RIOTBASE) describe)" ] || \ + @[ "$(BINDIST_GIT_HEAD)" = "$$(git -C $(RIOTBASE) describe)" ] || \ echo "Warning! git describe doesn't match!" check_bindist: prepare_check_bindist all