forked from fredyw/cpp-iniparser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
68 lines (54 loc) · 1.64 KB
/
Copy pathmakefile
File metadata and controls
68 lines (54 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#created by kamuszhou@tencent.com kamuszhou@qq.com
#website: www.dogeye.net v.qq.com
#Jan 15 2014
projname := $(notdir $(CURDIR))
libname := lib$(projname).a
objs := objs/
deps := deps/
src := src/
libstem := $(projname)
sources := $(wildcard $(src)*.cpp)
objects := $(addprefix $(objs),$(notdir $(subst .cpp,.o,$(sources))))
dependencies := $(addprefix $(deps),$(notdir $(subst .cpp,.d,$(sources))))
include_dir := ./include
CXXFLAGS +=
CPPFLAGS += -I$(include_dir) -g -fPIC
LINKFLAGS :=
LINKFLAGS4TEST := -L./$(bins) -l$(libstem) -Wl,-rpath,.
MAKECMDGOAL :=
RM := rm -rf
MV := mv
AR := ar rcs
vpath %.cpp $(src)
vpath %.h . $(include_dir)
.PHONY : clean install dummy
all : $(libname) $(test)
$(libname) : $(deps) $(objs) $(objects)
$(AR) $@ $(objects)
# for debug's purpose
dummy:
#echo $(dependencies)
install :
# -cp $(libname) /usr/local/lib
# -ln -s /usr/local/lib/$(libname) /usr/lib/$(soname)
$(deps):
-mkdir $@
$(objs):
-mkdir $@
ifneq "$(MAKECMDGOAL)" "clean"
-include $(dependencies)
endif
#$(call make-depend,source-file,object-file,depend-file)
# -MM option causes g++ to omit "system" headers from the prerequisites list.
# This option implies -E which will stop after the preprocessing stage; do not
# run the compiler proper.
# -MF option specifies the dependecy filename.
# -MT target change the target of the rule emitted by dependency generation.
define make-depend
g++ -MM -MF $3 -MT $2 $(CPPFLAGS) $(TARGET_ARCH) $1
endef
$(objs)%.o : %.cpp
$(call make-depend, $<,$@,$(addprefix $(deps),$(subst .cpp,.d,$(notdir $<))))
$(COMPILE.C) $(OUTPUT_OPTION) $<
clean :
$(RM) $(objects) $(dependencies) $(libname) $(objs) $(deps)