Autoconf updates:
[dyninst.git] / newtestsuite / make.module.tmpl
1 #
2 # make.module.tmpl for test suite
3 # Not intended to be a seperate makefile, but to be used in conjunction with
4 # higher level, platform-specific makefiles in the build directories
5
6 RM = rm -f
7 RMDIR ?= rmdir
8 M_GCC ?= purify $(GCC)
9 M_GXX ?= $(GXX)
10 DEPCC ?= $(GCC)
11 DEPENDFLAGS ?= -MM -MT
12 DEPENDDIR = ./depends
13 VPATH   = ../src $(DEPENDDIR)
14
15 DYNINST_INCDIR = -I../../dyninstAPI/h
16 SYMTAB_INCDIR = -I../../symtabAPI/h
17 DYNUTIL_INCDIR = -I../../dynutil/h
18 INSTRUCTION_INCDIR = -I../../instructionAPI/h
19
20 IFLAGS += $(DYNINST_INCDIR)
21 IFLAGS += $(DYNUTIL_INCDIR)
22 IFLAGS += $(SYMTAB_INCDIR)
23 IFLAGS += $(INSTRUCTION_INCDIR)
24
25 #######################################################################
26 ### We don't want all of the CFLAGS stuff that came from make.config.
27 ### Strip away most of it.
28 #######################################################################
29
30 CFLAGS = $(UNIFIED_TEST_DEF:%=%_test) $(AC_DEF) $(FIRST_INCLUDE) -I../../../include -I../src -g
31 CXXFLAGS = $(CFLAGS)
32 CXXFLAGS += $(PLATFORM_CXXFLAGS)
33 CFLAGS_NATIVE = $(CFLAGS)
34 CXXFLAGS_NATIVE = $(CXXFLAGS)
35 MUTATEE_CFLAGS_NATIVE ?= $(CFLAGS)
36 MUTATEE_CXXFLAGS_NATIVE ?= $(CXXFLAGS)
37
38 #######################################################################
39 ###  Generate compiler id strings
40 ###
41 ###  COMPILERT_NATIVE_CC, COMPILERT_NATIVE_CXX must be defined prior to
42 ###  inclusion of this file.  gcc/g++ are handled here as platform-indep
43 ###
44 #######################################################################
45
46 EMPTY:=
47 BLANK:=$(EMPTY) $(EMPTY)
48 LPAREN:=(
49 RPAREN:=)
50 COMMA=,
51
52 COMPILERT_GCC = $(shell $(M_GCC) -v 2>&1 | grep version | head -1)
53 COMPILER1_GCC = $(subst $(BLANK),_,$(COMPILERT_GCC))
54 COMPILER2_GCC = $(subst $(LPAREN),_,$(COMPILER1_GCC))
55 COMPILER_GCC = $(subst $(RPAREN),_,$(COMPILER2_GCC))
56 MUTATEE_CFLAGS_GNU += -DCOMPILER='"$(COMPILER_GCC)"'
57 MUTATEE_LDFLAGS_GNU += -L.
58
59 COMPILERT_GXX = $(shell $(M_GCC) -v 2>&1 | grep version | head -1)
60 COMPILER1_GXX = $(subst $(BLANK),_,$(COMPILERT_GXX))
61 COMPILER2_GXX = $(subst $(LPAREN),_,$(COMPILER1_GXX))
62 COMPILER_GXX = $(subst $(RPAREN),_,$(COMPILER2_GXX))
63 MUTATEE_CXXFLAGS_GNU += -DCOMPILER='"$(COMPILER_GXX)"'
64
65 COMPILER1_NATIVE_CC = $(subst $(BLANK),_,$(COMPILERT_NATIVE_CC))
66 COMPILER2_NATIVE_CC = $(subst $(LPAREN),_,$(COMPILER1_NATIVE_CC))
67 COMPILER_NATIVE_CC = $(subst $(RPAREN),_,$(COMPILER2_NATIVE_CC))
68 MUTATEE_CFLAGS_NATIVE += -DCOMPILER='"$(COMPILER_NATIVE_CC)"'
69 MUTATEE_LDFLAGS_NATIVE += -L.
70
71 COMPILER1_NATIVE_CXX = $(subst $(BLANK),_,$(COMPILERT_NATIVE_CXX))
72 COMPILER2_NATIVE_CXX = $(subst $(LPAREN),_,$(COMPILER1_NATIVE_CXX))
73 COMPILER_NATIVE_CXX = $(subst $(RPAREN),_,$(COMPILER2_NATIVE_CXX))
74 MUTATEE_CXXFLAGS_NATIVE += -DCOMPILER='"$(COMPILER_NATIVE_CXX)"'
75
76 TEST_DEST = $(TO_CORE)/$(PROGRAM_DEST)/testprogs_new2
77 LIB_DEST = $(TO_CORE)/$(LIBRARY_DEST)
78
79 #######################################################################
80 ###  Basic definitions (filename prefixes)
81 #######################################################################
82
83 FORALL_MUTATORS =  
84
85 FORALL_MUTATEES = mutatee_util
86
87 SRCS_LIBTESTSUITE = test_lib.C \
88                     test_lib_soExecution.C \
89                     ParameterDict.C \
90                     TestData.C \
91                     TestMutator.C \
92                     TestOutputDriver.C \
93                     StdOutputDriver.C \
94                     ResumeLog.C \
95                     test_info_new.C
96
97 SRCS_TEMPLATES = test_driver_templates.C 
98
99 OBJS_LIBTESTSUITE = $(SRCS_LIBTESTSUITE:%.C=%.o)
100 OBJS_TEMPLATES = $(SRCS_TEMPLATES:%.C=%.o)
101
102 ifdef USE_LIBTESTSUITE_EXT_A
103 LIBTESTSUITE = libtestSuite.a
104 else
105 LIBTESTSUITE = libtestSuite.so
106 endif
107
108 #######################################################
109 # Dyninst infrastructure components
110 #######################################################
111 SRCS_DYNINSTCOMP_LIB = dyninst/dyninst_comp.C \
112                        dyninst/test_lib_mutateeStart.C \
113                        dyninst/Callbacks.C \
114                        dyninst/Process_data.C \
115                        dyninst/test_lib_test7.C \
116                        dyninst/test_lib_test9.C
117 OBJS_DYNINSTCOMP_LIB = $(notdir $(SRCS_DYNINSTCOMP_LIB:%.C=%.o))
118 SRCS_DYNINSTTESTLIB = dyninst/libtestA.c \
119                       dyninst/libtestB.c \
120                       dyninst/libTest12.c
121
122 #                      dyninst/libInstMe.c \
123 #                      dyninst/libLoadMe.c \
124
125 dyninst_MUTATOR_FLAGS = -L. -ltestdyninst -ldyninstAPI
126
127 ifdef M_ABI
128 DYNINST_TESTLIBS = $(notdir $(SRCS_DYNINSTTESTLIB:%.c=%.so))
129 DYNINST_TESTLIBS_ABI = $(addsuffix _$(M_ABI).so, $(notdir $(SRCS_DYNINSTTESTLIB:%.c=%)))
130 else
131 DYNINST_TESTLIBS = $(notdir $(SRCS_DYNINSTTESTLIB:%.c=%.so))
132 DYNINST_TESTLIBS_ABI =
133 endif
134
135 ifdef USE_LIBTESTSUITE_EXT_A
136 LIBDYNINSTCOMP = libtestdyninst.a
137 else
138 LIBDYNINSTCOMP = libtestdyninst.so
139 endif
140
141 dyninst_MUTATOR_LIB = $(LIBDYNINSTCOMP)
142 dyninst_COMPONENT_LIB = $(LIBDYNINSTCOMP)
143
144
145 #######################################################
146 # Symtab infrastructure components
147 #######################################################
148 SRCS_SYMTABCOMP_LIB = symtab/symtab_comp.C
149 OBJS_SYMTABCOMP_LIB = $(notdir $(SRCS_SYMTABCOMP_LIB:%.C=%.o))
150 symtab_MUTATOR_FLAGS = -L. -ltestsymtab -lsymtabAPI -lcommon
151
152 ifdef USE_LIBTESTSUITE_EXT_A
153 LIBSYMTABCOMP = libtestsymtab.a
154 else
155 LIBSYMTABCOMP = libtestsymtab.so
156 endif
157
158 symtab_MUTATOR_LIB = $(LIBSYMTABCOMP)
159 symtab_COMPONENT_LIB = $(LIBSYMTABCOMP)
160
161 #######################################################
162 # Instruction infrastructure components
163 #######################################################
164 SRCS_INSTRUCTIONCOMP_LIB = instruction/instruction_comp.C
165 OBJS_INSTRUCTIONCOMP_LIB = $(notdir $(SRCS_INSTRUCTIONCOMP_LIB:%.C=%.o))
166 instruction_MUTATOR_FLAGS = -L. -ltestinstruction -linstructionAPI -lcommon
167
168 ifdef USE_LIBTESTSUITE_EXT_A
169 LIBINSTRUCTIONCOMP = libtestinstruction.a
170 else
171 LIBINSTRUCTIONCOMP = libtestinstruction.so
172 endif
173
174 instruction_MUTATOR_LIB = $(LIBINSTRUCTIONCOMP)
175 instruction_COMPONENT_LIB = $(LIBINSTRUCTIONCOMP)
176
177
178 ######################################################################
179 ### Main target
180 ######################################################################
181
182 default: testlibs mutators mutatees_minimum drivers output_drivers components
183         @echo "**********************************************************"
184         @echo "* Build complete."
185         @echo "*"
186         @echo "* High optimization mutatees were not built, use 'make all'"
187         @echo "* to build them."
188         @echo "**********************************************************"
189
190 all: testlibs mutators mutatees drivers output_drivers components
191
192 # test_info_new.gen.o is special-cased because it makes use of the
193 # COMPILER_CONTROL_DEFS to determine which mutatees to enable for compilers
194 # that are not present at all sites.
195 test_info_new.gen.o: test_info_new.gen.C
196         $(CXX) -c -o $@ $(CXXFLAGS) $(COMPILER_CONTROL_DEFS) -I../src/ test_info_new.gen.C
197
198 #######################################################################
199 ###  A list of all the targets we're building, for install purposes
200 #######################################################################
201
202 ALL_TARGETS_DEST                = $(addprefix $(TEST_DEST)/,$(ALL_TARGETS))
203 LIBTESTSUITE_DEST               = $(addprefix $(TEST_DEST)/,$(LIBTESTSUITE))
204
205 #######################################################################
206 ###  Some pattern rules
207 #######################################################################
208
209 CXXTFLAGS := $(filter-out -fno-implicit-templates, $(CXXFLAGS))
210
211 #######################################################################
212 ###  High level targets
213 #######################################################################
214
215 MUTATOR_LDFLAGS := -L. -ltestSuite $(LIBDIR) $(MUTATOR_LIBS) $(MUTATOR_LDFLAGS) -lpthread
216 MUTATOR_SO_LDFLAGS = $(filter-out -liberty, $(MUTATOR_LDFLAGS))
217
218
219 # all: testlibs mutators mutatees drivers
220 # See also an addition to the 'all' rule at the end of the file
221
222 ### Automatically generated variables; generated by makemake.py
223
224 include make.mutators.gen
225
226 include make.solo_mutatee.gen
227
228 mutatees:
229
230 mutators:
231
232 components:
233
234 testlibs:
235
236 #######################################################################
237 ###  Filter results, if needed
238 #######################################################################
239
240 MINIMUM_BUILD_FILTER = %_max %_high %_low
241 ifneq ($(wildcard ../src/dyninst), )
242 mutatees: $(dyninst_SOLO_MUTATEES)
243 mutatees_minimum: $(filter-out $(MINIMUM_BUILD_FILTER), $(dyninst_SOLO_MUTATEES))
244 mutators: $(dyninst_MUTATORS_SO)
245 components: $(LIBDYNINSTCOMP)
246 testlibs: $(DYNINST_TESTLIBS) $(DYNINST_TESTLIBS_ABI)
247 endif
248
249 ifneq ($(wildcard ../src/symtab), )
250 mutatees: $(symtab_SOLO_MUTATEES)
251 mutatees_minimum: $(filter-out $(MINIMUM_BUILD_FILTER), $(symtab_SOLO_MUTATEES))
252 mutators: $(symtab_MUTATORS_SO)
253 components: $(LIBSYMTABCOMP)
254 testlibs:
255 endif
256
257 ifneq ($(wildcard ../src/instruction), )
258 mutatees: $(instruction_SOLO_MUTATEES)
259 mutatees_minimum: $(filter-out $(MINIMUM_BUILD_FILTER), $(instruction_SOLO_MUTATEES))
260 mutators: $(instruction_MUTATORS_SO)
261 ifneq ($(instruction_MUTATORS_SO), )
262 components: $(LIBINSTRUCTIONCOMP)
263 testlibs:
264 endif
265 endif
266
267 install: all
268
269 symlink: all
270
271 clean: clean_solo_mutatees dyninst_clean_solo_mutatees
272         @$(RM) *.da *.bb. *.bbg 
273         @$(RM) $(TESTLIBS) $(TESTLIBS_ABI) $(LIBTESTSUITE) test_driver runTests libTest12.so
274         @$(RM) $(dyninst_MUTATORS_SO)
275         @$(RM) $(symtab_MUTATORS_SO)
276         @$(RM) $(symtab_SOLO_MUTATEES)
277         @$(RM) $(instruction_MUTATORS_SO)
278         @$(RM) $(instruction_SOLO_MUTATEES)
279         @$(RM) $(OUTPUT_DRIVERS)
280         @$(RM) $(LIBDYNINSTCOMP)
281         @$(RM) $(LIBSYMTABCOMP)
282         @$(RM) *.o
283         @$(RM) test11
284         @$(RM) imagefile
285         @$(RM) core core.*
286         @$(RM) -r _dyninstsaved*
287         @$(RM) *.ii *.ti
288         @$(RM) .__afs*
289  
290
291 distclean: clean
292         @if [ -d $(DEPENDDIR) ]; then \
293           $(RM) $(DEPENDDIR)/*.dep; \
294           rmdir $(DEPENDDIR); \
295          fi
296
297 specclean:
298         $(RM) *.gen *.pl tuples test_info_new.gen.C
299
300 ifdef M_ABI
301 $(CALL35_1_OBJ_ABI): $(CALL35_1_SRC_ABI)
302         $(M_GCC) $(M_ABI_FLAG) -c $< $(CFLAGS) $(MUTATEE_CFLAGS_GNU) -o $@ 
303 endif
304
305 testlibs: $(LIBTESTSUITE)
306
307 drivers: test_driver runTests
308
309 .PHONY: clean install distclean mutators mutatees testlibs gnu_mutatees native_mutatees echo all
310
311 #######################################################################
312 ###  Build command for test libraries
313 #######################################################################
314
315 $(dyninst_OBJS_ALL_MUTATORS): %.o : dyninst/%.C $(DEPENDDIR)/%.dep
316         $(CXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ -I../src/dyninst ../src/dyninst/$*.C
317 $(symtab_OBJS_ALL_MUTATORS): %.o : symtab/%.C $(DEPENDDIR)/%.dep
318         $(CXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ -I../src/symtab ../src/symtab/$*.C
319 $(instruction_OBJS_ALL_MUTATORS): %.o : instruction/%.C $(DEPENDDIR)/%.dep
320         $(CXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ -I../src/instruction ../src/instruction/$*.C
321
322 $(DYNINST_TESTLIBS): %.so : dyninst/%.c $(DEPENDDIR)/%.dep
323 ifdef MAKE_SHARED_LIB
324         $(CC) -c $(CFLAGS) $(CFLAGS_TESTLIBS) $(filter %.c, $^) -o $*.o
325         $(MAKE_SHARED_LIB) $(TESTLIB_FLAGS) $*.o -o $@
326 else
327         $(CC) $(TESTLIB_FLAGS) -I../src/ $(filter %.c,$^) -o $@
328 endif
329
330 ifdef M_ABI
331 $(DYNINST_TESTLIBS_ABI): %_$(M_ABI).so : dyninst/%.c $(DEPENDDIR)/%.dep
332 ifdef MAKE_SHARED_LIB
333         $(CC) -c $(CFLAGS) $(CFLAGS_TESTLIBS) $(filter %.c, $^) -o $*.o
334         $(MAKE_SHARED_LIB) $(TESTLIB_FLAGS) $*.o -o $@
335 else
336         $(CC) $(M_ABI_FLAG) $(TESTLIB_FLAGS) -I../src/ $(filter %.c,$^) -o $@
337 endif
338 endif
339
340 $(OBJS_TEMPLATES): %.o : ../src/%.C
341         $(M_GXX) -c -o $@ $(CXXTFLAGS) -I../src/ ../src/$*.C
342
343 test_lib_templates.o : ../src/test_lib_templates.C
344         $(M_GXX) -c -o $@ -fPIC $(CXXTFLAGS) -I../src/ ../src/$*.C
345
346 $(OBJS_DYNINSTCOMP_LIB): %.o : ../src/dyninst/%.C $(DEPENDDIR)/%.dep
347         $(M_GXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/dyninst/$*.C
348
349 $(OBJS_SYMTABCOMP_LIB): %.o : ../src/symtab/%.C $(DEPENDDIR)/%.dep
350         $(M_GXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/symtab/$*.C
351
352 $(OBJS_INSTRUCTIONCOMP_LIB): %.o : ../src/instruction/%.C $(DEPENDDIR)/%.dep
353         $(M_GXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/instruction/$*.C
354
355 $(OBJS_LIBTESTSUITE): %.o : ../src/%.C $(DEPENDDIR)/%.dep
356         $(M_GXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/$*.C
357
358 $(LIBDYNINSTCOMP) : $(OBJS_DYNINSTCOMP_LIB) $(LIBTESTSUITE)
359         $(CXX) -shared $(TESTSUITE_FLAGS) $(LIBDIR) $(OBJS_DYNINSTCOMP_LIB) -o $@ -L. -ltestSuite -ldyninstAPI -lsymtabAPI -lcommon
360
361 $(LIBSYMTABCOMP) : $(OBJS_SYMTABCOMP_LIB) $(LIBTESTSUITE)
362         $(CXX) -shared $(TESTSUITE_FLAGS) $(LIBDIR) $(OBJS_SYMTABCOMP_LIB) -o $@ -L. -ltestSuite -lsymtabAPI -lcommon
363
364 $(LIBINSTRUCTIONCOMP) : $(OBJS_INSTRUCTIONCOMP_LIB) $(LIBTESTSUITE)
365         $(CXX) -shared $(TESTSUITE_FLAGS) $(LIBDIR) $(OBJS_INSTRUCTIONCOMP_LIB) -o $@ -L. -ltestSuite -linstructionAPI -lcommon
366
367 $(LIBTESTSUITE) : $(OBJS_LIBTESTSUITE) test_lib_templates.o test_lib.h
368         $(CXX) -shared $(TESTSUITE_FLAGS) $(LIBDIR) $(LIBS_LIBTESTSUITE) $(OBJS_LIBTESTSUITE) test_lib_templates.o -o $@
369
370 #
371 # Native Fortran mutatees
372
373 # There is no real advantage to generality here since there is only one fortran mutatee
374 # (ie for test1), thus all constituent files are built explicitly
375
376 ifdef NATIVE_FC 
377 test1.mutatee_$(NATIVE_FC).o: ../src/test1.mutateeFort.F
378         $(NATIVE_FC)  $(MUTATEE_NATIVE_FFLAGS) -c -o $@ $^ 
379 test1.mutateeFortC_$(NATIVE_FC).o: ../src/test1.mutateeFortC.c
380         $(NATIVE_FORTRAN_CC) $(MUTATEE_NATIVE_FC_CFLAGS) -c $(filter %.c,$^) -o $@
381
382 $(MUTATEES_NATIVE_FC): test%.mutatee_$(NATIVE_FC) : test%.mutatee_$(NATIVE_FC).o test1.mutateeFortC_$(NATIVE_FC).o test1.mutateeCommon_$(NATIVE_FORTRAN_CC).o mutatee_util_$(NATIVE_FORTRAN_CC).o $(DEPENDDIR)/test%.mutatee_$(NATIVE_FC).dep
383         $(NATIVE_FC) -o $@ $(filter %.o,$^) $(MUTATEE_NATIVE_FC_LDFLAGS) $(MUTATEE_LIBS) 
384 endif
385
386 # Native OpenMP mutatees
387 # There is no real advantage to generality here since there is only one OpenMP mutatee
388 # (ie for test16), thus all constituent files are built explicitly
389 ifdef NATIVE_CXX_OMP 
390 test16.mutatee_$(NATIVE_CXX_OMP).o: ../src/test16.mutatee.c
391         $(NATIVE_CXX_OMP)  $(MUTATEE_NATIVE_CXX_CFLAGS) -o $@ $^ 
392
393 $(MUTATEES_NATIVE_CXX_OMP): test%.mutatee_$(NATIVE_CXX_OMP) : test%.mutatee_$(NATIVE_CXX_OMP).o $(DEPENDDIR)/test%.mutatee_$(NATIVE_CXX_OMP).dep
394         $(NATIVE_CXX_OMP) $(MUTATEE_NATIVE_CXX_OMP_LDFLAGS) -o $@ $(filter %.o,$^) $(MUTATEE_LIBS) 
395
396 #$(MUTATEES_NATIVE_CXX_OMP): ../src/test16.mutatee.c
397 #       $(NATIVE_CXX_OMP)  $(MUTATEE_NATIVE_CXX_CFLAGS) -o $@ $^ 
398
399 endif
400
401
402 # Install directory
403 $(TEST_DEST): 
404         mkdir $(TEST_DEST)
405
406 #######################################################################
407 ###  Generic Mutator build rule:
408 ###
409 ###  resorts to pattern matching test% (matches test1, test2, ... etc)
410 ###  to generate correct, minimal set of prerequisites for each test.
411 ###  It would be nicer to just match something simpler that wasn't 
412 ###  name-dependant, but gnu make is not making this easy.
413 ###
414 #######################################################################
415
416 MUTATEE_DEFS := -Dgnu_cc=_gcc -Dgnu_cxx=_g++
417
418 ifdef M_ABI
419 MUTATEE_DEFS += -Dgnu_abi_cc=_gcc_$(M_ABI) -Dgnu_abi_cxx=_g++_$(M_ABI) -Dm_abi
420 endif
421
422 ifdef M_G77
423 MUTATEE_DEFS += -Dgnu_fc=_g77
424 endif
425
426 ifdef NATIVE_CC
427 MUTATEE_DEFS += -Dnative_cc=_$(NATIVE_CC)
428 endif
429
430 ifdef NATIVE_CXX
431 MUTATEE_DEFS += -Dnative_cxx=_$(NATIVE_CXX)
432 endif
433
434 ifdef NATIVE_FC
435 MUTATEE_DEFS += -Dnative_fc=_$(NATIVE_FC)
436 endif
437
438 runTests.o: ../src/runTests.C $(DEPENDDIR)/runTests.dep
439         $(CXX) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) ../src/runTests.C
440 runTests_static.o: ../src/runTests.C $(DEPENDDIR)/runTests.dep
441         $(CXX) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) -DSTATIC_TEST_DRIVER ../src/runTests.C
442
443 runTests-utils.o: ../src/runTests-utils.C $(DEPENDDIR)/runTests-utils.dep
444         $(CXX) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) ../src/runTests-utils.C
445
446 runTests: runTests.o runTests-utils.o test_driver_templates.o 
447         $(CXX) $(CXXFLAGS) -o $@ runTests.o runTests-utils.o test_driver_templates.o 
448 runTests_static: runTests_static.o runTests-utils.o test_driver_templates.o 
449         $(CXX) $(CXXFLAGS) -o runTests runTests_static.o runTests-utils.o test_driver_templates.o 
450
451 test_driver.o: ../src/test_driver.C $(DEPENDDIR)/test_driver.dep
452         $(CXX) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) ../src/test_driver.C
453
454 test_driver_static.o: ../src/test_driver.C $(DEPENDDIR)/test_driver_static.dep
455         $(CXX) -c -o $@ -DSTATIC_TEST_DRIVER $(CXXFLAGS) $(MUTATEE_DEFS) ../src/test_driver.C
456
457 test_driver: test_driver.o test_driver_templates.o test_info_new.gen.o $(DEPENDDIR)/test_driver.dep $(LIBTESTSUITE)
458         $(CXX) -o $@ test_driver.o test_driver_templates.o test_info_new.gen.o $(MUTATOR_LDFLAGS) $(LIBS) $(TESTDRIVER_LDFLAGS)
459
460 ######################################################################
461 ### Output Drivers
462 ######################################################################
463
464 OUTPUT_DRIVERS = DatabaseOutputDriver.so
465
466 DatabaseOutputDriver.o : ../src/DatabaseOutputDriver.C # $(DEPENDDIR)/DatabaseOutputDriver.dep
467         $(M_GXX) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/$*.C
468
469 DatabaseOutputDriver.so: DatabaseOutputDriver.o # $(DEPENDDIR)/DatabaseOutputDriver.dep
470         $(CXX) -o $@ -shared $(filter %.o,$^) $(MUTATOR_SO_LDFLAGS) $(LIBDIR) $(LIBS) $(LDFLAGS)
471 ifndef NO_OPT_FLAG
472 ifdef STRIP_SO
473         $(STRIP_SO) $@
474 endif
475 endif
476
477 .PHONY: output_drivers
478 output_drivers: $(OUTPUT_DRIVERS)
479
480 #######################################################################
481 ###  Depends
482 #######################################################################
483
484 DEPS_MUTATORS           += $(DEPENDDIR)/test_driver.dep
485 DEPS_MUTATORS           += $(DEPENDDIR)/runTests.dep $(DEPENDDIR)/runTests-utils.dep
486 DEPS_SYMTAB_MUTATORS    += $(addprefix $(DEPENDDIR)/,$(symtab_OBJS_ALL_MUTATORS:%.o=%.dep))
487 DEPS_DYNINST_MUTATORS    += $(addprefix $(DEPENDDIR)/,$(dyninst_OBJS_ALL_MUTATORS:%.o=%.dep))
488 DEPS_INSTRUCTION_MUTATORS    += $(addprefix $(DEPENDDIR)/,$(instruction_OBJS_ALL_MUTATORS:%.o=%.dep))
489
490 DEPS_MUTATEES_GCC       += $(addprefix $(DEPENDDIR)/,$(addsuffix _gcc.dep, $(MUTATEES_C)))
491 DEPS_MUTATEES_GXX       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g++.dep, $(MUTATEES_CXX)))
492 DEPS_MUTATEES_GXX       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g++.dep, $(MUTATEES_CXX_ONLY)))
493 DEPS_DYNINST_TESTLIBS   = $(addprefix $(DEPENDDIR)/,$(DYNINST_TESTLIBS:%.so=%.dep))
494 DEPS_LIBTESTSUITE        = $(addprefix $(DEPENDDIR)/,$(SRCS_LIBTESTSUITE:%.C=%.dep))
495 DEPS_DYNINSTCOMP       =  $(addprefix $(DEPENDDIR)/,$(notdir $(SRCS_DYNINSTCOMP_LIB:%.C=%.dep)))
496 DEPS_SYMTABCOMP        = $(addprefix $(DEPENDDIR)/,$(notdir $(SRCS_SYMTABCOMP_LIB:%.C=%.dep)))
497 DEPS_INSTRUCTIONCOMP        = $(addprefix $(DEPENDDIR)/,$(notdir $(SRCS_INSTRUCTIONCOMP_LIB:%.C=%.dep)))
498
499 ifdef M_G77
500 DEPS_MUTATEES_G77       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g77.dep, $(MUTATEES_FORTRAN)))
501 endif
502
503 ifdef NATIVE_FC
504 DEPS_MUTATEES_NATIVE_FC += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_FC).dep, $(MUTATEES_FORTRAN)))
505 endif
506
507 ifdef NATIVE_CXX_OMP
508 DEPS_MUTATEES_NATIVE_CXX_OMP += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CXX_OMP).dep, $(MUTATEES_OPENMP)))
509 endif
510
511 ifdef NATIVE_CC
512 DEPS_MUTATEES_NATIVE_CC += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CC).dep, $(MUTATEES_C)))
513 endif
514
515 ifdef NATIVE_CXX
516 DEPS_MUTATEES_NATIVE_CXX += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CXX).dep, $(MUTATEES_CXX)))
517 DEPS_MUTATEES_NATIVE_CXX += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CXX).dep, $(MUTATEES_CXX_ONLY)))
518 endif
519
520 depend: $(DEPS_MUTATORS)
521
522 depend_dir:
523         @echo "mut deps: $(DEPS_MUTATORS)"
524         @if [ -d $(DEPENDDIR) ]; then \
525           echo "Directory \"$(DEPENDDIR)\" already exists..."; \
526          else \
527           mkdir -p $(DEPENDIR); \
528           echo "Made \"$(DEPENDDIR)\" directory..."; \
529          fi
530
531 $(DEPENDDIR)/test_driver_static.dep: test_driver.C
532         @mkdir -p $(DEPENDDIR)
533         $(DEPCC) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) -DSTATIC_TEST_DRIVER $(DEPENDFLAGS) $*.o > $@
534
535 $(DEPS_MUTATORS): $(DEPENDDIR)/%.dep : %.C
536         @mkdir -p $(DEPENDDIR)
537         $(DEPCC) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
538
539 $(DEPS_SYMTAB_MUTATORS): $(DEPENDDIR)/%.dep : symtab/%.C
540         @mkdir -p $(DEPENDDIR)
541         $(DEPCC) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
542
543 $(DEPS_INSTRUCTION_MUTATORS): $(DEPENDDIR)/%.dep : instruction/%.C
544         @mkdir -p $(DEPENDDIR)
545         $(DEPCC) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
546
547 $(DEPS_DYNINST_MUTATORS): $(DEPENDDIR)/%.dep : dyninst/%.C
548         @mkdir -p $(DEPENDDIR)
549         $(DEPCC) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
550
551 $(DEPS_MUTATEES_GCC): $(DEPENDDIR)/test%.mutatee_gcc.dep : test%.mutatee.c $(SRCS_FORALL_MUTATEES)
552         @mkdir -p $(DEPENDDIR)
553         $(M_GCC) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutatee_gcc.o > $@
554
555 $(DEPS_MUTATEES_GXX): $(DEPENDDIR)/test%.mutatee_g++.dep : $(wildcard test%.mutatee.*) $(SRCS_FORALL_MUTATEES)
556         @mkdir -p $(DEPENDDIR)
557         $(M_GXX) $(CXXFLAGS) $< $(MUTATEE_CXXFLAGS) $(DEPENDFLAGS) test$*.mutatee_gxx.o > $@
558
559 $(DEPS_MUTATEES_G77): $(DEPENDDIR)/test%.mutatee_g77.dep : test%.mutateeFort.F $(SRCS_FORALL_MUTATEES)
560         @mkdir -p $(DEPENDDIR)
561         $(M_G77) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutateeFort_g77.o > $@
562
563
564 # Use gcc to generate deps for native compilers
565
566 ifdef NATIVE_CC
567 $(DEPS_MUTATEES_NATIVE_CC): $(DEPENDDIR)/test%.mutatee_$(NATIVE_CC).dep : test%.mutatee.c $(SRCS_FORALL_MUTATEES)
568         @mkdir -p $(DEPENDDIR)
569         $(M_GCC) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutatee_$(NATIVE_CC).o > $@
570 endif
571
572 ifdef NATIVE_CXX
573 $(DEPS_MUTATEES_NATIVE_CXX): $(DEPENDDIR)/test%.mutatee_$(NATIVE_CXX).dep : $(wildcard test%.mutatee.*) $(SRCS_FORALL_MUTATEES)
574         @mkdir -p $(DEPENDDIR)
575         $(M_GXX) $(CXXFLAGS) $< $(MUTATEE_CXXFLAGS) $(DEPENDFLAGS) test$*.mutatee_$(NATIVE_CXX).o > $@
576 endif
577
578 ifdef NATIVE_FC
579 $(DEPS_MUTATEES_NATIVE_FC): $(DEPENDDIR)/test%.mutatee_$(NATIVE_FC).dep : test%.mutateeFort.F $(SRCS_FORALL_MUTATEES)
580         @mkdir -p $(DEPENDDIR)
581         $(M_G77) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutateeFort_$(NATIVE_FC).o > $@
582 endif
583
584 ifdef NATIVE_CXX_OMP
585 $(DEPS_MUTATEES_NATIVE_CXX_OMP): $(DEPENDDIR)/test%.mutatee_$(NATIVE_CXX_OMP).dep : test%.mutatee.c $(SRCS_FORALL_MUTATEES)
586         @mkdir -p $(DEPENDDIR)
587         $(M_GXX) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutatee_$(NATIVE_CXX_OMP).o > $@
588 endif
589
590
591 $(DEPS_DYNINST_TESTLIBS): $(DEPENDDIR)/lib%.dep : ../src/dyninst/lib%.c 
592         @mkdir -p $(DEPENDDIR)
593         $(DEPCC) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) lib$*.so > $@
594
595 $(DEPS_LIBTESTSUITE): $(DEPENDDIR)/%.dep : %.C
596         @mkdir -p $(DEPENDDIR)
597         $(DEPCC) $(CXXFLAGS) -I../src $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
598
599 $(DEPS_DYNINSTCOMP): $(DEPENDDIR)/%.dep : dyninst/%.C
600         @mkdir -p $(DEPENDDIR)
601         $(DEPCC) $(CXXFLAGS) -I../src -I../src/dyninst $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
602
603 $(DEPS_SYMTABCOMP): $(DEPENDDIR)/%.dep : symtab/%.C
604         @mkdir -p $(DEPENDDIR)
605         $(DEPCC) $(CXXFLAGS) -I../src -I../src/symtab $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
606
607 $(DEPS_INSTRUCTIONCOMP): $(DEPENDDIR)/%.dep : instruction/%.C
608         @mkdir -p $(DEPENDDIR)
609         $(DEPCC) $(CXXFLAGS) -I../src -I../src/instruction $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
610
611 # do not include dep files for "clean" targets
612 ifneq ($(MAKECMDGOALS),clean)
613 ifneq ($(MAKECMDGOALS),distclean)
614 ifneq ($(MAKECMDGOALS),echo)
615
616 -include $(DEPS_MUTATORS)
617 # -include $(DEPS_MUTATEES_GCC)
618 # -include $(DEPS_MUTATEES_GXX)
619 # -include $(DEPS_TESTLIBS)
620
621 ifdef M_G77
622 # -include $(DEPS_MUTATEES_G77)
623 endif
624
625 ifdef NATIVE_CC
626 # -include $(DEPS_MUTATEES_NATIVE_CC)
627 endif
628
629 ifdef NATIVE_CXX
630 -include $(DEPS_MUTATEES_NATIVE_CXX)
631 endif
632
633 ifdef NATIVE_FC
634 -include $(DEPS_MUTATEES_NATIVE_FC)
635 endif
636
637 ifdef NATIVE_CXX_OMP
638 -include $(DEPS_MUTATEES_NATIVE_CXX_OMP)
639 endif
640
641 endif
642 endif
643 endif