fixing stuff
[dyninst.git] / testsuite / nmake.module.tmpl
1
2 # Common makefile template for dyninst Tests.  This file is not intended to
3 # be a useful Makefile in isolation; instead, it should be included
4 # from within an architecture-specific Makefile.
5 #
6 # $Id: nmake.module.tmpl,v 1.5 2008/10/30 19:15:44 legendre Exp $
7 #
8
9 SUITE_NAME      = Dyninst
10 RELEASE_NUM     = 6.0
11
12 DEST            = $(TO_CORE)\$(PROGRAM_DEST)\testsuite
13
14 CXXFLAGS     = $(CXXFLAGS) -Dos_windows_test -Darch_x86_test -Dcap_relocation_test -Dcap_dynamic_heap_test \
15         -Dcap_stripped_binaries_test -Dcap_async_events_test -Dcap_threads_test -Di386_unknown_nt4_0_test \
16         -Di386-unknown-nt4.0_test
17 CXXFLAGS     = $(CXXFLAGS) -I$(TO_CORE)/dyninstAPI/h -I$(TO_CORE)/external \
18         -I$(TO_CORE)/dynutil/h -I$(TO_CORE)/symtabAPI/h -I$(TO_CORE)/testsuite/src \
19         -I$(TO_CORE)/instructionAPI/h /D_DEBUG /Zi -Dsnprintf=_snprintf
20 CXXFLAGS_NORM = $(CXXFLAGS) -I$(TO_CORE)/testsuite/src 
21 CFLAGS       = $(CFLAGS) /Zi /D_DEBUG -I$(TO_CORE)/h
22
23 LIBS            = $(TO_CORE)\$(LIBRARY_DEST)\libdyninstAPI.lib $(TO_CORE)\$(LIBRARY_DEST)\libcommon.lib $(TO_CORE)\$(LIBRARY_DEST)\libinstructionAPI.lib
24
25 SYSLIBS         = 
26
27 LIBTESTSUITE = libtestSuite.dll
28 LIBDYNINSTCOMP = libtestdyninst.dll
29 LIBSYMTABCOMP = libtestsymtab.dll
30 LIBINSTRUCTIONCOMP = libtestinstruction.dll
31
32 MUTATOR_LIBS = libtestdyninst.lib libtestSuite.lib libdyninstAPI.lib libtestsymtab.lib libsymtabAPI.lib libcommon.lib libtestinstruction.lib libinstructionAPI.lib
33
34 SRCS_LIBTESTSUITE = ../src/test_lib.C \
35                     ../src/test_lib_dllExecution.C \
36                     ../src/ParameterDict.C \
37                     ../src/TestData.C \
38                     ../src/TestMutator.C \
39                     ../src/TestOutputDriver.C \
40                     ../src/StdOutputDriver.C \
41                     ../src/ResumeLog.C \
42                     ../src/test_info_new.C
43
44 SRCS_DYNINSTCOMP = ../src/dyninst/dyninst_comp.C \
45                    ../src/dyninst/test_lib_mutateeStart.C \
46                    ../src/dyninst/Callbacks.C \
47                    ../src/dyninst/Process_data.C
48 SRCS_DYNINSTTESTLIB = ../src/dyninst/libtestA.c \
49                       ../src/dyninst/libtestB.c \
50                       ../src/dyninst/libInstMe.c \
51                       ../src/dyninst/libLoadMe.c
52 !ifdef M_ABI
53 DYNINST_TESTLIBS = $(SRCS_DYNINSTTESTLIB:.c=.dll)
54 DYNINST_TESTLIBS = $(DYNINST_TESTLIBS:../src/dyninst/=)
55 # no ABIs on windows yet, this should be $src_$m_abi.dll
56 DYNINST_TESTLIBS_ABI =
57 !else
58 DYNINST_TESTLIBS = $(SRCS_DYNINSTTESTLIB:.c=.dll)
59 DYNINST_TESTLIBS = $(DYNINST_TESTLIBS:../src/dyninst/=)
60 DYNINST_TESTLIBS_ABI =
61 !endif
62
63 TESTLIBS = $(DYNINST_TESTLIBS)
64
65 DYNINST_TESTLIBS_OBJS = $(SRCS_DYNINSTTESTLIB:.c=.obj)
66 DYNINST_TESTLIBS_OBJS = $(DYNINST_TESTLIBS_OBJS:../src/dyninst/=)
67
68 SRCS_SYMTABCOMP = ../src/symtab/symtab_comp.C
69
70 OBJS_LIBTESTSUITE = $(SRCS_LIBTESTSUITE:.C=.obj)
71 OBJS_LIBTESTSUITE = $(OBJS_LIBTESTSUITE:../src/=)
72
73 OBJS_DYNINSTCOMP = $(SRCS_DYNINSTCOMP:.C=.obj)
74 OBJS_DYNINSTCOMP = $(OBJS_DYNINSTCOMP:../src/dyninst/=)
75
76 OBJS_SYMTABCOMP = $(SRCS_SYMTABCOMP:.C=.obj)
77 OBJS_SYMTABCOMP = $(OBJS_SYMTABCOMP:../src/symtab/=)
78
79 SRCS_TEMPLATES = ../src/test_driver_templates.C
80 OBJS_TEMPLATES = $(SRCS_TEMPLATES:.C=.obj)
81 OBJS_TEMPLATES = $(OBJS_TEMPLATES:../src/=)
82
83 SRCS_INSTRUCTIONCOMP = ../src/instruction/instruction_comp.C
84
85 OBJS_INSTRUCTIONCOMP = $(SRCS_INSTRUCTIONCOMP:.C=.obj)
86 OBJS_INSTRUCTIONCOMP = $(OBJS_INSTRUCTIONCOMP:../src/instruction/=)
87
88 TESTDRIVER_LIBS = libdyninstAPI.lib libtestSuite.lib libtestdyninst.lib libtestsymtab.lib libtestinstruction.lib
89
90 all: $(LIBTESTSUITE) $(LIBDYNINSTCOMP) $(LIBSYMTABCOMP) $(LIBINSTRUCTIONCOMP) test_driver.exe runTests.exe mutators mutatees DatabaseOutputDriver.dll libtestA.dll libtestB.dll
91
92
93 UNCOMMON_INSTALL=true
94
95 install: all
96
97 # try not to have clean remove dbghelp.dll
98 clean: 
99         $(RM) *.ilk
100         $(RM) *.exp 
101         $(RM) *.lib 
102         $(RM) *.obj 
103         $(RM)   $(TESTDRIVER_LIBS) libtestA.dll libtestB.dll
104         $(RM) *.exe 
105         $(RM) *.pdb
106
107 # Old Install commands if we actually want to install
108 # -$(MKDIR) $(DEST)
109 # for %X IN ( $(LIBTESTSUITE) test_driver.exe runTests.exe $(TEST_LIBS) $(MUTATEES) libtestA.dll libtestB.dll ) DO $(CP) "%X" $(DEST)
110
111 LDFLAGS = /debug -LIBPATH:$(TO_CORE)/../$(PLATFORM)/lib 
112 LIBS    = libdyninstAPI.lib libsymtabAPI.lib libinstructionAPI.lib
113
114 $(LIBTESTSUITE): $(OBJS_LIBTESTSUITE) ../src/test_lib.h
115         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_LIBTESTSUITE)
116
117 $(LIBDYNINSTCOMP): $(OBJS_DYNINSTCOMP) ../src/test_lib.h
118         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_DYNINSTCOMP) $(LIBS) libtestSuite.lib
119
120 $(LIBSYMTABCOMP): $(OBJS_SYMTABCOMP) ../src/test_lib.h
121         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_SYMTABCOMP) $(LIBS) libtestSuite.lib
122
123 $(LIBINSTRUCTIONCOMP): $(OBJS_INSTRUCTIONCOMP) ../src/test_lib.h
124         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_INSTRUCTIONCOMP) $(LIBS) libtestSuite.lib
125
126 $(OBJS_LIBTESTSUITE): $(SRCS_LIBTESTSUITE)
127         $(CXX) $(CXXFLAGS_NORM) -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
128
129 $(OBJS_DYNINSTCOMP): $(SRCS_DYNINSTCOMP)
130         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
131
132 $(OBJS_SYMTABCOMP): $(SRCS_SYMTABCOMP)
133         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
134
135 $(OBJS_INSTRUCTIONCOMP): $(SRCS_INSTRUCTIONCOMP)
136         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
137
138 $(DYNINST_TESTLIBS_OBJS) : $(SRCS_DYNINSTTESTLIB)
139         $(CC) -c $(CFLAGS) $(CFLAGS_TESTLIBS)$**
140
141 $(DYNINST_TESTLIBS): $(DYNINST_TESTLIBS_OBJS)
142         $(LINK) $(TESTLIB_FLAGS) $*.obj -out:$@
143
144
145 #CXXTFLAGS := $(filter-out -fno-implicit-templates, $(CXXFLAGS))
146
147 $(OBJS_TEMPLATES): $(SRCS_TEMPLATES)
148         $(CXX) $(CXXFLAGS) -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
149
150 test_info_new.gen.obj: test_info_new.gen.C
151         $(CXX) $(CXXFLAGS_NORM) -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
152
153 test_driver.exe:  test_driver.obj test_lib.obj test_info_new.gen.obj $(LIBTESTSUITE) $(LIBDYNINSTCOMP) $(LIBSYMTABCOMP)
154         $(LINK) $(LDFLAGS) test_driver.obj test_info_new.gen.obj $(TESTDRIVER_LIBS)
155
156 test_driver.obj: ../src/test_driver.C
157         $(CXX) $(CXXFLAGS_NORM) -Dnative_cc=_VC.exe -Dnative_cxx=_VC++.exe -c $**
158
159 runTests.exe: runTests.obj runTests-utils-nt.obj $(OBJS_TEMPLATES)
160         $(LINK) $(LDFLAGS) runTests.obj runTests-utils-nt.obj $(OBJS_TEMPLATES)
161
162 runTests.obj:  ../src/runTests.C
163         $(CXX) $(CXXFLAGS_NORM) -c $**
164 runTests-utils-nt.obj: ../src/runTests-utils-nt.C
165         $(CXX) $(CXXFLAGS_NORM) -c $**
166
167 DatabaseOutputDriver.obj: ../src/DatabaseOutputDriver.C
168         $(CXX) $(CXXFLAGS_NORM) -c -I../src/ $**
169         
170 DatabaseOutputDriver.dll: DatabaseOutputDriver.obj
171 # Advapi32.lib needed for GetUserName, Ws2_32.lib required for gethostname
172         $(LINK) $(LDFLAGS) -DLL -out:$@ $(TESTDRIVER_LIBS) Advapi32.lib Ws2_32.lib $**