From 0c4c736552e29074f6c3001fd7ee7407564262e4 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Wed, 2 May 2018 09:34:19 +0200 Subject: [PATCH] Use automatic variables for getting the file name and use the MAKEFILE_LIST variable to rebuild the project when any of the Makefiles change --- scripts/Makedefs.mk | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/Makedefs.mk b/scripts/Makedefs.mk index 3dca4c2..a0f6fc1 100644 --- a/scripts/Makedefs.mk +++ b/scripts/Makedefs.mk @@ -161,21 +161,21 @@ clean: flash: all @$(FLASH_CMD) || exit 1 -# Rebuild all objects when the Makefile changes. -$(OBJS): Makefile +# Rebuild all objects when the Makefiles change. +$(OBJS): $(MAKEFILE_LIST) # The rule for linking the application. $(PROJECT_OBJ): $(OBJS) $(LDSCRIPT) - @if [ '$(VERBOSE)' = 1 ]; then \ - echo $(LD_CMD); \ - else \ - echo " $(color_purple)LD$(color_default) $(notdir $(@))"; \ + @if [ '$(VERBOSE)' = 1 ]; then \ + echo $(LD_CMD); \ + else \ + echo " $(color_purple)LD$(color_default) $(@F)"; \ fi @echo @$(LD_CMD) @echo - @if [ '$(VERBOSE)' = 1 ]; then \ - $(SIZE) -Ax $(@); \ + @if [ '$(VERBOSE)' = 1 ]; then \ + $(SIZE) -Ax $(@); \ fi @$(OBJCOPY) -O binary $(@) $(@:.axf=.bin) @$(OBJCOPY) -O ihex $(@) $(@:.axf=.hex) @@ -183,28 +183,28 @@ $(PROJECT_OBJ): $(OBJS) $(LDSCRIPT) # The rule for building the object files from each source file. $(C_OBJS): $(BUILD_DIR)/%.o : %.c @mkdir -p $(@D) - @if [ '$(VERBOSE)' = 1 ]; then \ - echo $(CC_CMD); \ - else \ - echo " $(color_green)CC$(color_default) $(notdir $(<))"; \ + @if [ '$(VERBOSE)' = 1 ]; then \ + echo $(CC_CMD); \ + else \ + echo " $(color_green)CC$(color_default) $(