diff options
| author | Pixel <pixel@nobis-crew.org> | 2011-02-05 09:31:48 -0800 | 
|---|---|---|
| committer | Pixel <pixel@nobis-crew.org> | 2011-02-05 09:34:55 -0800 | 
| commit | afdbb22838d7528b70924232814cb84e25890d83 (patch) | |
| tree | 2f8b734839f23ac9b7592d62fcf527758449714b /target-rules.mk | |
| parent | 0044f9480cfa8d5cf0a3d84e84be25e32b588726 (diff) | |
Adding automatic dependency tree building.
Diffstat (limited to 'target-rules.mk')
| -rw-r--r-- | target-rules.mk | 33 | 
1 files changed, 31 insertions, 2 deletions
| diff --git a/target-rules.mk b/target-rules.mk index fe6b710..efb2bba 100644 --- a/target-rules.mk +++ b/target-rules.mk @@ -2,17 +2,42 @@  	$(E) "[TC]     Compiling $<"  	$(Q)$(TARGET_CC) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -g -c -o $@ $< +%.o: %.cc +	$(E) "[TCXX]   Compiling $<" +	$(Q)$(TARGET_CXX) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -g -c -o $@ $< + +%.o: %.cpp +	$(E) "[TCXX]   Compiling $<" +	$(Q)$(TARGET_CXX) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -g -c -o $@ $< +  %.o: %.s  	$(E) "[TS]     Compiling $<"  	$(Q)$(TARGET_AS) $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_ASFLAGS) $(TARGET_CPPFLAGS) -g -c -o $@ $< +%.dep: %.c +	$(Q)$(TARGET_CC) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -g -M -MF $@ $< + +%.dep: %.cc +	$(Q)$(TARGET_CXX) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -g -M -MF $@ $< + +%.dep: %.cpp +	$(Q)$(TARGET_CXX) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -g -M -MF $@ $< + +%.dep: %.s +	$(Q)touch $@ + +%.dep: %.o +	$(Q)touch $@ +  TARGET_OBJS = $(addsuffix .o, $(basename $(TARGET_SRCS))) +TARGET_DEPS = $(addsuffix .dep, $(basename $(TARGET_SRCS)))  ifneq ($(TARGET),)  TARGET_ELF = $(addsuffix .elf, $(basename $(TARGET)))  TARGET_BIN = $(addsuffix .bin, $(basename $(TARGET)))  TARGET_MAP = $(addsuffix .map, $(basename $(TARGET)))  TARGET_OBJS += $(addsuffix .o, $(basename $(TARGET))) +TARGET_DEPS += $(addsuffix .dep, $(basename $(TARGET)))  endif  $(TARGET_ELF): $(TARGET_OBJS) $(LIBDEPS) $(LDSCRIPT) $(SPECS) @@ -29,8 +54,12 @@ $(TARGET_LIB): $(TARGET_OBJS)  	$(E) "[TLIB]   Creating $@"  	$(Q)$(TARGET_AR) rcs $@ $^ -.PHONY: clean-generic +.PHONY: clean-generic ldeps  clean-generic:  	$(E) "[CLEAN]  $(CURDIR)" -	$(Q)rm -f $(TARGET_LIB) $(TARGET_OBJS) $(TARGET) $(TARGET_ELF) $(TARGET_BIN) $(TARGET_MAP) +	$(Q)rm -f $(TARGET_LIB) $(TARGET_OBJS) $(TARGET) $(TARGET_ELF) $(TARGET_BIN) $(TARGET_MAP) $(TARGET_DEPS) + +ldeps: $(TARGET_DEPS) + +-include $(TARGET_DEPS) | 
