From d724e71a266d9ce01564f50b7c884112f931651a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 29 Jan 2018 15:48:18 +0100 Subject: [PATCH] makefiles: Add an APPLICATION_MODULE variable Set the application module name with APPLICATION_MODULE. The default module name is "application_$(APPLICATION)". This should fix name conflicts where an application/test has the same name as an existing module and so both write to the same archive. --- Makefile.include | 6 +++++- examples/bindist/Makefile | 4 ++-- makefiles/application.inc.mk | 2 +- makefiles/vars.inc.mk | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile.include b/Makefile.include index 0fb3bf6646..863f32e437 100644 --- a/Makefile.include +++ b/Makefile.include @@ -292,8 +292,12 @@ ifeq ($(origin RIOT_VERSION), undefined) endif endif +# Set module by prepending APPLICATION name with 'application_'. +# It prevents conflict with application and modules with the same name. +APPLICATION_MODULE ?= application_$(APPLICATION) + # the binaries to link -BASELIBS += $(BINDIR)/${APPLICATION}.a +BASELIBS += $(BINDIR)/$(APPLICATION_MODULE).a BASELIBS += $(APPDEPS) .PHONY: all link clean flash term doc debug debug-server reset objdump help info-modules diff --git a/examples/bindist/Makefile b/examples/bindist/Makefile index 0a8ff1c660..bcde8afa0d 100644 --- a/examples/bindist/Makefile +++ b/examples/bindist/Makefile @@ -22,8 +22,8 @@ QUIET ?= 1 # 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) +BIN_USEMODULE += abc # include "abc" module +BIN_USEMODULE += $(APPLICATION_MODULE) # include application module # list of extra files to include in binary distribution DIST_FILES += Makefile diff --git a/makefiles/application.inc.mk b/makefiles/application.inc.mk index 36450d1e1d..5bbcb7c4ac 100644 --- a/makefiles/application.inc.mk +++ b/makefiles/application.inc.mk @@ -1,4 +1,4 @@ -MODULE = $(APPLICATION) +MODULE = $(APPLICATION_MODULE) DIRS += $(RIOTCPU)/$(CPU) $(RIOTBOARD)/$(BOARD) DIRS += $(RIOTBASE)/core $(RIOTBASE)/drivers $(RIOTBASE)/sys diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index 0bd39055cc..1ab9bbfb7d 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -6,6 +6,7 @@ export QQ # as Q, but be more quiet export QUIET # The parameter to use whether to show verbose makefile commands or not. export APPLICATION # The application, set in the Makefile which is run by the user. +export APPLICATION_MODULE # The application module name. export BOARD # The board to compile the application for. export CPU # The CPU, set by the board's Makefile.include. export CPU_MODEL # The specific identifier of the used CPU, used for some CPU implementations to differentiate between different memory layouts