From 8a9aac6e3237a505682cc7249a8dfff6cb964343 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Mon, 22 Aug 2016 09:16:08 +0300 Subject: Rules for compiling and linking google test --- tmk_core/rules.mk | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'tmk_core/rules.mk') diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 21011c280..317f55e08 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -21,13 +21,14 @@ VPATH_SRC := $(VPATH) vpath %.c $(VPATH_SRC) vpath %.h $(VPATH_SRC) vpath %.cpp $(VPATH_SRC) +vpath %.cc $(VPATH_SRC) vpath %.hpp $(VPATH_SRC) vpath %.S $(VPATH_SRC) VPATH := # Convert all SRC to OBJ define OBJ_FROM_SRC -$(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.S,$1/%.o,$($1_SRC)))) +$(patsubst %.c,$1/%.o,$(patsubst %.cpp,$1/%.o,$(patsubst %.cc,$1/%.o,$(patsubst %.S,$1/%.o,$($1_SRC))))) endef $(foreach OUTPUT,$(OUTPUTS),$(eval $(OUTPUT)_OBJ +=$(call OBJ_FROM_SRC,$(OUTPUT)))) @@ -202,14 +203,6 @@ ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@) -# Default target. -all: build sizeafter - -# Change the build target to build a HEX file or a library. -build: elf hex -#build: elf hex eep lss sym -#build: lib - elf: $(BUILD_DIR)/$(TARGET).elf hex: $(BUILD_DIR)/$(TARGET).hex @@ -305,7 +298,13 @@ $1/%.o : %.cpp $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN) @mkdir -p $$(@D) @$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD) $$(eval CMD=$$(CC) -c $$($1_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) - @$(BUILD_CMD) + @$$(BUILD_CMD) + +$1/%.o : %.cc $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN) + @mkdir -p $$(@D) + @$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD) + $$(eval CMD=$$(CC) -c $$($1_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) + @$$(BUILD_CMD) # Assemble: create object files from assembler source files. $1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN) -- cgit v1.2.3-24-g4f1b