Makefile: Fix lpc176x and stm32f1 builds

Commit e18501d0 broke the build for targets that added objects to
klipper.elf via adding dependencies.  Rework the build so that it is
possible to add objects to klipper.elf via a new OBJS_klipper.elf
makefile variable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-03-02 11:26:14 -05:00
parent 309a47c781
commit 9430fea2c5
3 changed files with 17 additions and 17 deletions

View File

@@ -37,6 +37,8 @@ CFLAGS := -I$(OUT) -Isrc -I$(OUT)board-generic/ -std=gnu11 -O2 -MD -g \
-ffunction-sections -fdata-sections
CFLAGS += -flto -fwhole-program -fno-use-linker-plugin
OBJS_klipper.elf = $(patsubst %.c, $(OUT)src/%.o,$(src-y))
OBJS_klipper.elf += $(OUT)compile_time_request.o
CFLAGS_klipper.elf = $(CFLAGS) -Wl,--gc-sections
CPPFLAGS = -I$(OUT) -P -MD -MT $@
@@ -83,9 +85,9 @@ $(OUT)compile_time_request.o: $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) ./scri
$(Q)$(PYTHON) ./scripts/buildcommands.py -d $(OUT)klipper.dict -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)klipper.compile_time_request $(OUT)compile_time_request.c
$(Q)$(CC) $(CFLAGS) -c $(OUT)compile_time_request.c -o $@
$(OUT)klipper.elf: $(patsubst %.c, $(OUT)src/%.o,$(src-y)) $(OUT)compile_time_request.o
$(OUT)klipper.elf: $(OBJS_klipper.elf)
@echo " Linking $@"
$(Q)$(CC) $(patsubst %.c, $(OUT)src/%.o,$(src-y)) $(OUT)compile_time_request.o $(CFLAGS_klipper.elf) -o $@
$(Q)$(CC) $(OBJS_klipper.elf) $(CFLAGS_klipper.elf) -o $@
$(Q)scripts/check-gcc.sh $@ $(OUT)compile_time_request.o
################ Kconfig rules