Linux编程Makefile模板

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) *~


你可能感兴趣的:(Linux编程Makefile模板)