summaryrefslogtreecommitdiff
path: root/bin/MakeProjectCreator/templates/gnu.mpd
blob: e024ed2824ddf6215f60b643a53b3c686df80865 (plain)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# -*- Makefile -*-
#----------------------------------------------------------------------------
#       GNU Makefile
#
# @file <%project_file%>
#
# $Id$
#
# This file was automatically generated by MPC.  Any changes made directly to
# this file will be lost the next time it is generated.
#
#----------------------------------------------------------------------------
<%marker(top)%>
MAKEFILE         = <%project_file%>
DEPENDENCY_FILE  = .depend.<%project_name%>
<%if(exename)%>
BIN_UNCHECKED    = <%exename%>
<%endif%>
<%if(staticname)%>

## LIB may be set to empty later on in this file
LIB_UNCHECKED    = lib<%staticname%>.a
LIB              = $(LIB_UNCHECKED)
<%if(!sharedname)%>
static_libs_only = 1
<%endif%>
<%endif%>
<%if(sharedname)%>

## SHLIB may be set to empty later on in this file
SHLIB_UNCHECKED  = lib<%sharedname%>.$(SOEXT)
SHLIB            = $(SHLIB_UNCHECKED)
<%endif%>
<%if(tao)%>

ifndef TAO_ROOT
  TAO_ROOT = $(ACE_ROOT)/TAO
endif
ifndef CIAO_ROOT
  CIAO_ROOT = $(TAO_ROOT)/CIAO
endif
<%endif%>

<%if(grouped_source_files)%>
<%foreach(grouped_source_files)%>
<%grouped_source_file%> = \
<%foreach(grouped_source_file->files)%>
  <%noextension(grouped_source_file->file)%><%fornotlast(" \\")%>
<%endfor%>

<%endfor%>
FILES += \
<%foreach(grouped_source_files)%>
         $(<%grouped_source_file%>)<%fornotlast(" \\")%>
<%endfor%>

<%else%>
FILES = \
<%foreach(source_files)%>
  <%noextension(source_file)%><%fornotlast(" \\")%>
<%endfor%>

<%endif%>
<%if(resource_files)%>
RESOURCES += \
<%foreach(resource_files)%>
  <%resource_file%><%fornotlast(" \\")%>
<%endfor%>

<%endif%>
<%vpath%>
#----------------------------------------------------------------------------
#       Include macros and targets
#----------------------------------------------------------------------------
<%marker(macros)%>
<%if(exename)%>
LDLIBS =<%foreach(libs)%> -l<%lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%><%foreach(lit_libs)%> -l<%lit_lib%><%endfor%>
<%else%>
<%if(sharedname)%>
ACE_SHLIBS =<%foreach(libs)%> -l<%lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%><%foreach(lit_libs)%> -l<%lit_lib%><%endfor%>
<%endif%>
<%endif%>
<%if(tao_idl)%>
TAO_IDL = <%tao_idl%>
<%endif%>
<%if(tao_idlflags)%>
TAO_IDLFLAGS = <%tao_idlflags%>
<%endif%>

include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
## We don't need the ACELIB setting from wrapper_macros.GNU
ACELIB =
<%if(tao)%>
tao_dont_use_idl_make_rule = 1
include $(TAO_ROOT)/rules.tao.GNU
<%endif%>

# To build multiple targets in the same directory on AIX, it works
# best to have a template directory per project.
# The compiler/linker isn't too smart about instantiating templates...
ifdef TEMPINCDIR
TEMPINCDIR := $(TEMPINCDIR)/<%project_name%>

all: $(TEMPINCDIR)

endif

<%if(exename)%>
INSBIN ?= <%if(install)%><%install%><%else%>.<%endif%>
OUTPUT_DIRECTORY = $(INSBIN)
<%else%>
INSLIB ?= <%if(dllout)%><%dllout%><%else%><%libout%><%endif%>
ifeq ($(INSLIB),.)
  ifeq ($(PWD),)
    PWD=$(shell pwd)
  endif
  INSLIB = $(PWD)
endif
OUTPUT_DIRECTORY = $(INSLIB)
<%endif%>
all: $(OUTPUT_DIRECTORY)

$(OUTPUT_DIRECTORY):
	-@mkdir -p "$(OUTPUT_DIRECTORY)"

<%if(sharedname || staticname || exename)%>
<%if(libs && libpaths)%>
# turn off libcheck if doing a dry run
ifeq ($(findstring n, $(MAKEFLAGS)),n)
  LIBCHECK = 1
else
  # turn off libcheck if keep going was passed too
  ifeq ($(findstring k, $(MAKEFLAGS)),k)
    LIBCHECK = 1
  else
    LIBCHECK ?= $(filter-out $(foreach lib,<%libs%>,$(findstring $(lib),$(foreach libpath,<%libpaths%> $(INSLIB),$(wildcard $(libpath)/lib$(lib).* $(libpath)/$(lib).lib)))),<%libs%>)
    ifeq ($(LIBCHECK),)
      LIBCHECK = 1
    endif
  endif
