我还是很陌生。我正在尝试编译一个项目,其中 maketest.cpp 和 maketest.hpp 依赖于Users/wen/Projects/maketest
Makefile 本身。.cc
问题是,我还想.hh
在Users/wen/Projects/include/bigint
.
# Macros
INCLUDE = -I/Users/wen/Projects/include/bigint
LIBS =
CC = g++
override FLAGS += -O2
HEADERS= $(wildcard *.hpp) $(wildcard Users/wen/Projects/include/bigint/*.hh)
# EXE Name
INSTALL = maketest
CC_FILES = %.cpp Users/wen/Projects/include/bigint/%.cc
OBJ_FILES = maketest.o $(wildcard Users/wen/Projects/include/bigint/*.o)
# Rules
$(INSTALL): $(OBJ_FILES)
$(CC) $(FLAGS) $^ -o $@ $(LIBS)
%.o: $(CC_FILES) $(HEADERS)
$(CC) $(FLAGS) $(INCLUDE) -c $< -o $@
# Installation types
install: $(INSTALL)
release:
@echo "Re-run with parameter:"
@echo "FLAGS=-D_RELEASE"
debug:
@echo "Re-run with parameter:"
@echo "FLAGS=-D_DEBUG"
# Cleaning up
clean:
rm -f $(OBJ_FILES) $(INSTALL)
该代码编译 maketest.cpp 并链接它,但不是 bigint。
构建和链接文件的正确方法是Users/wen/Projects/include/bigint
什么?非常感谢!