Merge pull request #6134 from mikeller/allow_custom_includes

Allow tests to define custom include directories (for libs).
This commit is contained in:
Michael Keller 2018-07-11 21:09:23 +12:00 committed by GitHub
commit b4953b8ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@ include $(ROOT)/make/system-id.mk
# variables available:
# <test_name>_SRC
# <test_name>_DEFINES
# <test_name>_INCLUDE_DIRS
alignsensor_unittest_SRC := \
@ -477,6 +478,7 @@ $(OBJECT_DIR)/$1/%.c.o: $(USER_DIR)/%.c
@echo "compiling $$<" "$(STDOUT)"
$(V1) mkdir -p $$(dir $$@)
$(V1) $(CC) $(C_FLAGS) $(TEST_CFLAGS) \
$(foreach def,$($1_INCLUDE_DIRS),-I $(def)) \
$(foreach def,$($1_DEFINES),-D $(def)) \
-c $$< -o $$@
@ -484,6 +486,7 @@ $(OBJECT_DIR)/$1/%.c.o: $(TEST_DIR)/%.c
@echo "compiling test c file: $$<" "$(STDOUT)"
$(V1) mkdir -p $$(dir $$@)
$(V1) $(CC) $(C_FLAGS) $(TEST_CFLAGS) \
$(foreach def,$($1_INCLUDE_DIRS),-I $(def)) \
$(foreach def,$($1_DEFINES),-D $(def)) \
-c $$< -o $$@
@ -491,8 +494,9 @@ $(OBJECT_DIR)/$1/$1.o: $(TEST_DIR)/$1.cc
@echo "compiling $$<" "$(STDOUT)"
$(V1) mkdir -p $$(dir $$@)
$(V1) $(CXX) $(CXX_FLAGS) $(TEST_CFLAGS) \
$(foreach def,$($1_DEFINES),-D $(def)) \
-c $$< -o $$@
$(foreach def,$($1_INCLUDE_DIRS),-I $(def)) \
$(foreach def,$($1_DEFINES),-D $(def)) \
-c $$< -o $$@
$(OBJECT_DIR)/$1/$1 : $$($$1_OBJS) \