Subversion Repositories gelsvn

Rev

Rev 198 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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