endif
<%else%>
LIBCHECK = 1
<%endif%>
<%else%>
LIBCHECK = 1
<%endif%>
<%if(!exename)%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
ifneq ($(LIBCHECK), 1)
<%if(staticname)%>
  LIB   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: lib_warning
endif
<%foreach(avoids)%>
else
<%if(staticname)%>
  LIB   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
<%if(staticname)%>
  LIB   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: require_warning
endif
<%endfor%>

<%if(tagname)%>
ifeq (,$(<%tagname%>))
<%endif%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
<%foreach(avoids)%>
else
<%if(staticname)%>
  LIB   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
<%if(staticname)%>
  LIB   =
<%endif%>
<%if(sharedname)%>
  SHLIB =
<%endif%>
  all: require_warning
endif
<%endfor%>
<%if(tagname)%>
else
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
<%foreach(tagchecks)%>
  ifeq (<%tagcheck%>, $(findstring <%tagcheck%>, $(<%tagname%>)))
<%endfor%>
<%foreach(tagchecks)%>
  else
    LIB   =
    SHLIB =
  endif
<%endfor%>
<%foreach(avoids)%>
else
  LIB   =
  SHLIB =
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
  LIB   =
  SHLIB =
  all: require_warning
endif
<%endfor%>
endif
<%endif%>
<%endif%>
<%if(exename)%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
ifeq ($(LIBCHECK), 1)
BIN    = $(BIN_UNCHECKED)
else
  all: lib_warning
endif
<%foreach(avoids)%>
else
  all: avoid_warning
endif
<%endfor%>
<%foreach(requires)%>
else
  all: require_warning
endif
<%endfor%>

OBJS   = $(addsuffix .o, $(notdir $(FILES)))
SRC    = $(addsuffix .cpp, $(FILES))
<%endif%>
ifneq (,$(RC))
  FILES += $(RESOURCES)
endif

<%if(sharedname || staticname)%>
LSRC   = $(addsuffix .cpp, $(FILES))
<%endif%>

<%marker(circuit)%>
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
<%if(install && exename)%>

ifneq ($(OUTPUT_DIRECTORY),.)
  INSTALL = $(VBIN:%=$(INSBIN)/%$(EXEEXT))
  CLEANUP_INSTALL += $(CLEANUP_BIN:%=$(INSBIN)/%$(EXEEXT))
endif

<%endif%>
<%if(sharedname || staticname)%>
include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
<%endif%>
<%if(pch_source)%>

ACE_PCH_SOURCE = <%pch_source%>
ACE_PCH_FILE   = <%basename(pch_header)%>.gch

ifeq ($(pchsupport),1)
<%if(pch_defines)%>
CPPFLAGS +=<%foreach(pch_defines)%> -D<%pch_define%><%endfor%>
<%endif%>

$(addprefix $(VDIR), $(OBJS)): $(VDIR)$(ACE_PCH_FILE)
$(VSHOBJS): $(VSHDIR)$(ACE_PCH_FILE)
endif

<%endif%>
include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
<%if(tao)%>
include $(TAO_ROOT)/taoconfig.mk
<%endif%>

<%if(libpaths)%>
LDFLAGS      +=<%foreach(libpaths)%> -L<%libpath%><%endfor%>
<%endif%>
<%if(includes)%>
CPPFLAGS     +=<%foreach(includes)%> -I<%include%><%endfor%>
<%endif%>
<%if(macros)%>
CPPFLAGS     +=<%foreach(macros)%> -D<%macro%><%endfor%>
<%endif%>
<%if(dynamicflags)%>
ifeq ($(shared_libs),1)
  ifneq ($(SHLIB),)
    CPPFLAGS +=<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%>
  endif
endif
<%endif%>
<%if(staticflags)%>
ifeq ($(static_libs),1)
  CPPFLAGS +=<%foreach(staticflags)%> -D<%staticflag%><%endfor%>
endif
<%endif%>

#----------------------------------------------------------------------------
#       Local targets
#----------------------------------------------------------------------------
<%marker(local)%>
lib_warning:
	@echo This project will not be built due to the following missing library:
	@echo $(LIBCHECK)

<%if(requires)%>
require_warning:
	@echo This project will not be built due to one of the following missing features:
	@echo<%foreach(requires)%> <%require%><%endfor%>

<%endif%>
<%if(avoids)%>
avoid_warning:
	@echo This project will not be built due to one of the following enabled features:
	@echo<%foreach(avoids)%> <%avoid%><%endfor%>

<%endif%>
<%if(custom_types)%>
<%foreach(custom_types)%>
<%if(custom_types->libpath)%>
DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>
LD_LIBRARY_PATH   := $(LD_LIBRARY_PATH):<%custom_type->libpath%>
SHLIB_PATH        := $(SHLIB_PATH):<%custom_type->libpath%>
LIBPATH           := $(LIBPATH):<%custom_type->libpath%>
PATH              := $(PATH):<%custom_type->libpath%>

