makefile通用模板(二)
DIR_INC = ./include DIR_SRC = ./src DIR_OBJ = ./obj DIR_BIN = ./bin DIR_LIB = /home/exbot/lib LIBS = -lAudioRender -lHCCore -lhcnetsdk -lhpr -lPlayCtrl -lSuperRender -lcameraInterface -lpthread SRC = $(wildcard ${DIR_SRC}/*.cpp) OBJ = $(patsubst %.cpp,${DIR_OBJ}/%.o,$(notdir ${SRC})) CC = g++ TARGET = Test BIN_TARGET=$(DIR_BIN)/$(TARGET) CFLAGS = -g -Wall -o -shared -I${DIR_INC} ${BIN_TARGET}:${OBJ} $(CC) $(OBJ) -L${DIR_LIB} ${LIBS} -o $@ ${DIR_OBJ}/%.o:${DIR_SRC}/%.cpp $(CC) $(CFLAGS) -c $< -o $@ .PHONY:clean clean: rm -rf ${DIR_OBJ}/*
如果要包含多个头文件目录需要
DIR_INC = -I./include -I./include
在编译时就不要加-I了