mirror of https://github.com/Desuuuu/klipper.git
Makefile: Improve handling of board symbolic link creation
Running "make" directly after a "make distclean" can lead to a corrupt out/board symbolic link. Rework the make rules so that the board symbolic link is created in a new make instance that has the updated definition of CONFIG_BOARD_DIRECTORY. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
427f4b456e
commit
0143199175
12
Makefile
12
Makefile
|
@ -85,17 +85,21 @@ $(OUT)compile_time_request.o: $(patsubst %.c, $(OUT)src/%.o.ctr,$(src-y)) ./scri
|
|||
|
||||
################ Auto generation of "board/" include file link
|
||||
|
||||
$(OUT)board-link: $(KCONFIG_CONFIG)
|
||||
create-board-link:
|
||||
@echo " Creating symbolic link $(OUT)board"
|
||||
$(Q)mkdir -p $(addprefix $(OUT), $(dirs-y))
|
||||
$(Q)echo "#$(CONFIG_BOARD_DIRECTORY)" > $@.temp
|
||||
$(Q)if ! cmp -s $@.temp $@; then rm -f $(OUT)*.d $(patsubst %,$(OUT)%/*.d,$(dirs-y)) ; mv $@.temp $@ ; fi
|
||||
$(Q)rm -f $(OUT)*.d $(patsubst %,$(OUT)%/*.d,$(dirs-y))
|
||||
$(Q)rm -f $(OUT)board
|
||||
$(Q)ln -sf $(CURDIR)/src/$(CONFIG_BOARD_DIRECTORY) $(OUT)board
|
||||
$(Q)mkdir -p $(OUT)board-generic
|
||||
$(Q)rm -f $(OUT)board-generic/board
|
||||
$(Q)ln -sf $(CURDIR)/src/generic $(OUT)board-generic/board
|
||||
|
||||
# Hack to rebuild OUT directory and reload make dependencies on Kconfig change
|
||||
$(OUT)board-link: $(KCONFIG_CONFIG)
|
||||
$(Q)mkdir -p $(OUT)
|
||||
$(Q)echo "# Makefile board-link rule" > $@
|
||||
$(Q)$(MAKE) create-board-link
|
||||
include $(OUT)board-link
|
||||
|
||||
################ Kconfig rules
|
||||
|
@ -114,7 +118,7 @@ menuconfig:
|
|||
################ Generic rules
|
||||
|
||||
# Make definitions
|
||||
.PHONY : all clean distclean olddefconfig menuconfig FORCE
|
||||
.PHONY : all clean distclean olddefconfig menuconfig create-board-link FORCE
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
all: $(target-y)
|
||||
|
|
Loading…
Reference in New Issue