Rules for compiling and linking google test
This commit is contained in:
parent
27a673f5cf
commit
8a9aac6e32
|
@ -204,6 +204,14 @@ $(KEYBOARD_OUTPUT)_DEFS := $(PROJECT_DEFS)
|
|||
$(KEYBOARD_OUTPUT)_INC := $(PROJECT_INC)
|
||||
$(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
include $(TMK_PATH)/rules.mk
|
||||
|
||||
|
|
|
@ -1,5 +1,43 @@
|
|||
ifndef VERBOSE
|
||||
.SILENT:
|
||||
endif
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
include common.mk
|
||||
|
||||
TARGET=test/$(TEST)
|
||||
|
||||
GTEST_OUTPUT = $(BUILD_DIR)/gtest
|
||||
|
||||
OUTPUTS := $(GTEST_OUTPUT)
|
||||
|
||||
GTEST_INC := \
|
||||
$(LIB_PATH)/googletest/googletest/include\
|
||||
$(LIB_PATH)/googletest/googlemock/include\
|
||||
|
||||
GTEST_INTERNAL_INC :=\
|
||||
$(LIB_PATH)/googletest/googletest\
|
||||
$(LIB_PATH)/googletest/googlemock
|
||||
|
||||
$(GTEST_OUTPUT)_SRC :=\
|
||||
googletest/src/gtest-all.cc\
|
||||
googletest/src/gtest_main.cc\
|
||||
googlemock/src/gmock-all.cc
|
||||
|
||||
$(GTEST_OUTPUT)_DEFS :=
|
||||
$(GTEST_OUTPUT)_INC := $(GTEST_INC) $(GTEST_INTERNAL_INC)
|
||||
|
||||
LDFLAGS += -lstdc++ -lpthread -shared-libgcc
|
||||
|
||||
VPATH +=\
|
||||
$(LIB_PATH)/googletest\
|
||||
$(LIB_PATH)/googlemock
|
||||
|
||||
all: elf
|
||||
|
||||
include $(TMK_PATH)/native.mk
|
||||
include $(TMK_PATH)/rules.mk
|
||||
|
||||
$(shell mkdir $(BUILD_DIR)/test 2>/dev/null)
|
||||
|
||||
all:
|
||||
echo Done $(TEST)
|
|
@ -0,0 +1,24 @@
|
|||
CC = gcc
|
||||
OBJCOPY =
|
||||
OBJDUMP =
|
||||
SIZE =
|
||||
AR =
|
||||
NM =
|
||||
HEX =
|
||||
EEP =
|
||||
BIN =
|
||||
|
||||
|
||||
COMPILEFLAGS += -funsigned-char
|
||||
COMPILEFLAGS += -funsigned-bitfields
|
||||
COMPILEFLAGS += -ffunction-sections
|
||||
COMPILEFLAGS += -fdata-sections
|
||||
COMPILEFLAGS += -fshort-enums
|
||||
|
||||
CFLAGS += $(COMPILEFLAGS)
|
||||
CFLAGS += -fno-inline-small-functions
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
|
||||
CPPFLAGS += $(COMPILEFLAGS)
|
||||
CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -std=gnu++11
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue