-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenericRules.mk
141 lines (115 loc) · 3.56 KB
/
genericRules.mk
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#############################
# COMPILATION RULES FOR C++ #
#############################
$(obj)/%.o: $(src)/%$(srcExt) $(dep)/%.d
$(call MKD,$(@D))
$(CC) $(IFOLDERS) $(CFLAGS) -c $< -o $@
$(obj)/$(binFile): $(OBJECTS)
@echo info: building $@
$(CC) $(LFLAGS) $(LIBFOLDERS) $(OBJECTS) -o $@ $(LIBNAMES)
@echo info: building $@ over
##########################
# DEPENDENCY COMPUTATION #
##########################
#This part aims to build dependency files from gcc built-in dep detection feature.
# The $(noDepInclude) var describe the make targets that should not generate dependency update (which could be quite long)
ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(noDepInclude))))
sinclude $(DEPENDENCIES)
endif
genDep: $(DEPENDENCIES)
@echo info: dependancies $(DEPENDENCIES)
@echo info: dependancies generated
$(dep)/%.d : $(src)/%$(srcExt)
@echo info: generation des dependances CPP pour $<
$(call MKD,$(@D))
$(CC) $(IFOLDERS) -MM -MF"$@" -MT"$@" $<
############################
# EXTERNAL DEPENDENCY MGMT #
############################
extInstall::extUninstall
$(call MKD,$(ext))
extUninstall::
$(call RMD,$(ext))
############################
# STANDARD PACKAGING RULES #
############################
ifdef sharedLib
pack:: $(obj)/$(binFile)
@echo info: remove old pack
$(call RMD,$(localRepoFolder))
@echo info: packing...
$(call MKD,$(binPackFolder))
$(call MKD,$(libPackFolder))
$(call MKD,$(includePackFolder))
$(call CP,$(obj)/$(binFile),$(binPackFolder)/$(binFile))
$(call CP,$(obj)/$(implibFile),$(libPackFolder)/$(implibFile))
$(call CPD,$(inc),$(includePackFolder))
@echo info: packing done in $(localRepoFolder)
else
pack:: $(obj)/$(binFile)
@echo info: remove old pack and create new one
$(call RMD,$(localRepoFolder))
$(call MKD,$(localRepoFolder))
@echo info: packing...
$(call CP,$(obj)/$(binFile),$(localRepoFolder)/$(binFile))
@echo info: packing done in $(localRepoFolder)
endif
packExport::pack
@echo info: export...
$(call RMD,$(repoFolder)/$(productName))
$(call MKD,$(repoFolder))
$(call CPD,$(localRepoFolder),$(repoFolder)/$(productName))
@echo info: export done in $(repoFolder)
################
# tool targets #
################
#folders auto creation
./%:
@echo info: creation du dossier $*
$(call MKD,$*)
# many information about project, compilation, build...
info:
@echo info: ENVIRONNEMENT
@echo working directory : %cd%
@echo architecture : $(arch)
@echo info: PROJECT
@echo project name : $(name)
@echo project version : $(version)
@echo product name : $(productName)
@echo info: COMPILER
@echo used compiler : $(C)
@echo compiler path : $(CPATH)
@echo compiler version : $(CVERS)
@echo language standard : $(CSTANDARD)
@echo info: BUILD
@echo tmp build folder : $(localBuildFolder)
@echo tmp local repo : $(localRepoFolder)
@echo packed repository : $(repoFolder)
@echo info: SOURCES
@echo external folder : $(ext)
@echo translation units : {$(TRANSLATUNIT)}
@echo -I folders : {$(IFOLDERS)}
@echo -L folders : {$(LIBFOLDERS)}
@echo -l libraries : {$(LIBNAMES)}
# @echo info: source files:
# @echo {$(CPP_FILES)}
# @echo info: Object files:
# @echo {$(OBJECTS)}
# @echo info: Dependency files:
# @echo {$(DEPENDENCIES)}
genObj: $(OBJECTS)
@echo info: all objects created
#################
# CLEAN METHODS #
#################
cleanAll:
$(call RMD,$(localBuildRoot))
$(call RMD,$(localRepoRoot))
@echo info: cleared
cleanBuildTemp:
$(call RMD,$(obj))
$(call RMD,$(dep))
@echo info: obj cleared
cleandep:
$(call RMD,$(dep))
@echo info: dep cleared