<%endif%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->output_files)%>
GENERATED_DIRTY +=<%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%>
<%if(custom_type->input_file->non_source_output_files)%>
OBJS_DEPEND_ON_GENERATED = 1
<%endif%>
<%foreach(custom_type->input_file->output_files)%>
<%if(forlast && !forfirst)%>
## More than one file is generated by the command and therefore
## it can not be run in parallel.  Unfortunately, there is no way to
## say that only this rule can't be run in parallel.  However, we can
## determine if the generated files have already been generated.  If that's
## the case, then we don't need this special rule.
ifeq ($(wildcard $(GENERATED_DIRTY)), $(GENERATED_DIRTY))
  ## If we can find /bin/test, then we will continue
  ifeq ($(wildcard /bin/test), /bin/test)
    ## If all of the generated files are there, then we need to check
    ## and make sure that the generated files are up-to-date.  If they are not
    ## then we need the special rule.
    ifneq ($(shell<%foreach(custom_type->input_file->output_files)%> /bin/test <%custom_type->input_file%> -nt <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%> 2> /dev/null &&<%endfor%> echo 0),)
      .NOTPARALLEL:
<%if(custom_type->dependent)%>
    else
      ## By this point, all of the generated files are here and up-to-date
      ## with respect to the source file.  Now we need to make sure that
      ## they are up-to-date with respect to the generation tool.  If the tool
      ## is newer than the generated files, then we need the special rule.
      ifneq ($(shell<%foreach(custom_type->input_file->output_files)%> /bin/test <%custom_type->command%>$(EXEEXT) -nt <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%> 2> /dev/null &&<%endfor%> echo 0),)
        .NOTPARALLEL:
      endif
<%endif%>
    endif
  else
    .NOTPARALLEL:
  endif
else
.NOTPARALLEL:
endif
<%endif%>
<%endfor%>
<%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>: <%custom_type->input_file%><%if(custom_type->dependent)%> <%custom_type->command%>$(EXEEXT)<%endif%>
	<%custom_type->command%> <%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%>
<%if(custom_type->postcommand)%>
<%foreach(custom_type->input_file->output_files)%>
	<%custom_type->postcommand()%>
<%endfor%>
<%endif%>
<%if(pch_header)%>
<%if(custom_type->pch_postrule)%>
<%foreach(custom_type->input_file->source_output_files)%>
	@echo '#include "<%pch_header%>"' > temp.$$$$ && cat <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%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)%>/<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>
<%endfor%>
<%endif%>
<%endif%>

<%endif%>
<%endfor%>
<%endfor%>
ifneq ($(GENERATED_DIRTY),)
.PRECIOUS: $(GENERATED_DIRTY)
<%if(source_files)%>
## If the generated files are anything but source files, we need to
## ensure that those files are generated before we attempt to build anything
## else.
ifeq ($(OBJS_DEPEND_ON_GENERATED),1)
$(addprefix $(VDIR), $(OBJS)): $(GENERATED_DIRTY)
$(VSHOBJS): $(GENERATED_DIRTY)
endif
<%else%>
<%foreach(requires)%>
ifeq ($(<%require%>),1)
<%endfor%>
<%foreach(avoids)%>
ifneq ($(<%avoid%>),1)
<%endfor%>
all: $(GENERATED_DIRTY)
<%foreach(avoids)%>
endif
<%endfor%>
<%foreach(requires)%>
endif
<%endfor%>
<%endif%>
endif

<%endif%>
<%if(idl_files)%>
<%if(source_files)%>
ADDITIONAL_IDL_TARGETS +=<%foreach(idl_files)%> <%if(flag_overrides(idl_file, gendir))%><%flag_overrides(idl_file, gendir)%>/<%basenoextension(idl_file)%>$(IDL_CLIENT_HDR_EXT)<%else%><%noextension(idl_file)%>$(IDL_CLIENT_HDR_EXT)<%endif%><%endfor%>
idl_stubs: $(ADDITIONAL_IDL_TARGETS)

# This assignment forces make to run the idl_stubs
# target before building any of the source files.
FORCED_IDL_STUBS = <%source_files%>
<%foreach(custom_types)%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->source_output_files)%>
<%foreach(custom_type->input_file->source_output_files)%>
FORCED_IDL_STUBS := $(FORCED_IDL_STUBS:<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>=)
<%endfor%>
<%endif%>
<%endfor%>
<%endfor%>

ifneq ($(FORCED_IDL_STUBS),)
$(FORCED_IDL_STUBS): idl_stubs
endif
<%endif%>
<%endif%>
<%if(exename)%>

ifndef kylix
$(BIN): $(addprefix $(VDIR), $(OBJS))
	$(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK)
else
$(BIN): $(addprefix $(VDIR), $(OBJS))
	$(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $(VLDLIBS) $(BORINITEXEOBJ) $(POSTLINK) $^, $@,,
endif
<%endif%>

realclean: clean
ifneq ($(GENERATED_DIRTY),)
	-$(RM) -r $(GENERATED_DIRTY)
endif

<%marker(bottom)%>