Use automatic variables for getting the file name and use the MAKEFILE_LIST variable to rebuild the project when any of the Makefiles change
This commit is contained in:
+20
-20
@@ -161,21 +161,21 @@ clean:
|
|||||||
flash: all
|
flash: all
|
||||||
@$(FLASH_CMD) || exit 1
|
@$(FLASH_CMD) || exit 1
|
||||||
|
|
||||||
# Rebuild all objects when the Makefile changes.
|
# Rebuild all objects when the Makefiles change.
|
||||||
$(OBJS): Makefile
|
$(OBJS): $(MAKEFILE_LIST)
|
||||||
|
|
||||||
# The rule for linking the application.
|
# The rule for linking the application.
|
||||||
$(PROJECT_OBJ): $(OBJS) $(LDSCRIPT)
|
$(PROJECT_OBJ): $(OBJS) $(LDSCRIPT)
|
||||||
@if [ '$(VERBOSE)' = 1 ]; then \
|
@if [ '$(VERBOSE)' = 1 ]; then \
|
||||||
echo $(LD_CMD); \
|
echo $(LD_CMD); \
|
||||||
else \
|
else \
|
||||||
echo " $(color_purple)LD$(color_default) $(notdir $(@))"; \
|
echo " $(color_purple)LD$(color_default) $(@F)"; \
|
||||||
fi
|
fi
|
||||||
@echo
|
@echo
|
||||||
@$(LD_CMD)
|
@$(LD_CMD)
|
||||||
@echo
|
@echo
|
||||||
@if [ '$(VERBOSE)' = 1 ]; then \
|
@if [ '$(VERBOSE)' = 1 ]; then \
|
||||||
$(SIZE) -Ax $(@); \
|
$(SIZE) -Ax $(@); \
|
||||||
fi
|
fi
|
||||||
@$(OBJCOPY) -O binary $(@) $(@:.axf=.bin)
|
@$(OBJCOPY) -O binary $(@) $(@:.axf=.bin)
|
||||||
@$(OBJCOPY) -O ihex $(@) $(@:.axf=.hex)
|
@$(OBJCOPY) -O ihex $(@) $(@:.axf=.hex)
|
||||||
@@ -183,28 +183,28 @@ $(PROJECT_OBJ): $(OBJS) $(LDSCRIPT)
|
|||||||
# The rule for building the object files from each source file.
|
# The rule for building the object files from each source file.
|
||||||
$(C_OBJS): $(BUILD_DIR)/%.o : %.c
|
$(C_OBJS): $(BUILD_DIR)/%.o : %.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@if [ '$(VERBOSE)' = 1 ]; then \
|
@if [ '$(VERBOSE)' = 1 ]; then \
|
||||||
echo $(CC_CMD); \
|
echo $(CC_CMD); \
|
||||||
else \
|
else \
|
||||||
echo " $(color_green)CC$(color_default) $(notdir $(<))"; \
|
echo " $(color_green)CC$(color_default) $(<F)"; \
|
||||||
fi
|
fi
|
||||||
@$(CC_CMD)
|
@$(CC_CMD)
|
||||||
|
|
||||||
$(CPP_OBJS): $(BUILD_DIR)/%.o : %.cpp
|
$(CPP_OBJS): $(BUILD_DIR)/%.o : %.cpp
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@if [ '$(VERBOSE)' = 1 ]; then \
|
@if [ '$(VERBOSE)' = 1 ]; then \
|
||||||
echo $(CXX_CMD); \
|
echo $(CXX_CMD); \
|
||||||
else \
|
else \
|
||||||
echo " $(color_cyan)CXX$(color_default) $(notdir $(<))"; \
|
echo " $(color_cyan)CXX$(color_default) $(<F)"; \
|
||||||
fi
|
fi
|
||||||
@$(CXX_CMD)
|
@$(CXX_CMD)
|
||||||
|
|
||||||
$(S_OBJS): $(BUILD_DIR)/%.o: %.S
|
$(S_OBJS): $(BUILD_DIR)/%.o: %.S
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@if [ '$(VERBOSE)' = 1 ]; then \
|
@if [ '$(VERBOSE)' = 1 ]; then \
|
||||||
echo $(AS_CMD); \
|
echo $(AS_CMD); \
|
||||||
else \
|
else \
|
||||||
echo " $(color_magenta)AS$(color_default) $(notdir $(<))"; \
|
echo " $(color_magenta)AS$(color_default) $(<F)"; \
|
||||||
fi
|
fi
|
||||||
@$(AS_CMD)
|
@$(AS_CMD)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user