107 |
bj |
1 |
#----------------------------------------------------------------------------
|
|
|
2 |
# Macros
|
|
|
3 |
#----------------------------------------------------------------------------
|
|
|
4 |
<%marker(top)%>
|
|
|
5 |
<%foreach(configurations)%>
|
|
|
6 |
CXX = <%cxx%>
|
|
|
7 |
<%if(ld)%>
|
|
|
8 |
LD = <%ld%>
|
|
|
9 |
<%else%>
|
|
|
10 |
LD = $(CXX) $(CCFLAGS) $(CPPFLAGS)
|
|
|
11 |
<%endif%>
|
|
|
12 |
AR = <%if(ar)%><%ar%><%else%>ar<%endif%>
|
|
|
13 |
<%if(nm)%>
|
|
|
14 |
NM = <%nm%>
|
|
|
15 |
<%endif%>
|
|
|
16 |
<%if(cputype)%>
|
|
|
17 |
CPUTYPE = <%cputype%>
|
|
|
18 |
<%endif%>
|
|
|
19 |
<%if(cpu)%>
|
|
|
20 |
CPU = <%cpu%>
|
|
|
21 |
<%endif%>
|
|
|
22 |
<%if(pic)%>
|
|
|
23 |
PICFLAGS = <%pic%>
|
|
|
24 |
<%endif%>
|
|
|
25 |
CPPFLAGS = $(PICFLAGS) $(GENFLAGS)<%if(compile_flags)%> <%compile_flags%><%endif%><%if(cpu)%> -DCPU=$(CPU)<%endif%><%if(tempinc)%> <%tempincopt%>$(TEMPINCDIR)<%endif%><%if(compilerflags)%> <%compilerflags%><%endif%><%if(build64bit && compilerflags64)%> <%compilerflags64%><%endif%><%if(pch_source && pchsupport)%><%foreach(pch_defines)%> -D<%pch_define%><%endfor%><%endif%><%foreach(platforms)%><%if(extracppflags)%> <%extracppflags%><%endif%><%endfor%><%if(includes)%><%foreach(includes)%> -I<%include%><%endfor%><%endif%><%if(macros)%><%foreach(macros)%> -D<%macro%><%endfor%><%endif%>
|
|
|
26 |
OBJEXT = <%obj_ext%>
|
|
|
27 |
OUTPUT_OPTION = <%output_option(-o \"$@\")%>
|
|
|
28 |
COMPILE.cc = $(CXX) $(CCFLAGS) $(CPPFLAGS) <%compile_option("-c")%>
|
|
|
29 |
<%foreach(platforms)%>
|
|
|
30 |
<%if(build64bit && arflags64)%>
|
|
|
31 |
ARFLAGS = <%if(extraarflags)%><%extraarflags%> <%endif%><%arflags64%>
|
|
|
32 |
<%else%>
|
|
|
33 |
<%if(arflags)%>
|
|
|
34 |
ARFLAGS = <%if(extraarflags)%><%extraarflags%> <%endif%><%arflags%>
|
|
|
35 |
<%endif%>
|
|
|
36 |
<%endif%>
|
|
|
37 |
<%endfor%>
|
|
|
38 |
<%if(tempinc)%>
|
|
|
39 |
TEMPINCDIR = <%tempinc%><%slash%><%project_name%>
|
|
|
40 |
<%endif%>
|
|
|
41 |
LDFLAGS =<%if(libpaths)%><%foreach(libpaths)%> -L<%libpath%><%endfor%><%endif%><%if(linkflags)%> <%linkflags%><%endif%><%if(build64bit && linkflags64)%> <%linkflags64%><%endif%>
|
|
|
42 |
<%endfor%>
|
|
|
43 |
CCC = $(CXX)
|
|
|
44 |
MAKEFILE = <%project_file%>
|
|
|
45 |
DEPENDENCIES = .depend.$(MAKEFILE)
|
|
|
46 |
<%if(exename)%>
|
|
|
47 |
BTARGETDIR = <%if(install)%><%install%><%else%>.<%endif%><%slash%><%targetoutdir%>
|
|
|
48 |
BIN = $(BTARGETDIR)<%exename%>$(EXEEXT)
|
|
|
49 |
<%else%>
|
|
|
50 |
LTARGETDIR = <%libout%><%slash%><%targetoutdir%>
|
|
|
51 |
<%endif%>
|
|
|
52 |
<%foreach(configurations)%>
|
|
|
53 |
<%foreach(platforms)%>
|
|
|
54 |
RM = <%delete("rm -rf")%>
|
|
|
55 |
CP = <%copy("cp -p")%>
|
|
|
56 |
NUL = <%devnull("/dev/null")%>
|
|
|
57 |
MKDIR = <%makedir("mkdir -p")%>
|
|
|
58 |
EXEEXT = <%exe_ext%>
|
|
|
59 |
LIBPREFIX = <%lib_prefix%>
|
|
|
60 |
LDLIBS =<%foreach(libs lit_libs)%> <%libopt%><%lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%> <%ldlibs%>
|
|
|
61 |
OBJS =<%if(pch_source && pchsupport)%> <%targetoutdir%><%noextension(pch_source)%>$(OBJEXT)<%endif%><%foreach(source_files)%> <%targetoutdir%><%noextension(source_file)%>$(OBJEXT)<%endfor%><%if(rc)%><%foreach(resource_files)%> <%targetoutdir%><%resource_file%>$(OBJEXT)<%endfor%><%endif%>
|
|
|
62 |
<%if(lib_ext)%>
|
|
|
63 |
<%if(staticname)%>
|
|
|
64 |
AREXT = <%lib_ext%>
|
|
|
65 |
LIB = $(LTARGETDIR)$(LIBPREFIX)<%staticname%>$(AREXT)
|
|
|
66 |
<%endif%>
|
|
|
67 |
<%endif%>
|
|
|
68 |
<%if(dll_ext)%>
|
|
|
69 |
<%if(sharedname)%>
|
|
|
70 |
SOEXT = <%dll_ext%>
|
|
|
71 |
SHTARGETDIR = <%if(dllout)%><%dllout%><%else%><%libout%><%endif%><%slash%><%targetoutdir%>
|
|
|
72 |
SHLIB = $(SHTARGETDIR)$(LIBPREFIX)<%sharedname%>$(SOEXT)
|
|
|
73 |
<%if(shflags)%>
|
|
|
74 |
SHFLAGS = <%shflags%>
|
|
|
75 |
<%endif%>
|
|
|
76 |
<%endif%>
|
|
|
77 |
<%endif%>
|
|
|
78 |
<%endfor%>
|
|
|
79 |
<%endfor%>
|
|
|
80 |
GENFLAGS = <%genflags(-g)%>
|
|
|
81 |
SRC =<%if(pch_source && pchsupport)%> <%pch_source%><%endif%> <%source_files%>
|
|
|
82 |
LINK.cc = $(LD) $(LDFLAGS)
|
|
|
83 |
<%if(dynamicflags)%>
|
|
|
84 |
DYNAMICFLAGS =<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%>
|
|
|
85 |
<%endif%>
|
|
|
86 |
<%if(staticflags)%>
|
|
|
87 |
STATICFLAGS =<%foreach(staticflags)%> -D<%staticflag%><%endfor%>
|
|
|
88 |
<%endif%>
|
|
|
89 |
EXPORTFLAGS = <%if(exename)%><%if(need_staticflags)%>$(STATICFLAGS)<%endif%><%else%><%foreach(configurations)%><%foreach(platforms)%><%if(dll_ext && sharedname)%>$(DYNAMICFLAGS)<%else%>$(STATICFLAGS)<%endif%><%endfor%><%endfor%><%endif%>
|
|
|
90 |
<%marker(macros)%>
|
|
|
91 |
|
|
|
92 |
#----------------------------------------------------------------------------
|
|
|
93 |
# Local targets
|
|
|
94 |
#----------------------------------------------------------------------------
|
|
|
95 |
|
|
|
96 |
<%if(exename)%>
|
|
|
97 |
all: $(BIN)<%if(postbuild)%> __postbuild__<%endif%>
|
|
|
98 |
|
|
|
99 |
<%foreach(configurations)%>
|
|
|
100 |
<%foreach(platforms)%>
|
|
|
101 |
<%if(specialscript)%>
|
|
|
102 |
specialscript:
|
|
|
103 |
@echo '<%specialscript%>' > specialscript
|
|
|
104 |
@chmod 755 specialscript
|
|
|
105 |
|
|
|
106 |
<%endif%>
|
|
|
107 |
<%if(prelink)%>
|
|
|
108 |
<%prelink%>: specialscript $(OBJS)
|
|
|
109 |
@.<%slash%>specialscript $(NM) "$(OBJS)" "$(LDLIBS)" "<%if(libpaths)%><%libpaths%><%else%>.<%endif%>" <%prelink%>
|
|
|
110 |
@$(RM) specialscript
|
|
|
111 |
|
|
|
112 |
<%targetoutdir%><%noextension(prelink)%>$(OBJEXT): <%prelink%>
|
|
|
113 |
$(COMPILE.cc) <%prelink%> $(OUTPUT_OPTION)
|
|
|
114 |
@$(RM) <%prelink%>
|
|
|
115 |
|
|
|
116 |
<%endif%>
|
|
|
117 |
<%endfor%>
|
|
|
118 |
<%endfor%>
|
|
|
119 |
$(BTARGETDIR):
|
|
|
120 |
@$(MKDIR) "$@"
|
|
|
121 |
|
|
|
122 |
$(BIN): $(BTARGETDIR)<%foreach(configurations)%><%if(tempinc)%> $(TEMPINCDIR)<%endif%><%foreach(platforms)%><%if(prelink)%> <%targetoutdir%><%noextension(prelink)%>$(OBJEXT)<%endif%><%endfor%><%endfor%> $(OBJS)
|
|
|
123 |
$(LINK.cc) $(OUTPUT_OPTION) $(OBJS) $(LDLIBS)
|
|
|
124 |
|
|
|
125 |
<%else%>
|
|
|
126 |
$(LTARGETDIR):
|
|
|
127 |
@$(MKDIR) "$@"
|
|
|
128 |
<%endif%>
|
|
|
129 |
|
|
|
130 |
<%foreach(configurations)%>
|
|
|
131 |
<%foreach(platforms)%>
|
|
|
132 |
<%if(dll_ext)%>
|
|
|
133 |
<%if(sharedname)%>
|
|
|
134 |
all: $(SHLIB)<%if(postbuild)%> __postbuild__<%endif%>
|
|
|
135 |
|
|
|
136 |
<%if(dllout)%>
|
|
|
137 |
$(SHTARGETDIR):
|
|
|
138 |
@$(MKDIR) "$@"
|
|
|
139 |
|
|
|
140 |
<%endif%>
|
|
|
141 |
$(SHLIB): $(SHTARGETDIR) <%foreach(configurations)%><%if(tempinc)%>$(TEMPINCDIR) <%endif%><%endfor%>$(OBJS)
|
|
|
142 |
<%foreach(configurations)%><%foreach(platforms)%><%if(dld)%><%dld%> $(LDFLAGS)<%else%>$(LINK.cc)<%endif%><%endfor%><%endfor%> $(SHFLAGS) $(OUTPUT_OPTION) $(OBJS) $(LDLIBS)
|
|
|
143 |
<%else%>
|
|
|
144 |
<%if(staticname)%>
|
|
|
145 |
all: $(LIB)<%if(postbuild)%> __postbuild__<%endif%>
|
|
|
146 |
<%endif%>
|
|
|
147 |
<%endif%>
|
|
|
148 |
|
|
|
149 |
<%else%>
|
|
|
150 |
<%if(staticname)%>
|
|
|
151 |
all: $(LIB)<%if(postbuild)%> __postbuild__<%endif%>
|
|
|
152 |
|
|
|
153 |
<%endif%>
|
|
|
154 |
<%endif%>
|
|
|
155 |
<%endfor%>
|
|
|
156 |
<%endfor%>
|
|
|
157 |
<%if(staticname)%>
|
|
|
158 |
$(LIB): $(LTARGETDIR) <%foreach(configurations)%><%if(tempinc)%>$(TEMPINCDIR) <%endif%><%endfor%>$(OBJS)
|
|
|
159 |
<%foreach(configurations)%>
|
|
|
160 |
<%foreach(platforms)%>
|
|
|
161 |
$(AR) $(ARFLAGS) $(LIB) $(OBJS)<%if(tempinc)%> `find $(TEMPINCDIR) -type f`<%endif%>
|
|
|
162 |
<%if(ranlib)%>
|
|
|
163 |
ranlib $(LIB)
|
|
|
164 |
<%endif%>
|
|
|
165 |
<%endfor%>
|
|
|
166 |
<%endfor%>
|
|
|
167 |
|
|
|
168 |
<%endif%>
|
|
|
169 |
<%if(custom_types)%>
|
|
|
170 |
GENERATED_DIRTY =<%foreach(custom_types)%><%foreach(custom_type->input_files)%><%if(custom_type->input_file->output_files)%><%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%><%endif%><%endfor%><%endfor%>
|
|
|
171 |
<%foreach(custom_types)%>
|
|
|
172 |
<%if(custom_type->libpath)%>
|
|
|
173 |
# These may be needed, but some versions of make do not accept this syntax
|
|
|
174 |
#DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>
|
|
|
175 |
#LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):<%custom_type->libpath%>
|
|
|
176 |
#SHLIB_PATH := $(SHLIB_PATH):<%custom_type->libpath%>
|
|
|
177 |
#LIBPATH := $(LIBPATH):<%custom_type->libpath%>
|
|
|
178 |
#PATH := $(PATH):<%custom_type->libpath%>
|
|
|
179 |
|
|
|
180 |
<%endif%>
|
|
|
181 |
<%foreach(custom_type->input_files)%>
|
|
|
182 |
<%if(custom_type->input_file->output_files)%>
|
|
|
183 |
<%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>: <%custom_type->input_file%><%if(custom_type->input_file->dependencies)%> <%custom_type->input_file->dependencies%><%endif%><%if(flag_overrides(custom_type->input_file, dependent))%> <%flag_overrides(custom_type->input_file, dependent)%><%else%><%if(custom_type->dependent)%> <%custom_type->dependent%><%endif%><%endif%>
|
|
|
184 |
<%if(flag_overrides(custom_type->input_file, gendir))%>
|
|
|
185 |
@$(MKDIR) <%flag_overrides(custom_type->input_file, gendir)%>
|
|
|
186 |
<%endif%>
|
|
|
187 |
<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%custom_type->input_file%><%if(custom_type->output_option)%> <%custom_type->output_option%> "$@"<%endif%>
|
|
|
188 |
<%if(flag_overrides(custom_type->input_file, postcommand))%>
|
|
|
189 |
<%foreach(custom_type->input_file)%>
|
|
|
190 |
<%flag_overrides(custom_type->input_file, postcommand)%>
|
|
|
191 |
<%endfor%>
|
|
|
192 |
<%else%>
|
|
|
193 |
<%if(custom_type->postcommand)%>
|
|
|
194 |
<%foreach(custom_type->input_file)%>
|
|
|
195 |
<%custom_type->postcommand%>
|
|
|
196 |
<%endfor%>
|
|
|
197 |
<%endif%>
|
|
|
198 |
<%endif%>
|
|
|
199 |
<%if(pch_header)%>
|
|
|
200 |
<%if(custom_type->pch_postrule)%>
|
|
|
201 |
<%foreach(custom_type->input_file->source_output_files)%>
|
|
|
202 |
@echo '#include "<%pch_header%>"' > temp.$$$$ && cat <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%> >> temp.$$$$ && mv temp.$$$$ <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%><%slash%><%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>
|
|
|
203 |
<%endfor%>
|
|
|
204 |
<%endif%>
|
|
|
205 |
<%endif%>
|
|
|
206 |
|
|
|
207 |
<%endif%>
|
|
|
208 |
<%endfor%>
|
|
|
209 |
<%endfor%>
|
|
|
210 |
.PRECIOUS: $(GENERATED_DIRTY)
|
|
|
211 |
<%if(source_files)%>
|
|
|
212 |
$(OBJS): $(GENERATED_DIRTY)
|
|
|
213 |
<%else%>
|
|
|
214 |
all: $(GENERATED_DIRTY)<%if(postbuild)%> __postbuild__<%endif%>
|
|
|
215 |
<%endif%>
|
|
|
216 |
|
|
|
217 |
<%endif%>
|
|
|
218 |
generated: $(GENERATED_DIRTY)
|
|
|
219 |
@-:
|
|
|
220 |
|
|
|
221 |
<%foreach(configurations)%>
|
|
|
222 |
<%if(tempinc)%>
|
|
|
223 |
$(TEMPINCDIR):
|
|
|
224 |
@-test -d $(TEMPINCDIR) || $(MKDIR) $(TEMPINCDIR) 2> $(NUL) || true
|
|
|
225 |
|
|
|
226 |
<%endif%>
|
|
|
227 |
<%if(pch_source && pchsupport)%>
|
|
|
228 |
<%targetoutdir%><%noextension(pch_source)%>$(OBJEXT): <%pch_source%>
|
|
|
229 |
$(COMPILE.cc) <%if(pchcreate)%><%pchcreate%><%targetoutdir%><%pch_header%>.gch <%endif%>$(EXPORTFLAGS) <%pch_source%><%if(!pchnobj)%> $(OUTPUT_OPTION)<%endif%>
|
|
|
230 |
<%if(pchnobj)%>
|
|
|
231 |
@$(CP) <%pch_header%>.gch <%targetoutdir%><%noextension(pch_source)%>$(OBJEXT)
|
|
|
232 |
<%endif%>
|
|
|
233 |
|
|
|
234 |
<%endif%>
|
|
|
235 |
<%foreach(source_files)%>
|
|
|
236 |
<%targetoutdir%><%noextension(source_file)%>$(OBJEXT): <%source_file%>
|
|
|
237 |
<%if(targetoutdir)%>
|
|
|
238 |
@$(MKDIR) <%targetoutdir%><%dirname(source_file)%>
|
|
|
239 |
<%endif%>
|
|
|
240 |
$(COMPILE.cc) <%if(pchuse && pch_source && pchsupport)%><%pchuse%><%pch_header%>.gch <%endif%>$(EXPORTFLAGS) <%source_file%> $(OUTPUT_OPTION)
|
|
|
241 |
|
|
|
242 |
<%endfor%>
|
|
|
243 |
<%endfor%>
|
|
|
244 |
<%if(resource_files)%>
|
|
|
245 |
<%foreach(platforms)%>
|
|
|
246 |
<%if(rc)%>
|
|
|
247 |
<%foreach(resource_files)%>
|
|
|
248 |
<%targetoutdir%><%resource_file%>$(OBJEXT):
|
|
|
249 |
<%rc%><%foreach(includes)%> -I<%include%><%endfor%> <%resource_file%> <%targetoutdir%><%resource_file%>$(OBJEXT)
|
|
|
250 |
|
|
|
251 |
<%endfor%>
|
|
|
252 |
<%endif%>
|
|
|
253 |
<%endfor%>
|
|
|
254 |
<%endif%>
|
|
|
255 |
clean:
|
|
|
256 |
-$(RM) $(OBJS)<%if(pch_source && pchsupport)%> <%pch_header%>.gch<%endif%>
|
|
|
257 |
<%foreach(configurations)%>
|
|
|
258 |
<%if(clean)%>
|
|
|
259 |
-$(RM) <%clean%>
|
|
|
260 |
<%endif%>
|
|
|
261 |
<%endfor%>
|
|
|
262 |
|
|
|
263 |
realclean: clean
|
|
|
264 |
-$(RM) <%if(exename)%>$(BIN)<%else%>$(SHLIB) $(LIB)<%endif%>
|
|
|
265 |
<%if(custom_types)%>
|
|
|
266 |
-$(RM) $(GENERATED_DIRTY)
|
|
|
267 |
<%endif%>
|
|
|
268 |
|
|
|
269 |
<%if(postbuild)%>
|
|
|
270 |
__postbuild__:
|
|
|
271 |
@<%eval(postbuild)%>
|
|
|
272 |
|
|
|
273 |
<%endif%>
|
|
|
274 |
<%marker(local)%>
|
|
|
275 |
#----------------------------------------------------------------------------
|
|
|
276 |
# Dependencies
|
|
|
277 |
#----------------------------------------------------------------------------
|
|
|
278 |
|
|
|
279 |
$(DEPENDENCIES):
|
|
|
280 |
@touch $(DEPENDENCIES)
|
|
|
281 |
|
|
|
282 |
depend:
|
|
|
283 |
<%if(source_files || pch_source)%>
|
|
|
284 |
-<%depgen("makedepend -Y")%> $(CFLAGS) $(CCFLAGS) $(CPPFLAGS) -f $(DEPENDENCIES) $(SRC) 2> $(NUL)
|
|
|
285 |
<%else%>
|
|
|
286 |
@-:
|
|
|
287 |
<%endif%>
|
|
|
288 |
|
|
|
289 |
include $(DEPENDENCIES)
|
|
|
290 |
<%marker(bottom)%>
|