tests: makefiles need to handle linker script generators too

Without this you get errors about not finding the linker script (because
it will be generated) and linker errors due to bare -l flags.
This commit is contained in:
Karl Palsson 2018-05-07 10:22:46 +00:00 committed by Karl Palsson
parent b48b94fa07
commit 64e26832c7

View File

@ -100,7 +100,10 @@ ifeq ($(V),99)
TGT_LDFLAGS += -Wl,--print-gc-sections TGT_LDFLAGS += -Wl,--print-gc-sections
endif endif
# Linker script generator fills this in for us.
ifeq (,$(DEVICE))
LDLIBS += -l$(OPENCM3_LIB) LDLIBS += -l$(OPENCM3_LIB)
endif
# nosys is only in newer gcc-arm-embedded... # nosys is only in newer gcc-arm-embedded...
#LDLIBS += -specs=nosys.specs #LDLIBS += -specs=nosys.specs
LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
@ -119,10 +122,13 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
all: $(PROJECT).elf $(PROJECT).bin all: $(PROJECT).elf $(PROJECT).bin
flash: $(PROJECT).flash flash: $(PROJECT).flash
# error if not using linker script generator
ifeq (,$(DEVICE))
$(LDSCRIPT): $(LDSCRIPT):
ifeq (,$(wildcard $(LDSCRIPT))) ifeq (,$(wildcard $(LDSCRIPT)))
$(error Unable to find specified linker script: $(LDSCRIPT)) $(error Unable to find specified linker script: $(LDSCRIPT))
endif endif
endif
# Need a special rule to have a bin dir # Need a special rule to have a bin dir
$(BUILD_DIR)/%.o: %.c $(BUILD_DIR)/%.o: %.c