From 66a3d7da776654ef5c2fe4fd40a794a194d1f48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Fri, 16 May 2014 18:18:35 +0200 Subject: [PATCH] make: fix #1197 Partial revert of 85b7eca19edf76a5b82c2ebe01e0e90a3292dee7 Fixes #1197. --- Makefile.include | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Makefile.include b/Makefile.include index d0cbe7ddc0..4b05fb9d19 100644 --- a/Makefile.include +++ b/Makefile.include @@ -67,10 +67,21 @@ BASELIBS += $(USEPKG:%=${BINDIR}%.a) .PHONY: all clean flash doc term objsize buildsize buildsizes buildsizes-diff +export ELFFILE ?= $(BINDIR)$(PROJECT).elf +export HEXFILE ?= $(ELFFILE:.elf=.hex) + ## make script for your application. Build RIOT-base here! -all: $(BINDIR)$(PROJECT).elf - $(AD)$(SIZE) $(BINDIR)$(PROJECT).elf - $(AD)$(OBJCOPY) $(OFLAGS) $(BINDIR)$(PROJECT).elf $(BINDIR)$(PROJECT).hex +all: $(BINDIR)$(PROJECT).a + @echo "Building application $(PROJECT) for $(BOARD) w/ MCU $(MCU)." + "$(MAKE)" -C $(RIOTBOARD)/$(BOARD) + "$(MAKE)" -C $(RIOTBASE) +ifeq ($(BUILDOSXNATIVE),1) + $(AD)$(LINK) $(UNDEF) -o $(ELFFILE) $(BASELIBS) $(LINKFLAGS) -Wl,-no_pie +else + $(AD)$(LINK) $(UNDEF) -o $(ELFFILE) -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(BINDIR)$(PROJECT).map $(LINKFLAGS) +endif + $(AD)$(SIZE) $(ELFFILE) + $(AD)$(OBJCOPY) $(OFLAGS) $(ELFFILE) $(HEXFILE) ## your make rules ## Only basic example - modify it for larger applications!! @@ -83,16 +94,6 @@ SRC = $(wildcard *.c) # string array of all names replaced .c with .o OBJ = $(SRC:%.c=${BINDIR}${PROJECT}/%.o) -$(BINDIR)$(PROJECT).elf: $(BINDIR)$(PROJECT).a - @echo "Building application $(PROJECT) for $(BOARD) w/ MCU $(MCU)." - "$(MAKE)" -C $(RIOTBOARD)/$(BOARD) - "$(MAKE)" -C $(RIOTBASE) -ifeq ($(BUILDOSXNATIVE),1) - $(AD)$(LINK) $(UNDEF) -o $@ $(BASELIBS) $(LINKFLAGS) -Wl,-no_pie -else - $(AD)$(LINK) $(UNDEF) -o $@ -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(BINDIR)$(PROJECT).map $(LINKFLAGS) -endif - $(BINDIR)$(PROJECT).a: $(OBJ) $(AD)$(AR) -rc $(BINDIR)$(PROJECT).a $(OBJ) @@ -120,7 +121,7 @@ $(RIOTBASE)/pkg/%/Makefile.include:: $(BINDIR)$(PROJECT)/%.o: %.c $(PROJDEPS) $(USEPKG:%=${BINDIR}%.a) @echo; echo "Compiling.... $*.c"; echo $(AD)mkdir -p "$(dir $@)" - $(ADD)$(CC) $(CFLAGS) $(INCLUDES) -c "$<" -o "$@" + $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c "$<" -o "$@" $(USEPKG:%=${BINDIR}%.a):: @mkdir -p ${BINDIR}