aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-03-02 11:26:14 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-03-02 11:26:14 -0500
commit9430fea2c551dad91815df021510a19190df6d97 (patch)
treeef461fe8867f3329ff0f372847a914af20104265 /Makefile
parent309a47c7810bf55d993210c2da014ede7dae8a87 (diff)
downloadkutter-9430fea2c551dad91815df021510a19190df6d97.tar.gz
kutter-9430fea2c551dad91815df021510a19190df6d97.tar.xz
kutter-9430fea2c551dad91815df021510a19190df6d97.zip
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 4 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 61995499..a9e4d0ea 100644
--- a/Makefile
+++ b/Makefile
@@ -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