aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-06-02 16:49:28 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-06-02 16:49:28 +0000
commit719a0e7f7807b72ba0ba4505276f11b38dea8fad (patch)
tree08769af1399b20db675ac2fc0c0f5b8249fb56df
parent4913678695ce103ae65b844254b8e63f325712cb (diff)
downloadlufa-719a0e7f7807b72ba0ba4505276f11b38dea8fad.tar.gz
lufa-719a0e7f7807b72ba0ba4505276f11b38dea8fad.tar.bz2
lufa-719a0e7f7807b72ba0ba4505276f11b38dea8fad.zip
Add dependency file tracking to the BUILD build system module.
-rw-r--r--LUFA/Build/lufa.build.in19
1 files changed, 13 insertions, 6 deletions
diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in
index c84537632..d133e8653 100644
--- a/LUFA/Build/lufa.build.in
+++ b/LUFA/Build/lufa.build.in
@@ -74,7 +74,7 @@ CC_FLAGS ?=
# Output Messages
MSG_BUILD_BEGIN = Begin compilation of project \"$(TARGET)\"...
-MSG_BUILD_END = Finished building project \"$(TARGET)\"...
+MSG_BUILD_END = Finished building project \"$(TARGET)\".
MSG_COMPILE_CMD = ' [CC] :'
MSG_REMOVE_CMD = ' [RM] :'
MSG_LINKER_CMD = ' [LNK] :'
@@ -88,7 +88,8 @@ CPP_SOURCE = $(filter %.cpp, $(SRC))
ASM_SOURCE = $(filter %.S, $(SRC))
# Convert input source filenames into a list of required output object files
-OBJECT_FILES = $(filter %.o, $(C_SOURCE:%.c=%.o) $(CPP_SOURCE:%.cpp=%.o) $(ASM_SOURCE:%.S=%.o))
+OBJECT_FILES = $(filter %.o, $(C_SOURCE:%.c=%.o) $(CPP_SOURCE:%.cpp=%.o) $(ASM_SOURCE:%.S=%.o))
+DEPENDENCY_FILES = $(OBJECT_FILES:%=%.d)
# Create a list of flags to pass to the compiler
ifeq ($(ARCH), AVR8)
@@ -111,7 +112,8 @@ ifneq ($(F_CPU),)
endif
# Additional language specific compiler flags
-C_FLAGS += -Wstrict-prototypes
+C_FLAGS += -O$(OPTIMIZATION) -std=$(C_STANDARD) -MMD -MP -MF $@.d -Wstrict-prototypes
+CPP_FLAGS += -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -MMD -MP -MF $@.d
# Create a list of flags to pass to the linker
LD_FLAGS += -lm -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections
@@ -164,11 +166,11 @@ lss: $(TARGET).lss
%.o: %.c
@echo $(MSG_COMPILE_CMD) Compiling C file \"$<\"
- $(CROSS)gcc -c $(CC_FLAGS) $(C_FLAGS) -O$(OPTIMIZATION) -std=$(C_STANDARD) $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) $(C_FLAGS) $< -o $@
%.o: %.cpp
@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$<\"
- $(CROSS)gcc -c $(CC_FLAGS) $(CPP_FLAGS) -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -x c++ $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) $(CPP_FLAGS) -x c++ $< -o $@
%.o: %.S
@echo $(MSG_COMPILE_CMD) Assembling \"$<\"
@@ -177,7 +179,7 @@ lss: $(TARGET).lss
.PRECIOUS : $(OBJECT_FILES)
%.elf: $(OBJECT_FILES)
@echo $(MSG_LINKER_CMD) Linking object files into \"$@\"
- $(CROSS)gcc $^ $(CC_FLAGS) $(LD_FLAGS) -o $@
+ $(CROSS)gcc $(CC_FLAGS) $(LD_FLAGS) $^ -o $@
%.hex: %.elf
@echo $(MSG_OBJCPY_CMD) Extracting HEX file data from \"$<\"
@@ -194,5 +196,10 @@ lss: $(TARGET).lss
clean:
@echo $(MSG_REMOVE_CMD) Removing object files \"$(strip $(notdir $(OBJECT_FILES)))\"
rm -f $(OBJECT_FILES)
+ @echo $(MSG_REMOVE_CMD) Removing dependency files \"$(strip $(notdir $(DEPENDENCY_FILES)))\"
+ rm -f $(DEPENDENCY_FILES)
@echo $(MSG_REMOVE_CMD) Removing output files \"$(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss\"
rm -f $(TARGET).elf $(TARGET).hex $(TARGET).eep $(TARGET).map $(TARGET).lss
+
+# Include build dependency files
+-include $(DEPENDENCY_FILES) \ No newline at end of file