当前位置 : 主页 > 编程语言 > c++ >

makefile通用模板(二)

来源:互联网 收集:自由互联 发布时间:2021-06-23
DIR_INC = ./ includeDIR_SRC = ./ srcDIR_OBJ = ./ objDIR_BIN = ./ binDIR_LIB = /home/exbot/ libLIBS = -lAudioRender -lHCCore -lhcnetsdk -lhpr -lPlayCtrl -lSuperRender -lcameraInterface - lpthreadSRC = $(wildcard ${DIR_SRC} /* .cpp)OBJ = $(pa
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 [email protected]

${DIR_OBJ}/%.o:${DIR_SRC}/%.cpp
    $(CC) $(CFLAGS) -c $< -o [email protected]

.PHONY:clean

clean:
    rm -rf ${DIR_OBJ}/*
上一篇:getline 函数
下一篇:内存管理
网友评论