fixes for gcc 4
[dyninst.git] / testsuite / make.module.tmpl
1 #
2 # make.module.tmpl for dyninst 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 ?= $(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
19 IFLAGS += $(DYNINST_INCDIR)
20 IFLAGS += $(DYNUTIL_INCDIR)
21 IFLAGS += $(SYMTAB_INCDIR)
22 CXXFLAGS += $(DYNINST_INCDIR)
23 CXXFLAGS += $(DYNUTIL_INCDIR)
24 CXXFLAGS += $(SYMTAB_INCDIR)
25
26 #######################################################################
27 ###  Generate compiler id strings
28 ###
29 ###  COMPILERT_NATIVE_CC, COMPILERT_NATIVE_CXX must be defined prior to
30 ###  inclusion of this file.  gcc/g++ are handled here as platform-indep
31 ###
32 #######################################################################
33
34 EMPTY:=
35 BLANK:=$(EMPTY) $(EMPTY)
36 LPAREN:=(
37 RPAREN:=)
38 COMMA=,
39
40 COMPILERT_GCC = $(shell $(M_GCC) -v 2>&1 | grep version | head -1)
41 COMPILER1_GCC = $(subst $(BLANK),_,$(COMPILERT_GCC))
42 COMPILER2_GCC = $(subst $(LPAREN),_,$(COMPILER1_GCC))
43 COMPILER_GCC = $(subst $(RPAREN),_,$(COMPILER2_GCC))
44 MUTATEE_CFLAGS_GNU += -DCOMPILER='"$(COMPILER_GCC)"'
45 MUTATEE_CFLAGS_GNU += -g
46
47 COMPILERT_GXX = $(shell $(M_GCC) -v 2>&1 | grep version | head -1)
48 COMPILER1_GXX = $(subst $(BLANK),_,$(COMPILERT_GXX))
49 COMPILER2_GXX = $(subst $(LPAREN),_,$(COMPILER1_GXX))
50 COMPILER_GXX = $(subst $(RPAREN),_,$(COMPILER2_GXX))
51 MUTATEE_CXXFLAGS_GNU += -DCOMPILER='"$(COMPILER_GXX)"'
52 MUTATEE_CXXFLAGS_GNU += -g
53
54 COMPILER1_NATIVE_CC = $(subst $(BLANK),_,$(COMPILERT_NATIVE_CC))
55 COMPILER2_NATIVE_CC = $(subst $(LPAREN),_,$(COMPILER1_NATIVE_CC))
56 COMPILER_NATIVE_CC = $(subst $(RPAREN),_,$(COMPILER2_NATIVE_CC))
57 MUTATEE_CFLAGS_NATIVE += -DCOMPILER='"$(COMPILER_NATIVE_CC)"'
58 MUTATEE_CFLAGS_NATIVE += -g
59
60 COMPILER1_NATIVE_CXX = $(subst $(BLANK),_,$(COMPILERT_NATIVE_CXX))
61 COMPILER2_NATIVE_CXX = $(subst $(LPAREN),_,$(COMPILER1_NATIVE_CXX))
62 COMPILER_NATIVE_CXX = $(subst $(RPAREN),_,$(COMPILER2_NATIVE_CXX))
63 MUTATEE_CXXFLAGS_NATIVE += -DCOMPILER='"$(COMPILER_NATIVE_CXX)"'
64 MUTATEE_CXXFLAGS_NATIVE += -g
65
66 TEST_DEST = $(TO_CORE)/$(PROGRAM_DEST)/testprogs_new
67 LIB_DEST = $(TO_CORE)/$(LIBRARY_DEST)
68
69 #######################################################################
70 ###  Basic definitions (filename prefixes)
71 #######################################################################
72
73 MUTATORS =      test0_0 \
74                 test1_1 \
75                 test1_2 \
76                 test1_3 \
77                 test1_4 \
78                 test1_5 \
79                 test1_6 \
80                 test1_7 \
81                 test1_8 \
82                 test1_9 \
83                 test1_10\
84                 test1_11\
85                 test1_12\
86                 test1_13\
87                 test1_14\
88                 test1_15\
89                 test1_16\
90                 test1_17\
91                 test1_18\
92                 test1_19\
93                 test1_20\
94                 test1_21\
95                 test1_22\
96                 test1_23\
97                 test1_24\
98                 test1_25\
99                 test1_26\
100                 test1_27\
101                 test1_28\
102                 test1_29\
103                 test1_30\
104                 test1_31\
105                 test1_32\
106                 test1_33\
107                 test1_34\
108                 test1_35\
109                 test1_36\
110                 test1_37\
111                 test1_38\
112                 test1_39\
113                 test1_40\
114                 test1_41\
115                 test2_1 \
116                 test2_2 \
117                 test2_3 \
118                 test2_4 \
119                 test2_5\
120                 test2_6\
121                 test2_7\
122                 test2_8\
123                 test2_9\
124                 test2_10 \
125                 test2_11 \
126                 test2_12 \
127                 test2_13 \
128                 test2_14 \
129                 test3_1 \
130                 test3_2 \
131                 test3_3 \
132                 test3_4 \
133                 test3_5 \
134                 test3_6 \
135                 test3_7 \
136                 test4_1 \
137                 test4_2 \
138                 test4_3 \
139                 test4_4 \
140                 test5_1 \
141                 test5_2 \
142                 test5_3 \
143                 test5_4 \
144                 test5_5 \
145                 test5_6 \
146                 test5_7 \
147                 test5_8 \
148                 test5_9 \
149                 test6_1 \
150                 test6_2 \
151                 test6_3 \
152                 test6_4 \
153                 test6_5 \
154                 test6_6 \
155                 test6_7 \
156                 test6_8 \
157                 test7_1 \
158                 test7_2 \
159                 test7_3 \
160                 test7_4 \
161                 test7_5 \
162                 test7_6 \
163                 test7_7 \
164                 test7_8 \
165                 test7_9 \
166                 test8_1 \
167                 test8_2 \
168                 test8_3 \
169                 test9_1 \
170                 test9_2 \
171                 test9_3 \
172                 test9_4 \
173                 test9_5 \
174                 test9_6 \
175                 test9_7 \
176                 test10_1 \
177                 test10_2 \
178                 test10_3 \
179                 test10_4 \
180                 test12_1 \
181                 test12_2 \
182                 test12_3 \
183                 test12_4 \
184                 test12_5 \
185                 test12_6 \
186                 test12_7 \
187                 test12_8 \
188                 test13_1 \
189                 test14_1 \
190                 test15_1 
191
192 ifdef HPC_COMPILER_EXISTS
193 MUTATORS         += test16_1
194 endif
195
196 MUTATORS_SO          += $(addsuffix .so,$(MUTATORS))
197
198
199 FORALL_MUTATORS =  
200
201 MUTATEES_C =    test1.mutatee \
202                 test2.mutatee \
203                 test3.mutatee \
204                 test4a.mutatee \
205                 test4b.mutatee \
206                 test6.mutatee \
207                 test7.mutatee \
208                 test8.mutatee \
209                 test9.mutatee \
210                 test10.mutatee \
211                 test12.mutatee \
212                 test13.mutatee \
213                 test14.mutatee \
214                 test15.mutatee 
215
216 # MUTATEES_CXX specifies a subset of MUTATEES_C that are also compiled with a C++ compiler
217 MUTATEES_CXX =  test1.mutatee \
218                 test2.mutatee \
219                 test3.mutatee \
220                 test4a.mutatee \
221                 test4b.mutatee \
222                 test7.mutatee \
223                 test8.mutatee \
224                 test9.mutatee \
225                 test12.mutatee \
226                 test13.mutatee \
227                 test14.mutatee \
228                 test15.mutatee
229
230 #  Most C mutatees are also compiled as C++ mutatees, there are some (well, one)
231 #  that are c++ only, which cannot also be compiled as C mutatees
232
233 MUTATEES_CXX_ONLY = test5.mutatee 
234 MUTATEES_CXX_GNU_ONLY = test0.mutatee \
235                         test00.mutatee 
236
237 MUTATEES_FORTRAN = test1.mutatee
238
239 MUTATEES_OPENMP = test16.mutatee
240
241 FORALL_MUTATEES = mutatee_util
242
243 TESTLIB_STEMS   += libtestA libtestB libInstMe libLoadMe
244 TESTLIBS = $(addsuffix .so, $(TESTLIB_STEMS))
245
246 ifdef M_ABI
247 TESTLIBS_ABI = $(addsuffix _$(M_ABI).so, $(TESTLIB_STEMS))
248 TESTLIBS_ABI += libTest12_$(M_ABI).so
249 endif
250
251 SRCS_LIBTESTSUITE = test_lib.C \
252                     test_lib_soExecution.C \
253                     test_lib_mutateeStart.C \
254                     test_lib_test7.C \
255                     test_lib_test9.C \
256                     Process_data.C \
257                     ParameterDict.C \
258                     Callbacks.C \
259                     TestData.C 
260
261
262 SRCS_TEMPLATES = test_driver_templates.C 
263
264 OBJS_LIBTESTSUITE = $(SRCS_LIBTESTSUITE:%.C=%.o)
265 OBJS_TEMPLATES = $(SRCS_TEMPLATES:%.C=%.o)
266
267 ifdef USE_LIBTESTSUITE_EXT_A
268 LIBTESTSUITE = libtestSuite.a
269 else
270 LIBTESTSUITE = libtestSuite.so
271 endif
272
273
274
275 #######################################################################
276 ### Generated lists of source files
277 #######################################################################
278
279 # build source names from above prefixes
280 SRCS_MUTATORS           += $(addsuffix .C,$(MUTATORS))
281
282 SRCS_MUTATEES_C         += $(addsuffix .c,$(MUTATEES_C))
283 SRCS_FORALL_MUTATEES    += $(addsuffix .c,$(FORALL_MUTATEES))
284 SRCS_MUTATEES_CXX       += $(addsuffix .c,$(MUTATEES_CXX))
285 SRCS_MUTATEES_CXX       += $(addsuffix .C,$(MUTATEES_CXX_ONLY))
286
287 #######################################################################
288 ###  Target file name list generation
289 #######################################################################
290
291 # build object/exec names from above prefixes
292
293 MUTATEES_GCC            += $(addsuffix _gcc,$(MUTATEES_C))
294 MUTATEES_GXX            += $(addsuffix _g++,$(MUTATEES_CXX))
295 MUTATEES_GXX            += $(addsuffix _g++,$(MUTATEES_CXX_ONLY))
296 MUTATEES_GXX            += $(addsuffix _g++,$(MUTATEES_CXX_GNU_ONLY))
297
298 ifdef M_ABI
299 MUTATEES_GCC_ABI        += $(addsuffix _gcc_$(M_ABI), $(MUTATEES_C))
300 MUTATEES_GXX_ABI        += $(addsuffix _g++_$(M_ABI), $(MUTATEES_CXX))
301 MUTATEES_GXX_ABI        += $(addsuffix _g++_$(M_ABI), $(MUTATEES_CXX_ONLY))
302
303 # Special Case: NASM does not produce x86_64 object files yet.
304 MUTATEES_GCC_ABI        := $(filter-out test6%, $(MUTATEES_GCC_ABI))
305 endif
306
307 ifdef M_G77
308 MUTATEES_G77            += $(addsuffix _g77,$(MUTATEES_FORTRAN))
309 endif
310
311 ifdef NATIVE_CC
312 MUTATEES_NATIVE_CC              += $(filter-out test10.mutatee_$(NATIVE_CC), $(addsuffix _$(NATIVE_CC),$(MUTATEES_C)))
313 endif
314
315 ifdef NATIVE_CXX
316 MUTATEES_NATIVE_CXX             += $(addsuffix _$(NATIVE_CXX),$(MUTATEES_CXX))
317 MUTATEES_NATIVE_CXX_ONLY        += $(addsuffix _$(NATIVE_CXX),$(MUTATEES_CXX_ONLY))
318 endif
319
320 ifdef NATIVE_FC
321 MUTATEES_NATIVE_FC              += $(addsuffix _$(NATIVE_FC),$(MUTATEES_FORTRAN))
322 endif
323
324 ifdef HPC_COMPILER_EXISTS
325 MUTATEES_NATIVE_CXX_OMP         += $(addsuffix _$(NATIVE_CXX_OMP),$(MUTATEES_OPENMP))
326 endif
327
328 TEST6_AS_OBJ_GNU                = $(addsuffix .o,$(TEST6_AS_OBJ_BASE))
329 CALL35_1_OBJ                    = $(CALL35_1_SRC:call%.s=call%.o)
330
331 ifdef M_ABI
332 CALL35_1_OBJ_ABI                = $(CALL35_1_SRC_ABI:call%.s=call%.o)
333 endif
334
335 OBJS_MUTATORS                   = $(SRCS_MUTATORS:%.C=%.o)
336
337 OBJS_ALL_MUTATORS               = $(OBJS_MUTATORS) \
338                                   $(OBJS_FORALL_MUTATORS) 
339
340 #######################################################################
341 ###  A list of all the targets we're building, for install purposes
342 #######################################################################
343
344 ALL_TARGETS                     = $(MUTATORS_SO) $(MUTATEES_GCC) $(MUTATEES_GXX)
345 ALL_TARGETS                     += $(TESTLIBS)
346 ALL_TARGETS                     += libTest12.so
347 ALL_TARGETS                     += test11
348 ALL_TARGETS                     += runTests
349 ALL_TARGETS                     += test_driver
350 ifdef STATIC_TEST_DRIVER
351 ALL_TARGETS                     += test_driver_static
352 endif
353 ifdef M_ABI
354 ALL_TARGETS                     += $(MUTATEES_GCC_ABI) $(MUTATEES_GXX_ABI)
355 ALL_TARGETS                     += $(TESTLIBS_ABI)
356 endif
357 ifdef M_G77
358 ALL_TARGETS                     += $(MUTATEES_G77)
359 endif
360 ifdef NATIVE_CC
361 ALL_TARGETS                     += $(MUTATEES_NATIVE_CC)
362 endif
363 ifdef NATIVE_CXX
364 ALL_TARGETS                     += $(MUTATEES_NATIVE_CXX)
365 ALL_TARGETS                     += $(MUTATEES_NATIVE_CXX_ONLY)
366 endif
367 ifdef NATIVE_FC
368 ALL_TARGETS                     += $(MUTATEES_NATIVE_FC)
369 endif
370 ifdef HPC_COMPILER_EXISTS
371 ALL_TARGETS                     += $(MUTATEES_NATIVE_CXX_OMP)
372 endif
373
374 ALL_TARGETS_DEST                = $(addprefix $(TEST_DEST)/,$(ALL_TARGETS))
375 LIBTESTSUITE_DEST               = $(addprefix $(LIB_DEST)/,$(LIBTESTSUITE))
376
377 #######################################################################
378 ###  Some pattern rules
379 #######################################################################
380
381 CXXTFLAGS := $(filter-out -fno-implicit-templates, $(CXXFLAGS))
382 #CXXTFLAGS += -fimplicit-templates
383
384 %_$(NATIVE_CC).o : %.c
385         $(NATIVE_CC) $(STD_NATIVE_ABI_FLAG) -c $< $(CFLAGS_NATIVE) $(MUTATEE_CFLAGS_NATIVE) -o $@
386 %_$(NATIVE_CXX).o : %.c
387         $(NATIVE_CXX) $(STD_NATIVE_ABI_FLAG) -c $< $(CXXFLAGS_NATIVE) $(MUTATEE_CXXFLAGS_NATIVE) -o $@
388
389 %_gcc.o: %.c
390         $(M_GCC) $(STD_ABI_FLAG) -c $< $(CFLAGS) $(MUTATEE_CFLAGS_GNU) -o $@
391 %_g++.o: %.c 
392         $(M_GXX) $(STD_ABI_FLAG) $(CXXFLAGS) $(MUTATEE_CXXFLAGS_GNU) -c $< -o $@
393 %_g++.o: %.C 
394         $(M_GXX) $(STD_ABI_FLAG) $(CXXFLAGS) $(MUTATEE_CXXFLAGS_GNU) -c $< -o $@
395
396 ifdef M_ABI
397 %_gcc_$(M_ABI).o: %.c
398         $(M_GCC) $(M_ABI_FLAG) -c $< $(CFLAGS) $(MUTATEE_CFLAGS_GNU) -o $@
399 %_g++_$(M_ABI).o: %.c 
400         $(M_GXX) $(M_ABI_FLAG) $(CXXFLAGS) $(MUTATEE_CXXFLAGS_GNU) -c $< -o $@
401 %_g++_$(M_ABI).o: %.C 
402         $(M_GXX) $(M_ABI_FLAG) $(CXXFLAGS) $(MUTATEE_CXXFLAGS_GNU) -c $< -o $@
403 endif
404
405 .C.o:
406         $(CXX) $(STD_ABI_FLAG) -c $< $(CXXFLAGS) $(MUTATOR_CXXFLAGS) -o $@
407
408 $(TEST_DEST)/%: %
409         -$(CP) $< $(TEST_DEST)
410         -$(CHMOD) 750 $(TEST_DEST)/$<
411
412 $(LIB_DEST)/%: %
413         -$(CP) $< $(LIB_DEST)
414         -$(CHMOD) 750 $(LIB_DEST)/$<
415
416 $(TEST_DEST_LN)/%: %
417         -$(LN) $< $(TEST_DEST)
418
419 $(LIB_DEST_LN)/%: %
420         -$(LN) $< $(LIB_DEST)
421
422
423 #######################################################################
424 ###  High level targets
425 #######################################################################
426
427 MUTATOR_LDFLAGS := -L. -ltestSuite $(LIBDIR) -lcommon -lsymtabAPI  -ldyninstAPI $(MUTATOR_LIBS) $(MUTATOR_LDFLAGS) -lpthread
428 MUTATOR_SO_LDFLAGS = $(filter-out -liberty, $(MUTATOR_LDFLAGS))
429
430
431 all: testlibs mutators mutatees drivers
432 echo:
433         @echo "DEPS TESTLIBS = $(DEPS_TESTLIBS)"; \
434         echo "MUTATEES_NATIVE_CXX = $(MUTATEES_NATIVE_CXX)"; \
435         echo "MUTATEES_NATIVE_CC = $(MUTATEES_NATIVE_CC)"; \
436         echo "MUTATORS = $(MUTATORS)" ; \
437         echo "MUTATEES_GCC_ABI = $(MUTATEES_GCC_ABI)"
438
439 install: $(TEST_DEST) $(ALL_TARGETS_DEST) $(LIB_DEST) $(LIBTESTSUITE_DEST)
440         @echo "install completed"
441
442 symlink: $(TEST_DEST) $(LIBTESTSUITE_DEST) $(ALL_TARGETS)
443         @for i in $(ALL_TARGETS); do \
444            $(RM) $(TEST_DEST)/$$i; \
445            echo $(LN) $(PWD)/$$i $(TEST_DEST)/$$i; \
446            $(LN) $(PWD)/$$i $(TEST_DEST)/$$i; \
447         done
448
449         @$(RM) $(LIB_DEST)/$(LIBTESTSUITE)
450         $(LN) $(PWD)/$(LIBTESTSUITE) $(LIB_DEST)/$(LIBTESTSUITE)
451
452 static: testlibs mutatees drivers_static
453
454 clean:
455         $(RM) *.da *.bb. *.bbg 
456         $(RM) $(TESTLIBS) $(TESTLIBS_ABI) $(LIBTESTSUITE) test_driver test_driver_static runTests
457         $(RM) $(MUTATORS_SO) $(MUTATEES_GCC) $(MUTATEES_GXX) $(MUTATEES_GCC_ABI) $(MUTATEES_GXX_ABI) $(MUTATEES_G77) $(MUTATEES_GXX_ONLY)
458         $(RM) *.o $(MUTATEES_NATIVE_CC) $(MUTATEES_NATIVE_CXX) $(MUTATEES_NATIVE_FC) $(MUTATEES_NATIVE_CXX_OMP) $(MUTATEES_NATIVE_CXX_ONLY)
459         $(RM) test11
460         $(RM) imagefile
461         $(RM) core core.*
462         $(RM) -r _dyninstsaved*
463         $(RM) *.ii *.ti
464         $(RM) .__afs*
465
466 distclean: clean
467         @if [ -d $(DEPENDDIR) ]; then \
468           $(RM) $(DEPENDDIR)/*.dep; \
469           rmdir $(DEPENDDIR); \
470          fi
471
472 ifdef M_ABI
473 $(CALL35_1_OBJ_ABI): $(CALL35_1_SRC_ABI)
474         $(M_GCC) $(M_ABI_FLAG) -c $< $(CFLAGS) $(MUTATEE_CFLAGS_GNU) -o $@ 
475 endif
476
477
478 mutators: $(MUTATORS_SO) test11
479 mutatees: gnu_mutatees native_mutatees
480 gnu_mutatees: $(MUTATEES_GCC) $(MUTATEES_GXX) $(MUTATEES_G77) $(MUTATEES_GCC_ABI) $(MUTATEES_GXX_ABI)
481 native_mutatees: $(MUTATEES_NATIVE_CC) $(MUTATEES_NATIVE_CXX) $(MUTATEES_NATIVE_FC) $(MUTATEES_NATIVE_CXX_OMP) $(MUTATEES_NATIVE_CXX_ONLY)
482 testlibs: $(TESTLIBS) $(TESTLIBS_ABI) $(LIBTESTSUITE) libTest12.so
483
484 drivers: test_driver runTests
485 drivers_static: test_driver_static runTests_static
486
487 .PHONY: clean install distclean mutators mutatees testlibs gnu_mutatees native_mutatees echo
488
489 # Despite the look, this isn't actually a pattern rule and so is
490 # defined _after_ all:
491 $(CALL35_1_OBJ): $(CALL35_1_SRC)
492         $(M_GCC) -c $< $(CFLAGS) $(MUTATEE_CFLAGS_GNU) -o $@ 
493
494 $(TEST6_AS_OBJ_GNU): $(TEST6_AS_SRC)
495         $(TEST6_AS_GNU) $(TEST6_ASFLAGS_GNU) -o $@ $<
496
497 #######################################################################
498 ###  Build command for test libraries
499 #######################################################################
500
501 $(TESTLIBS): %.so : %.c $(DEPENDDIR)/%.dep
502 ifdef MAKE_SHARED_LIB
503         $(CC) $(STD_ABI_FLAG) -g -c $(CFLAGS) -I$(TO_CORE)/dyninstAPI_RT/h $(CFLAGS_TESTLIBS) $(filter %.c, $^) -o $*.o
504         $(MAKE_SHARED_LIB) $(STD_NATIVE_ABI_LDFLAG) $(TESTLIB_FLAGS) $*.o -o $@
505 else
506         $(CC) $(STD_ABI_FLAG) $(TESTLIB_FLAGS) -I$(TO_CORE)/dyninstAPI_RT/h -I../src/ $(filter %.c,$^) -o $@
507 endif
508
509 ifdef M_ABI
510 $(TESTLIBS_ABI): %_$(M_ABI).so : %.c $(DEPENDDIR)/%.dep
511 ifdef MAKE_SHARED_LIB
512         $(CC) $(M_ABI_FLAG) -g -c $(CFLAGS) $(CFLAGS_TESTLIBS) $(filter %.c, $^) -o $*.o
513         $(MAKE_SHARED_LIB) $(M_NATIVE_ABI_LDFLAG) $(TESTLIB_FLAGS) $*.o -o $@
514 else
515         $(CC) $(M_ABI_FLAG) $(TESTLIB_FLAGS) -I$(TO_CORE)/dyninstAPI_RT/h -I../src/ $(filter %.c,$^) -o $@
516 endif
517 endif
518
519 $(OBJS_TEMPLATES): %.o : ../src/%.C 
520         $(M_GXX) $(STD_ABI_FLAG) -c -o $@ $(CXXTFLAGS) -I../src/ ../src/$*.C
521
522 test_lib_templates.o : ../src/test_lib_templates.C 
523         $(M_GXX) $(STD_ABI_FLAG) -c -o $@ -fPIC $(CXXTFLAGS) -I../src/ ../src/$*.C
524
525 $(OBJS_LIBTESTSUITE): %.o : ../src/%.C $(DEPENDDIR)/%.dep
526         $(M_GXX) $(STD_ABI_FLAG) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/$*.C
527
528 $(LIBTESTSUITE) : $(OBJS_LIBTESTSUITE) test_lib_templates.o test_lib.h
529         $(CXX) $(STD_ABI_FLAG) -shared $(TESTSUITE_FLAGS) $(LIBDIR) -ldyninstAPI -lsymtabAPI -lcommon $(LIBS_LIBTESTSUITE) $(OBJS_LIBTESTSUITE) test_lib_templates.o -o $@
530
531 libTest12.so: libTest12.c $(DEPENDDIR)/libTest12.dep
532 ifdef MAKE_SHARED_LIB
533         $(CC) $(STD_ABI_FLAG) -g -c $(CFLAGS) -I$(TO_CORE)/dyninst_RT/h $(CFLAGS_TESTLIBS) $(filter %.c, $^)  -o libTest12.o
534         $(MAKE_SHARED_LIB) $(STD_NATIVE_ABI_LDFLAG) $(TESTLIB_FLAGS) $(LIBTEST12_FLAGS) libTest12.o -o $@
535 else
536         $(CC) $(STD_ABI_FLAG) $(TESTLIB_FLAGS) -I$(TO_CORE)/dyninstAPI_RT/h $(LIBTEST12_FLAGS) $(filter %.c, $^) -o $@
537 endif
538
539 #######################################################################
540 ###  Special Prerequisites for specific Mutatees:
541 #######################################################################
542
543 # Test 1 mutatee depends on two extra files
544 test1.mutatee_gcc: $(CALL35_1_OBJ) test1.mutateeCommon_gcc.o
545 test1.mutatee_g++: $(CALL35_1_OBJ) test1.mutateeCommon_g++.o
546 test1.mutatee_$(NATIVE_CC): $(CALL35_1_SRC) test1.mutateeCommon.c
547 test1.mutatee_$(NATIVE_CXX): $(CALL35_1_SRC) test1.mutateeCommon.c
548
549 ifdef M_ABI
550 test1.mutatee_gcc_$(M_ABI): $(CALL35_1_OBJ_ABI) test1.mutateeCommon_gcc_$(M_ABI).o
551 test1.mutatee_g++_$(M_ABI): $(CALL35_1_OBJ_ABI) test1.mutateeCommon_g++_$(M_ABI).o
552 test1.mutatee_$(NATIVE_CC)_$(M_ABI): $(CALL35_1_SRC_ABI) test1.mutateeCommon.c
553 test1.mutatee_$(NATIVE_CXX)_$(M_ABI): $(CALL35_1_SRC_ABI) test1.mutateeCommon.c
554 endif
555
556 # Test 6 mutatee depends on a platform-specific asm file
557 test6.mutatee_$(NATIVE_CC): $(TEST6_AS_OBJ_GNU) 
558 test6.mutatee_$(NATIVE_CXX): $(TEST6_AS_OBJ_GNU) 
559 test6.mutatee_gcc: $(TEST6_AS_OBJ_GNU) 
560
561 # libInstMe.so must be built before test9.mutatee
562 test9.mutatee_gcc: libInstMe.so
563 test9.mutatee_$(NATIVE_CC): libInstMe.so
564
565 ifdef M_ABI
566 test9.mutatee_gcc: libInstMe_$(M_ABI).so
567 test9.mutatee_$(NATIVE_CC): libInstMe_$(M_ABI).so
568 endif
569
570 test13.mutatee_$(NATIVE_CXX): mutatee_util_mt_$(NATIVE_CXX).o
571 test13.mutatee_$(NATIVE_CC): mutatee_util_mt_$(NATIVE_CC).o
572 test13.mutatee_$(M_GCC): mutatee_util_mt_$(M_GCC).o
573 test13.mutatee_$(M_GXX): mutatee_util_mt_$(M_GXX).o
574 test14.mutatee_$(NATIVE_CXX): mutatee_util_mt_$(NATIVE_CXX).o
575 test14.mutatee_$(NATIVE_CC): mutatee_util_mt_$(NATIVE_CC).o
576 test14.mutatee_$(M_GCC): mutatee_util_mt_$(M_GCC).o
577 test14.mutatee_$(M_GXX): mutatee_util_mt_$(M_GXX).o
578 test15.mutatee_$(NATIVE_CXX): mutatee_util_mt_$(NATIVE_CXX).o
579 test15.mutatee_$(NATIVE_CC): mutatee_util_mt_$(NATIVE_CC).o
580 test15.mutatee_$(M_GCC): mutatee_util_mt_$(M_GCC).o
581 test15.mutatee_$(M_GXX): mutatee_util_mt_$(M_GXX).o
582
583 test14.mutatee_$(NATIVE_CXX): mutatee_util_mt_$(NATIVE_CXX).o
584 test14.mutatee_$(NATIVE_CC): mutatee_util_mt_$(NATIVE_CC).o
585 test14.mutatee_$(M_GCC): mutatee_util_mt_$(M_GCC).o
586 test14.mutatee_$(M_GXX): mutatee_util_mt_$(M_GXX).o
587
588 test15.mutatee_$(NATIVE_CXX): mutatee_util_mt_$(NATIVE_CXX).o
589 test15.mutatee_$(NATIVE_CC): mutatee_util_mt_$(NATIVE_CC).o
590 test15.mutatee_$(M_GCC): mutatee_util_mt_$(M_GCC).o
591 test15.mutatee_$(M_GXX): mutatee_util_mt_$(M_GXX).o
592
593 ifdef M_ABI
594 test13.mutatee_$(NATIVE_CXX)_$(M_ABI): mutatee_util_mt_$(NATIVE_CXX)_$(M_ABI).o
595 test13.mutatee_$(NATIVE_CC)_$(M_ABI): mutatee_util_mt_$(NATIVE_CC)_$(M_ABI).o
596 test13.mutatee_$(M_GCC)_$(M_ABI): mutatee_util_mt_$(M_GCC)_$(M_ABI).o
597 test13.mutatee_$(M_GXX)_$(M_ABI): mutatee_util_mt_$(M_GXX)_$(M_ABI).o
598 test14.mutatee_$(NATIVE_CXX)_$(M_ABI): mutatee_util_mt_$(NATIVE_CXX)_$(M_ABI).o
599 test14.mutatee_$(NATIVE_CC)_$(M_ABI): mutatee_util_mt_$(NATIVE_CC)_$(M_ABI).o
600 test14.mutatee_$(M_GCC)_$(M_ABI): mutatee_util_mt_$(M_GCC)_$(M_ABI).o
601 test14.mutatee_$(M_GXX)_$(M_ABI): mutatee_util_mt_$(M_GXX)_$(M_ABI).o
602 test15.mutatee_$(NATIVE_CXX)_$(M_ABI): mutatee_util_mt_$(NATIVE_CXX)_$(M_ABI).o
603 test15.mutatee_$(NATIVE_CC)_$(M_ABI): mutatee_util_mt_$(NATIVE_CC)_$(M_ABI).o
604 test15.mutatee_$(M_GCC)_$(M_ABI): mutatee_util_mt_$(M_GCC)_$(M_ABI).o
605 test15.mutatee_$(M_GXX)_$(M_ABI): mutatee_util_mt_$(M_GXX)_$(M_ABI).o
606
607 test14.mutatee_$(NATIVE_CXX)_$(M_ABI): mutatee_util_mt_$(NATIVE_CXX)_$(M_ABI).o
608 test14.mutatee_$(NATIVE_CC)_$(M_ABI): mutatee_util_mt_$(NATIVE_CC)_$(M_ABI).o
609 test14.mutatee_$(M_GCC)_$(M_ABI): mutatee_util_mt_$(M_GCC)_$(M_ABI).o
610 test14.mutatee_$(M_GXX)_$(M_ABI): mutatee_util_mt_$(M_GXX)_$(M_ABI).o
611
612 test15.mutatee_$(NATIVE_CXX)_$(M_ABI): mutatee_util_mt_$(NATIVE_CXX)_$(M_ABI).o
613 test15.mutatee_$(NATIVE_CC)_$(M_ABI): mutatee_util_mt_$(NATIVE_CC)_$(M_ABI).o
614 test15.mutatee_$(M_GCC)_$(M_ABI): mutatee_util_mt_$(M_GCC)_$(M_ABI).o
615 test15.mutatee_$(M_GXX)_$(M_ABI): mutatee_util_mt_$(M_GXX)_$(M_ABI).o
616
617 endif
618
619 # MUTATEE_SPECIFIC_LIBS is analyzed by gmake when constructing the link line
620 # If you want to specify that a specific library should be used to link a specific
621 # mutatee, add an entry to this variable in the format <testno>.-libwhatever
622
623 # The <testno>. will be stripped off, leaving -libwhatever on the link line
624
625 MUTATEE_SPECIFIC_LIBS_GNU       += 0.-lcommon
626 MUTATEE_SPECIFIC_LIBS_GNU       += 0.-liberty
627 MUTATEE_SPECIFIC_LIBS_GNU       += 0.-L$(DYNINST_ROOT)/core/common/$(PLATFORM)
628 MUTATEE_SPECIFIC_LIBS_GNU       += 00.-lcommon
629 MUTATEE_SPECIFIC_LIBS_GNU       += 00.-lsymtabAPI
630 MUTATEE_SPECIFIC_LIBS_GNU       += 00.-liberty
631 MUTATEE_SPECIFIC_LIBS_GNU       += 00.-L$(DYNINST_ROOT)/core/common/$(PLATFORM)
632 MUTATEE_SPECIFIC_LIBS_GNU       += 00.-L$(DYNINST_ROOT)/core/symtabAPI/$(PLATFORM)
633 MUTATEE_SPECIFIC_LIBS_GNU       += $(MUTATEE_TEST9_EXTRA_LIB)
634 MUTATEE_SPECIFIC_LIBS_GNU       += 12.-lpthread
635 MUTATEE_SPECIFIC_LIBS_NATIVE    += $(MUTATEE_TEST9_EXTRA_LIB)
636 MUTATEE_SPECIFIC_LIBS_NATIVE    += 12.-lpthread
637 MUTATEE_SPECIFIC_LIBS_GNU       += 13.-lpthread
638 MUTATEE_SPECIFIC_LIBS_GNU       += 14.-lpthread
639 MUTATEE_SPECIFIC_LIBS_GNU       += 15.-lpthread
640 MUTATEE_SPECIFIC_LIBS_NATIVE    += 13.-lpthread
641 MUTATEE_SPECIFIC_LIBS_NATIVE    += 14.-lpthread
642 MUTATEE_SPECIFIC_LIBS_NATIVE    += 15.-lpthread
643
644 ifdef MUTATEE_USE_LIBDL_SELECTIVELY
645 MUTATEE_SPECIFIC_LIBS_GNU       += 1.-ldl
646 MUTATEE_SPECIFIC_LIBS_NATIVE    += 1.-ldl
647 MUTATEE_SPECIFIC_LIBS_GNU       += 2.-ldl
648 MUTATEE_SPECIFIC_LIBS_NATIVE    += 2.-ldl
649 MUTATEE_SPECIFIC_LIBS_GNU       += 12.-ldl
650 MUTATEE_SPECIFIC_LIBS_NATIVE    += 12.-ldl
651
652 ifdef M_ABI
653 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 1.-ldl
654 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 2.-ldl
655 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 12.-ldl
656 endif
657 endif
658
659 ifdef M_ABI
660 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += $(MUTATEE_TEST9_EXTRA_LIB_ABI)
661 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 12.-lpthread
662 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 13.-lpthread
663 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 14.-lpthread
664 MUTATEE_SPECIFIC_LIBS_GNU_ABI   += 15.-lpthread
665 endif
666
667 #######################################################################
668 ###  Generic mutatee build rules (GNU and NATIVE):
669 #######################################################################
670
671 # GNU Mutatees
672
673 $(MUTATEES_GCC): test%.mutatee_gcc : test%.mutatee_gcc.o $(DEPENDDIR)/test%.mutatee_gcc.dep mutatee_util_gcc.o
674         $(M_GCC) $(STD_ABI_FLAG) -o $@ $(filter %.o,$^) $(MUTATEE_LDFLAGS_GNU) $(MUTATEE_LIBS) \
675             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_GNU)))
676
677 $(MUTATEES_GXX): test%.mutatee_g++ : test%.mutatee_g++.o $(DEPENDDIR)/test%.mutatee_g++.dep mutatee_util_g++.o
678         $(M_GXX) $(STD_ABI_FLAG) -o $@ $(filter %.o,$^) $(MUTATEE_LDFLAGS_GNU) $(MUTATEE_LIBS) \
679             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_GNU)))
680
681 # GNU Secondary ABI Mutatees
682 ifdef M_ABI
683 $(MUTATEES_GCC_ABI): test%.mutatee_gcc_$(M_ABI) : test%.mutatee_gcc_$(M_ABI).o $(DEPENDDIR)/test%.mutatee_gcc.dep mutatee_util_gcc_$(M_ABI).o
684         $(M_GCC) $(M_ABI_FLAG) -o $@ $(filter %.o,$^) $(MUTATEE_LDFLAGS_GNU) $(MUTATEE_LIBS) \
685             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_GNU_ABI)))
686
687 $(MUTATEES_GXX_ABI): test%.mutatee_g++_$(M_ABI) : test%.mutatee_g++_$(M_ABI).o $(DEPENDDIR)/test%.mutatee_g++.dep mutatee_util_g++_$(M_ABI).o
688         $(M_GXX) $(M_ABI_FLAG) -o $@ $(filter %.o,$^) $(MUTATEE_LDFLAGS_GNU) $(MUTATEE_LIBS) \
689             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_GNU_ABI)))
690 endif
691
692
693 # GNU Fortran (g77) mutatees
694
695 # There is no real advantage to generality here since there is only one fortran mutatee
696 # (ie for test1), thus all constituent files are built explicitly
697
698 ifdef M_G77
699 test1.mutatee_g77.o: ../src/test1.mutateeFort.F
700         $(M_G77) $(STD_ABI_FLAG) -g  $(MUTATEE_G77_FFLAGS) -c -o $@ $^ 
701 test1.mutateeFortC_g77.o: $(TEST1_FORTRAN_CSOURCE)
702         $(M_GCC) $(STD_ABI_FLAG) $(MUTATEE_G77_CFLAGS) $(filter %.c,$^) -o $@
703
704 $(MUTATEES_G77): test%.mutatee_g77 : test%.mutatee_g77.o test1.mutateeFortC_g77.o test1.mutateeCommon_gcc.o mutatee_util_gcc.o $(DEPENDDIR)/test%.mutatee_g77.dep
705         $(M_G77) $(STD_ABI_FLAG) -o $@ $(filter %.o,$^) $(MUTATEE_G77_LDFLAGS) $(MUTATEE_LIBS) 
706 endif
707
708 # Native Mutatees
709
710 ifdef NATIVE_CC
711 $(MUTATEES_NATIVE_CC): test%.mutatee_$(NATIVE_CC) : test%.mutatee.c mutatee_util_$(NATIVE_CC).o
712         $(NATIVE_CC) $(STD_NATIVE_ABI_FLAG) $(MUTATEE_CFLAGS_NATIVE) $(MUTATEE_LDFLAGS_NATIVE) -o $@ $(MUTATEE_LIBS) $(filter %.c  %.s %.S %.o, $^) \
713             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_NATIVE))) 
714
715 endif
716
717 ifdef NATIVE_CXX
718 $(MUTATEES_NATIVE_CXX): test%.mutatee_$(NATIVE_CXX) : test%.mutatee.c mutatee_util_$(NATIVE_CXX).o
719         $(NATIVE_CXX) $(STD_NATIVE_ABI_FLAG) $(MUTATEE_CXXFLAGS_NATIVE) -o $@ $(filter %.c %.s %.S %.o,$^) $(MUTATEE_LDFLAGS_NATIVE) $(MUTATEE_LIBS) \
720             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_NATIVE)))
721
722 $(MUTATEES_NATIVE_CXX_ONLY): test%.mutatee_$(NATIVE_CXX) : test%.mutatee.C mutatee_util_$(NATIVE_CXX).o
723         $(NATIVE_CXX) $(STD_NATIVE_ABI_FLAG) $(MUTATEE_CXXFLAGS_NATIVE) -o $@ $(filter %.C %.s %.S %.o,$^) $(MUTATEE_LDFLAGS_NATIVE) $(MUTATEE_LIBS) \
724             $(subst $*.,,$(filter $*.%, $(MUTATEE_SPECIFIC_LIBS_NATIVE)))
725 endif
726
727
728 # Native Fortran mutatees
729
730 # There is no real advantage to generality here since there is only one fortran mutatee
731 # (ie for test1), thus all constituent files are built explicitly
732
733 ifdef NATIVE_FC 
734 test1.mutatee_$(NATIVE_FC).o: ../src/test1.mutateeFort.F
735         $(NATIVE_FC) $(STD_NATIVE_ABI_FLAG) -g $(MUTATEE_NATIVE_FFLAGS) -c -o $@ $^ 
736 test1.mutateeFortC_$(NATIVE_FC).o: ../src/test1.mutateeFortC.c
737         $(NATIVE_FORTRAN_CC) $(STD_NATIVE_ABI_FLAG) $(MUTATEE_NATIVE_FC_CFLAGS) -c $(filter %.c,$^) -o $@
738
739 $(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
740         $(NATIVE_FC) $(STD_NATIVE_ABI_FFLAG) -o $@ $(filter %.o,$^) $(MUTATEE_NATIVE_FC_LDFLAGS) $(MUTATEE_LIBS) 
741 endif
742
743 # Native OpenMP mutatees
744 # There is no real advantage to generality here since there is only one OpenMP mutatee
745 # (ie for test16), thus all constituent files are built explicitly
746 ifdef HPC_COMPILER_EXISTS
747 test16.mutatee_$(NATIVE_CXX_OMP).o: ../src/test16.mutatee.c
748         $(NATIVE_CXX_OMP) $(STD_NATIVE_ABI_FLAG) -g  $(MUTATEE_NATIVE_CXX_CFLAGS) -o $@ $^ 
749
750 $(MUTATEES_NATIVE_CXX_OMP): test%.mutatee_$(NATIVE_CXX_OMP) : test%.mutatee_$(NATIVE_CXX_OMP).o $(DEPENDDIR)/test%.mutatee_$(NATIVE_CXX_OMP).dep
751         $(NATIVE_CXX_OMP) $(STD_NATIVE_ABI_FLAG) $(MUTATEE_NATIVE_CXX_OMP_LDFLAGS) -o $@ $(filter %.o,$^) $(MUTATEE_LIBS) 
752
753 #$(MUTATEES_NATIVE_CXX_OMP): ../src/test16.mutatee.c
754 #       $(NATIVE_CXX_OMP) $(STD_NATIVE_ABI_FLAG) -g  $(MUTATEE_NATIVE_CXX_CFLAGS) -o $@ $^ 
755
756 endif
757
758
759 # Install directory
760 $(TEST_DEST): 
761         mkdir $(TEST_DEST)
762
763 #######################################################################
764 ###  Generic Mutator build rule:
765 ###
766 ###  resorts to pattern matching test% (matches test1, test2, ... etc)
767 ###  to generate correct, minimal set of prerequisites for each test.
768 ###  It would be nicer to just match something simpler that wasn't 
769 ###  name-dependant, but gnu make is not making this easy.
770 ###
771 #######################################################################
772
773 $(OBJS_ALL_MUTATORS): %.o : %.C $(DEPENDDIR)/%.dep
774         $(CXX) $(STD_ABI_FLAG) -c -o $@ -fPIC $(CXXFLAGS) -I../src/ ../src/$*.C
775
776 MUTATEE_DEFS := -Dgnu_cc=_gcc -Dgnu_cxx=_g++
777
778 ifdef M_ABI
779 MUTATEE_DEFS += -Dgnu_abi_cc=_gcc_$(M_ABI) -Dgnu_abi_cxx=_g++_$(M_ABI) -Dm_abi
780 endif
781
782 ifdef M_G77
783 MUTATEE_DEFS += -Dgnu_fc=_g77
784 endif
785
786 ifdef NATIVE_CC
787 MUTATEE_DEFS += -Dnative_cc=_$(NATIVE_CC)
788 endif
789
790 ifdef NATIVE_CXX
791 MUTATEE_DEFS += -Dnative_cxx=_$(NATIVE_CXX)
792 endif
793
794 ifdef NATIVE_FC
795 MUTATEE_DEFS += -Dnative_fc=_$(NATIVE_FC)
796 endif
797
798 ifdef HPC_COMPILER_EXISTS
799 MUTATEE_DEFS += -Dnative_cxx_omp=_$(NATIVE_CXX_OMP)
800 endif
801
802 ifdef STATIC_TEST_DRIVER
803 STATIC_FLAGS = -DSTATIC_TEST_DRIVER
804 endif
805
806 runTests.o: ../src/runTests.C $(DEPENDDIR)/runTests.dep
807         $(CXX) $(STD_ABI_FLAG) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) ../src/runTests.C
808 runTests_static.o: ../src/runTests.C $(DEPENDDIR)/runTests.dep
809         $(CXX) $(STD_ABI_FLAG) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) -DSTATIC_TEST_DRIVER ../src/runTests.C
810
811 runTests-utils.o: ../src/runTests-utils.C $(DEPENDDIR)/runTests-utils.dep
812         $(CXX) $(STD_ABI_FLAG) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) ../src/runTests-utils.C
813
814 runTests: runTests.o runTests-utils.o test_driver_templates.o 
815         $(CXX) $(STD_ABI_FLAG) $(CXXFLAGS) -o $@ runTests.o runTests-utils.o test_driver_templates.o 
816 runTests_static: runTests_static.o runTests-utils.o test_driver_templates.o 
817         $(CXX) $(STD_ABI_FLAG) $(CXXFLAGS) -o runTests runTests_static.o runTests-utils.o test_driver_templates.o 
818
819 test_driver.o: ../src/test_driver.C $(DEPENDDIR)/test_driver.dep
820         $(CXX) $(STD_ABI_FLAG) -c -o $@ $(CXXFLAGS) $(MUTATEE_DEFS) ../src/test_driver.C
821
822 test_driver_static.o: ../src/test_driver.C $(DEPENDDIR)/test_driver_static.dep
823         $(CXX) $(STD_ABI_FLAG) -c -o $@ -DSTATIC_TEST_DRIVER $(CXXFLAGS) $(MUTATEE_DEFS) ../src/test_driver.C
824
825 test_driver: test_driver.o test_driver_templates.o $(LIBTESTSUITE_DEST) $(DEPENDDIR)/test_driver.dep $(LIBTESTSUITE)
826         $(CXX) $(STD_ABI_FLAG) -o $@ test_driver.o test_driver_templates.o $(MUTATOR_LDFLAGS) $(LIBS) 
827
828 test_driver_static: test_driver_static.o test_driver_templates.o $(OBJS_ALL_MUTATORS) $(LIBTESTSUITE_DEST) $(DEPENDDIR)/test_driver_static.dep $(LIBTESTSUITE)
829         $(CXX) $(STD_ABI_FLAG) -o $@ test_driver_static.o test_driver_templates.o $(OBJS_ALL_MUTATORS) $(MUTATOR_LDFLAGS) $(LIBS)
830
831 $(MUTATORS_SO): test%.so : test%.o $(OBJS_FORALL_MUTATORS) $(DEPENDDIR)/test%.dep $(LIBTESTSUITE)
832         $(CXX) $(STD_ABI_FLAG) -o $@ -shared $(filter %.o,$^) $(MUTATOR_SO_LDFLAGS) $(LIBDIR) $(LIBS) $(LDFLAGS) 
833 ifndef NO_OPT_FLAG
834 ifdef STRIP_SO
835         $(STRIP_SO) $@
836 endif
837 endif
838
839 test11: ../src/test11.sh
840         -$(CP) ../src/test11.sh test11
841
842 #######################################################################
843 ###  Depends
844 #######################################################################
845
846 DEPS_MUTATORS           += $(addprefix $(DEPENDDIR)/,$(addsuffix .dep,$(MUTATORS)))
847 DEPS_MUTATORS           += $(addprefix $(DEPENDDIR)/,$(addsuffix .dep,$(FORALL_MUTATORS)))
848 DEPS_MUTATORS           += $(DEPENDDIR)/test_driver.dep
849 DEPS_MUTATORS           += $(DEPENDDIR)/runTests.dep $(DEPENDDIR)/runTests-utils.dep
850
851 DEPS_MUTATEES_GCC       += $(addprefix $(DEPENDDIR)/,$(addsuffix _gcc.dep, $(MUTATEES_C)))
852 DEPS_MUTATEES_GXX       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g++.dep, $(MUTATEES_CXX)))
853 DEPS_MUTATEES_GXX       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g++.dep, $(MUTATEES_CXX_ONLY)))
854 DEPS_MUTATEES_GXX       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g++.dep, $(MUTATEES_CXX_GNU_ONLY)))
855 DEPS_TESTLIBS           += $(addprefix $(DEPENDDIR)/,$(addsuffix .dep,$(TESTLIB_STEMS)))
856 DEPS_TESTLIBS           += $(DEPENDDIR)/libTest12.dep
857 DEPS_LIBTESTSUITE        = $(addprefix $(DEPENDDIR)/,$(SRCS_LIBTESTSUITE:%.C=%.dep))
858
859 ifdef M_G77
860 DEPS_MUTATEES_G77       += $(addprefix $(DEPENDDIR)/,$(addsuffix _g77.dep, $(MUTATEES_FORTRAN)))
861 endif
862
863 ifdef NATIVE_FC
864 DEPS_MUTATEES_NATIVE_FC += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_FC).dep, $(MUTATEES_FORTRAN)))
865 endif
866
867 ifdef HPC_COMPILER_EXISTS
868 DEPS_MUTATEES_NATIVE_CXX_OMP += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CXX_OMP).dep, $(MUTATEES_OPENMP)))
869 endif
870
871 ifdef NATIVE_CC
872 DEPS_MUTATEES_NATIVE_CC += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CC).dep, $(MUTATEES_C)))
873 endif
874
875 ifdef NATIVE_CXX
876 DEPS_MUTATEES_NATIVE_CXX += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CXX).dep, $(MUTATEES_CXX)))
877 DEPS_MUTATEES_NATIVE_CXX += $(addprefix $(DEPENDDIR)/,$(addsuffix _$(NATIVE_CXX).dep, $(MUTATEES_CXX_ONLY)))
878 endif
879
880
881 depend: $(DEPS_MUTATORS)
882
883 depend_dir:
884         @echo "mut deps: $(DEPS_MUTATORS)"
885         @if [ -d $(DEPENDDIR) ]; then \
886           echo "Directory \"$(DEPENDDIR)\" already exists..."; \
887          else \
888           mkdir -p $(DEPENDIR); \
889           echo "Made \"$(DEPENDDIR)\" directory..."; \
890          fi
891
892 $(DEPENDDIR)/test_driver_static.dep: test_driver.C
893         @mkdir -p $(DEPENDDIR)
894         $(DEPCC) $(STD_ABI_FLAG) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) -DSTATIC_TEST_DRIVER $(DEPENDFLAGS) $*.o > $@
895
896 $(DEPS_MUTATORS): $(DEPENDDIR)/%.dep : %.C 
897         @mkdir -p $(DEPENDDIR)
898         $(DEPCC) $(STD_ABI_FLAG) $(CXXFLAGS) $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
899
900 $(DEPS_MUTATEES_GCC): $(DEPENDDIR)/test%.mutatee_gcc.dep : test%.mutatee.c $(SRCS_FORALL_MUTATEES)
901         @mkdir -p $(DEPENDDIR)
902         $(M_GCC) $(STD_ABI_FLAG) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutatee_gcc.o > $@
903
904 $(DEPS_MUTATEES_GXX): $(DEPENDDIR)/test%.mutatee_g++.dep : $(wildcard test%.mutatee.*) $(SRCS_FORALL_MUTATEES)
905         @mkdir -p $(DEPENDDIR)
906         $(M_GXX) $(STD_ABI_FLAG) $(CXXFLAGS) $< $(MUTATEE_CXXFLAGS) $(DEPENDFLAGS) test$*.mutatee_gxx.o > $@
907
908 $(DEPS_MUTATEES_G77): $(DEPENDDIR)/test%.mutatee_g77.dep : test%.mutateeFort.F $(SRCS_FORALL_MUTATEES)
909         @mkdir -p $(DEPENDDIR)
910         $(M_G77) $(STD_ABI_FLAG) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutateeFort_g77.o > $@
911
912
913 # Use gcc to generate deps for native compilers
914
915 ifdef NATIVE_CC
916 $(DEPS_MUTATEES_NATIVE_CC): $(DEPENDDIR)/test%.mutatee_$(NATIVE_CC).dep : test%.mutatee.c $(SRCS_FORALL_MUTATEES)
917         @mkdir -p $(DEPENDDIR)
918         $(M_GCC) $(STD_ABI_FLAG) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutatee_$(NATIVE_CC).o > $@
919 endif
920
921 ifdef NATIVE_CXX
922 $(DEPS_MUTATEES_NATIVE_CXX): $(DEPENDDIR)/test%.mutatee_$(NATIVE_CXX).dep : $(wildcard test%.mutatee.*) $(SRCS_FORALL_MUTATEES)
923         @mkdir -p $(DEPENDDIR)
924         $(M_GXX) $(STD_ABI_FLAG) $(CXXFLAGS) $< $(MUTATEE_CXXFLAGS) $(DEPENDFLAGS) test$*.mutatee_$(NATIVE_CXX).o > $@
925 endif
926
927 ifdef NATIVE_FC
928 $(DEPS_MUTATEES_NATIVE_FC): $(DEPENDDIR)/test%.mutatee_$(NATIVE_FC).dep : test%.mutateeFort.F $(SRCS_FORALL_MUTATEES)
929         @mkdir -p $(DEPENDDIR)
930         $(M_G77) $(STD_ABI_FLAG) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutateeFort_$(NATIVE_FC).o > $@
931 endif
932
933 ifdef HPC_COMPILER_EXISTS
934 $(DEPS_MUTATEES_NATIVE_CXX_OMP): $(DEPENDDIR)/test%.mutatee_$(NATIVE_CXX_OMP).dep : test%.mutatee.c $(SRCS_FORALL_MUTATEES)
935         @mkdir -p $(DEPENDDIR)
936         $(M_GXX) $(STD_ABI_FLAG) $(CFLAGS) $< $(MUTATEE_CFLAGS) $(DEPENDFLAGS) test$*.mutatee_$(NATIVE_CXX_OMP).o > $@
937 endif
938
939
940 $(DEPS_TESTLIBS): $(DEPENDDIR)/lib%.dep : lib%.c 
941         @mkdir -p $(DEPENDDIR)
942         $(DEPCC) $(STD_ABI_FLAG) $(CXXFLAGS) -I$(TO_CORE)/dyninstAPI_RT/h $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) lib$*.so > $@
943
944 $(DEPS_LIBTESTSUITE): $(DEPENDDIR)/%.dep : %.C
945         @mkdir -p $(DEPENDDIR)
946         $(DEPCC) $(STD_ABI_FLAG) $(CXXFLAGS) -I$(TO_CORE)/dyninstAPI_RT/h $< $(MUTATOR_CXXFLAGS) $(DEPENDFLAGS) $*.o > $@
947
948
949 # do not include dep files for "clean" targets
950 ifneq ($(MAKECMDGOALS),clean)
951 ifneq ($(MAKECMDGOALS),distclean)
952 ifneq ($(MAKECMDGOALS),echo)
953
954 -include $(DEPS_MUTATORS)
955 -include $(DEPS_MUTATEES_GCC)
956 -include $(DEPS_MUTATEES_GXX)
957 -include $(DEPS_TESTLIBS)
958
959 ifdef M_G77
960 -include $(DEPS_MUTATEES_G77)
961 endif
962
963 ifdef NATIVE_CC
964 -include $(DEPS_MUTATEES_NATIVE_CC)
965 endif
966
967 ifdef NATIVE_CXX
968 -include $(DEPS_MUTATEES_NATIVE_CXX)
969 endif
970
971 ifdef NATIVE_FC
972 -include $(DEPS_MUTATEES_NATIVE_FC)
973 endif
974
975 ifdef HPC_COMPILER_EXISTS
976 -include $(DEPS_MUTATEES_NATIVE_CXX_OMP)
977 endif
978
979 endif
980 endif
981 endif