现在的位置: 首页 > 综合 > 正文

Linux编程Makefile模板

2018年10月04日 ⁄ 综合 ⁄ 共 608字 ⁄ 字号 评论关闭

Makefile模板:

PROG := ./merge_all

DEPS := .

COMPILE_OPTIONS := \
	-I . -I /opt/boost_1_53_0/ -L /usr/lib64 \
	-g 

LINK_OPTIONS := \
	-lstdc++ \
	-lrt \
	-lpthread \
	/opt/boost_1_53_0/stage/lib/libboost_thread.a \
	/opt/boost_1_53_0/stage/lib/libboost_program_options.a \
	/opt/boost_1_53_0/stage/lib/libboost_system.a \
	/opt/boost_1_53_0/stage/lib/libboost_filesystem.a 
	

SOURCE  := $(shell find $(DEPS) -name "*.cpp") $(shell find $(DEPS) -name "*.c")
OBJS    := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))

CC			:= g++
CFLAGS		:= $(COMPILE_OPTIONS)
CPPFLAGS	:= $(CFLAGS)


$(PROG):	$(OBJS)
	$(CC) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LINK_OPTIONS) -o $@

.PHONY:clean
clean:
	-rm -rf $(PROG) $(OBJS) *~

抱歉!评论已关闭.