From 215c9aae2b3c55fc65faaf80d96a0a454fc36705 Mon Sep 17 00:00:00 2001 From: Leon George Date: Sat, 5 Jul 2014 01:33:08 +0200 Subject: [PATCH] make: allow chosing ld-like over gcc-like options make automatically adds '-Wl,' to linker-options. Supply `LINKFLAGPREFIX :=` to avoid that. --- Makefile.include | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index 3bfb9865ad..89b144aee2 100644 --- a/Makefile.include +++ b/Makefile.include @@ -95,14 +95,17 @@ export CPPMIX ?= $(if $(wildcard *.cpp),1,) export CXXUWFLAGS export CXXEXFLAGS +# We assume $(LINK) to be gcc-like. Use `LINKFLAGPREFIX :=` for ld-like linker options. +LINKFLAGPREFIX ?= -Wl, + ## make script for your application. Build RIOT-base here! all: ..build-message $(USEPKG:%=${BINDIR}%.a) $(APPDEPS) $(AD)DIRS="$(DIRS)" "$(MAKE)" -C $(CURDIR) -f $(RIOTBASE)/Makefile.application ifeq (,$(RIOTNOLINK)) ifeq ($(BUILDOSXNATIVE),1) - $(AD)$(if $(CPPMIX),$(CXX),$(LINK)) $(UNDEF) -o $(ELFFILE) $(BASELIBS) $(LINKFLAGS) -Wl,-no_pie + $(AD)$(if $(CPPMIX),$(CXX),$(LINK)) $(UNDEF) -o $(ELFFILE) $(BASELIBS) $(LINKFLAGS) $(LINKFLAGPREFIX)-no_pie else - $(AD)$(if $(CPPMIX),$(CXX),$(LINK)) $(UNDEF) -o $(ELFFILE) -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(BINDIR)$(APPLICATION).map $(LINKFLAGS) + $(AD)$(if $(CPPMIX),$(CXX),$(LINK)) $(UNDEF) -o $(ELFFILE) $(LINKFLAGPREFIX)--start-group $(BASELIBS) -lm $(LINKFLAGPREFIX)--end-group $(LINKFLAGPREFIX)-Map=$(BINDIR)$(APPLICATION).map $(LINKFLAGS) endif $(AD)$(SIZE) $(ELFFILE) $(AD)$(OBJCOPY) $(OFLAGS) $(ELFFILE) $(HEXFILE)