【发布时间】:2017-10-12 17:49:48
【问题描述】:
我已经在这个 makefile 上工作了很长一段时间了,但我找不到我的问题的解决方案。这是生成文件:
# Compiler:
CPPFLAGS = $(OPT_FLAGS) $(DEBUG_FLAGS) $(STANDARD_FLAGS) \
$(WARN_AS_ERRORS_FLAGS)
# Source files, headers, etc.:
OBJ_DIR = $(CX_BUILD_ROOT)/tests/unit
OUT_DIR = $(CX_BUILD_ROOT)/tests/unit
INCLUDES = -I$(CX_SRC_ROOT)/cXbase/publicAPI
LIBINCLUDES = -L$(CX_BUILD_ROOT)/connectx/libs
VPATH = tests
SRCS = cxUnitTests.cpp\
test_Player.cpp\
test_Name.cpp\
test_Game.cpp\
test_GameBoard.cpp\
test_Disc.cpp\
test_Color.cpp\
test_AsciiColorCode.cpp\
OBJS = test_Player.o\
test_Name.o\
test_Game.o\
test_GameBoard.o\
test_Disc.o\
test_Color.o\
test_AsciiColorCode.o\
LIBS = -lgtest\
-lgtest_main\
-lpthread\
-lcXbase
# Product:
MAIN = cxUnitTests.out
all: make_dir $(MAIN)
$(MAIN): $(OBJS)
@echo Invoquing GCC...
$(CPPC) $(LIBINCLUDES) -o $(OUT_DIR)/$(MAIN) $(OBJS) $(LIBS)
@echo $(MAIN) has been compiled and linked!
$(OBJ_DIR)/%.o: %.cpp
@echo Invoquing GCC...
$(CPPC) $(CPPFLAGS) $(INCLUDES) -c $< -o $@
@echo Object files created!
make_dir:
mkdir -p $(OBJ_DIR)
mkdir -p $(OUT_DIR)
clean:
@echo Removing object files...
$(RM) $(OBJ_DIR)/*.o
@echo Object files removed!
mrproper: clean
@echo Cleaning project...
$(RM) $(OUT_DIR)/$(MAIN)
@echo Project cleaned!
depend: $(SRCS)
@echo Finding dependencies...
makedepend $(INCLUDES) $^
@echo Dependencies found!
“源文件、头文件等”部分中的所有值都在其他使用$(MAKE) -C 选项调用此makefile 的makefile 中定义。它们都可以是@echoed,并且结果值很好。当我运行make 时,我得到:
g++ -g3 -std=c++0x -pedantic-errors -Wall -Wextra -Werror -Wconversion -c -o test_Player.o tests/test_Player.cpp
和
tests/test_Player.cpp:36:30: fatal error: publicAPI/Player.h: No such file or directory
似乎make 出于某种原因无法访问INCLUDES 变量的内容。我使用 Gnu-make。
你能看出哪里不对吗?
问候
【问题讨论】:
标签: makefile gnu-make include-path