Makefile


#Makefile


proj_dir=./
obj_dir=$(proj_dir)obj/
src_dir=./


#exclude files or dirs by path."" is needed when using a regular expression
exclude_path=


#exclude files or dirs by its name."" is needed when using a regular expression
exclude_name=analys.cpp analys.h
include_suffix="*.c" "*.cpp"


#the target`s name must be the same as the file with main function.
target=analys
target_main_src_suffix=.cpp


cpp=g++
cc=gcc
ld=g++
#CFLAGS=-c -g -Wall -Wno-invalid-offsetof -D_FILE_OFFSET_BITS=64 -D_LOG4CPP -D__STDC_LIMIT_MACROS -D_ENABLE_IO_MONITOR -D_GCC_ATOMIC64 -D_LINUX -D_LOGFILE_DAILY -D_NOLICENSE
CFLAGS=-c -g -Wall -Wno-invalid-offsetof -D_FILE_OFFSET_BITS=64 -D_LOG4CPP -D__STDC_LIMIT_MACROS -D_ENABLE_IO_MONITOR -D_GCC_ATOMIC64 -D_LOGFILE
#if you need change the log file every day, please add "-D_LOGFILE_DAILY"
#if you need debug info, please add "-D_ENABLE_LOG_DEBUG"
#if you need monitor io, please add "-D_ENABLE_IO_MONITOR"
#if your platform support 64-bit __sync*, please add "-D_GCC_ATOMIC64"
#if you don't use license please add "-D_NOLICENSE"
#if you don't use the admin function about util, please add "-D_UTILFORUSER"


LFLAGS= -Wl,-rpath,/etc/scistor/fs/adfs/lib/ -L./lib
#libs= -lcrypt -lz -lboost_thread -llog4cpp -lkyotocabinet -lfuse -lsnappy -ltbb -lboost_serialization
libs= -lboost_thread -llog4cpp #-lreadline -ltermcap -lcrypt -lboost_thread -llog4cpp -lfuse -lsnappy  -lboost_serialization -llzma -lmeta -ltcmalloc_minimal -lz


#usually,you need not change the statements below


###################################################################################
override CFLAGS += -I./


exclude_path_str=$(foreach str,$(exclude_path), -path $(str) -o )


exclude_name_str_=$(foreach str,$(exclude_name), -name $(str) -o )
exclude_name_str=$(wordlist 1,$(shell expr $(words $(exclude_name_str_)) - 1),$(exclude_name_str_))


include_suffix_str_=$(foreach str,$(include_suffix), -name $(str) -o )
include_suffix_str=$(wordlist 1,$(shell expr $(words $(include_suffix_str_)) - 1),$(include_suffix_str_))


dir_src_file=$(shell find ./ \( \( $(exclude_path_str) $(exclude_name_str) \) -prune -o \( $(include_suffix_str) \) -type f -print \) )


src_file=$(foreach obj,$(dir_src_file),$(subst ./,, $(obj)))


obj_file=$(patsubst %, $(obj_dir)%o, $(src_file))


all:$(target)


$(target):%:$(obj_file) $(obj_dir)%$(target_main_src_suffix)o
$(ld) $^ $(LFLAGS) $(libs) -o $@


$(obj_dir)%o:$(src_dir)%
@mkdir -p $(obj_dir)$(dir $<)
$(cpp) $(CFLAGS) $< -o $@


.PHONY:clean
clean:
rm -f $(target) core
rm -fR $(obj_dir)*
#Makefile


proj_dir=./
obj_dir=$(proj_dir)obj/
src_dir=./


#exclude files or dirs by path."" is needed when using a regular expression
exclude_path=


#exclude files or dirs by its name."" is needed when using a regular expression
exclude_name=analys.cpp analys.h
include_suffix="*.c" "*.cpp"


#the target`s name must be the same as the file with main function.
target=analys
target_main_src_suffix=.cpp


cpp=g++
cc=gcc
ld=g++
#CFLAGS=-c -g -Wall -Wno-invalid-offsetof -D_FILE_OFFSET_BITS=64 -D_LOG4CPP -D__STDC_LIMIT_MACROS -D_ENABLE_IO_MONITOR -D_GCC_ATOMIC64 -D_LINUX -D_LOGFILE_DAILY -D_NOLICENSE
CFLAGS=-c -g -Wall -Wno-invalid-offsetof -D_FILE_OFFSET_BITS=64 -D_LOG4CPP -D__STDC_LIMIT_MACROS -D_ENABLE_IO_MONITOR -D_GCC_ATOMIC64 -D_LOGFILE
#if you need change the log file every day, please add "-D_LOGFILE_DAILY"
#if you need debug info, please add "-D_ENABLE_LOG_DEBUG"
#if you need monitor io, please add "-D_ENABLE_IO_MONITOR"
#if your platform support 64-bit __sync*, please add "-D_GCC_ATOMIC64"
#if you don't use license please add "-D_NOLICENSE"
#if you don't use the admin function about util, please add "-D_UTILFORUSER"


LFLAGS= -Wl,-rpath,/etc/scistor/fs/adfs/lib/ -L./lib
#libs= -lcrypt -lz -lboost_thread -llog4cpp -lkyotocabinet -lfuse -lsnappy -ltbb -lboost_serialization
libs= -lboost_thread -llog4cpp #-lreadline -ltermcap -lcrypt -lboost_thread -llog4cpp -lfuse -lsnappy  -lboost_serialization -llzma -lmeta -ltcmalloc_minimal -lz


#usually,you need not change the statements below


###################################################################################
override CFLAGS += -I./


exclude_path_str=$(foreach str,$(exclude_path), -path $(str) -o )


exclude_name_str_=$(foreach str,$(exclude_name), -name $(str) -o )
exclude_name_str=$(wordlist 1,$(shell expr $(words $(exclude_name_str_)) - 1),$(exclude_name_str_))


include_suffix_str_=$(foreach str,$(include_suffix), -name $(str) -o )
include_suffix_str=$(wordlist 1,$(shell expr $(words $(include_suffix_str_)) - 1),$(include_suffix_str_))


dir_src_file=$(shell find ./ \( \( $(exclude_path_str) $(exclude_name_str) \) -prune -o \( $(include_suffix_str) \) -type f -print \) )


src_file=$(foreach obj,$(dir_src_file),$(subst ./,, $(obj)))


obj_file=$(patsubst %, $(obj_dir)%o, $(src_file))


all:$(target)


$(target):%:$(obj_file) $(obj_dir)%$(target_main_src_suffix)o
	$(ld) $^ $(LFLAGS) $(libs) -o $@


$(obj_dir)%o:$(src_dir)%
	@mkdir -p $(obj_dir)$(dir $<)
	$(cpp) $(CFLAGS) $< -o $@


.PHONY:clean
clean:
	rm -f $(target) core
	rm -fR $(obj_dir)*


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值