Fix Windows compiler warnings
[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         -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
21 CXXFLAGS_NORM = $(CXXFLAGS) -I$(TO_CORE)/testsuite/src 
22 CFLAGS       = $(CFLAGS) /Zi /D_DEBUG -I$(TO_CORE)/h
23
24 LIBS            = $(TO_CORE)\$(LIBRARY_DEST)\libdyninstAPI.lib $(TO_CORE)\$(LIBRARY_DEST)\libcommon.lib $(TO_CORE)\$(LIBRARY_DEST)\libinstructionAPI.lib
25
26 SYSLIBS         =
27
28 LIBTESTSUITE = libtestSuite.dll
29 LIBDYNINSTCOMP = libtestdyninst.dll
30 LIBSYMTABCOMP = libtestsymtab.dll
31 LIBINSTRUCTIONCOMP = libtestinstruction.dll
32 LIBPROCCONTROLCOMP = libtestproccontrol.dll
33
34 MUTATOR_LIBS = libtestdyninst.lib libtestSuite.lib libdyninstAPI.lib libtestsymtab.lib libsymtabAPI.lib libcommon.lib libtestinstruction.lib libinstructionAPI.lib libtestproccontrol.lib proccontrol.lib
35
36 SRCS_LIBTESTSUITE = ../src/test_lib.C \
37                     ../src/test_lib_dllExecution.C \
38                     ../src/TestData.C \
39                     ../src/TestMutator.C \
40                     ../src/TestOutputDriver.C \
41                     ../src/StdOutputDriver.C \
42                                         ../src/remotetest.C \
43                                         ../src/connection.C \
44                                         ../src/module.C
45
46 SRCS_LIBTESTLAUNCH = ../src/CmdLine.C \
47                                          ../src/ParameterDict.C \
48                                          ../src/ResumeLog.C \
49                                          ../src/MutateeStart.C \
50                      ../src/test_info_new.C \
51                                          ../i386-unknown-nt4.0/test_info_new.gen.C
52
53 SRCS_DYNINSTCOMP = ../src/dyninst/dyninst_comp.C \
54                    ../src/dyninst/test_lib_mutateeStart.C \
55                    ../src/dyninst/Callbacks.C \
56                    ../src/dyninst/Process_data.C
57
58
59 SRCS_DYNINSTTESTLIB = ../src/libtestA.c \
60                       ../src/libtestB.c \
61                       ../src/dyninst/libInstMe.c \
62                       ../src/dyninst/libLoadMe.c
63 !ifdef M_ABI
64 DYNINST_TESTLIBS = $(SRCS_DYNINSTTESTLIB:.c=.dll)
65 DYNINST_TESTLIBS = $(DYNINST_TESTLIBS:../src/dyninst/=)
66 DYNINST_TESTLIBS = $(DYNINST_TESTLIBS:../src/=)
67 # no ABIs on windows yet, this should be $src_$m_abi.dll
68 DYNINST_TESTLIBS_ABI =
69 !else
70 DYNINST_TESTLIBS = $(SRCS_DYNINSTTESTLIB:.c=.dll)
71 DYNINST_TESTLIBS = $(DYNINST_TESTLIBS:../src/dyninst/=)
72 DYNINST_TESTLIBS = $(DYNINST_TESTLIBS:../src/=)
73 DYNINST_TESTLIBS_ABI =
74 !endif
75
76 TESTLIBS = $(DYNINST_TESTLIBS)
77
78 DYNINST_TESTLIBS_OBJS = $(SRCS_DYNINSTTESTLIB:.c=.obj)
79 DYNINST_TESTLIBS_OBJS = $(DYNINST_TESTLIBS_OBJS:../src/dyninst/=)
80
81 SRCS_SYMTABCOMP = ../src/symtab/symtab_comp.C
82
83 OBJS_LIBTESTSUITE = $(SRCS_LIBTESTSUITE:.C=.obj) $(SRCS_LIBTESTLAUNCH:.C=.obj)
84 OBJS_LIBTESTSUITE = $(OBJS_LIBTESTSUITE:../src/=)
85
86 OBJS_DYNINSTCOMP = $(SRCS_DYNINSTCOMP:.C=.obj)
87 OBJS_DYNINSTCOMP = $(OBJS_DYNINSTCOMP:../src/dyninst/=)
88
89 OBJS_SYMTABCOMP = $(SRCS_SYMTABCOMP:.C=.obj)
90 OBJS_SYMTABCOMP = $(OBJS_SYMTABCOMP:../src/symtab/=)
91
92 SRCS_TEMPLATES = ../src/test_driver_templates.C
93 OBJS_TEMPLATES = $(SRCS_TEMPLATES:.C=.obj)
94 OBJS_TEMPLATES = $(OBJS_TEMPLATES:../src/=)
95
96 SRCS_INSTRUCTIONCOMP = ../src/instruction/instruction_comp.C
97
98 OBJS_INSTRUCTIONCOMP = $(SRCS_INSTRUCTIONCOMP:.C=.obj)
99 OBJS_INSTRUCTIONCOMP = $(OBJS_INSTRUCTIONCOMP:../src/instruction/=)
100
101 SRCS_PROCCONTROLCOMP = ../src/proccontrol/proccontrol_comp.C
102
103 OBJS_PROCCONTROLCOMP = $(SRCS_PROCCONTROLCOMP:.C=.obj)
104 OBJS_PROCCONTROLCOMP = $(OBJS_PROCCONTROLCOMP:../src/proccontrol/=)
105
106
107 TESTDRIVER_LIBS = libdyninstAPI.lib libtestSuite.lib libtestdyninst.lib libtestsymtab.lib libtestinstruction.lib
108
109 all: $(LIBTESTSUITE) $(LIBDYNINSTCOMP) $(LIBSYMTABCOMP) $(LIBINSTRUCTIONCOMP) $(LIBPROCCONTROLCOMP) test_driver.exe runTests.exe mutators mutatees DatabaseOutputDriver.dll libtestA.dll libtestB.dll
110
111
112 UNCOMMON_INSTALL=true
113
114 install: all
115
116 # try not to have clean remove dbghelp.dll
117 clean:
118         $(RM) *.ilk
119         $(RM) *.exp
120         $(RM) *.lib
121         $(RM) *.obj
122         $(RM)   $(TESTDRIVER_LIBS) libtestA.dll libtestB.dll libtestsymtab.dll test*.dll
123         $(RM) *.exe
124         $(RM) *.pdb
125
126 # Old Install commands if we actually want to install
127 # -$(MKDIR) $(DEST)
128 # for %X IN ( $(LIBTESTSUITE) test_driver.exe runTests.exe $(TEST_LIBS) $(MUTATEES) libtestA.dll libtestB.dll ) DO $(CP) "%X" $(DEST)
129
130 LDFLAGS = /debug -LIBPATH:$(TO_CORE)/../$(PLATFORM)/lib ws2_32.lib
131 LIBS    = libdyninstAPI.lib libsymtabAPI.lib libinstructionAPI.lib proccontrol.lib stackwalk.lib libcommon.lib
132
133 $(LIBTESTSUITE): $(OBJS_LIBTESTSUITE) ../src/test_lib.h
134         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_LIBTESTSUITE)
135
136 $(LIBDYNINSTCOMP): $(OBJS_DYNINSTCOMP) ../src/test_lib.h
137         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_DYNINSTCOMP) $(LIBS) libtestSuite.lib
138
139 $(LIBSYMTABCOMP): $(OBJS_SYMTABCOMP) ../src/test_lib.h
140         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_SYMTABCOMP) $(LIBS) libtestSuite.lib
141
142 $(LIBPROCCONTROLCOMP): $(OBJS_PROCCONTROLCOMP) ../src/test_lib.h
143         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_PROCCONTROLCOMP) $(LIBS) libtestSuite.lib ws2_32.lib
144
145
146 $(LIBINSTRUCTIONCOMP): $(OBJS_INSTRUCTIONCOMP) ../src/test_lib.h
147         $(LINK) $(LDFLAGS)  -DLL -out:$@ $(OBJS_INSTRUCTIONCOMP) $(LIBS) libtestSuite.lib
148
149 $(OBJS_LIBTESTSUITE): $(SRCS_LIBTESTSUITE) $(SRCS_LIBTESTLAUNCH)
150         $(CXX) $(CXXFLAGS_NORM) -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
151
152 $(OBJS_DYNINSTCOMP): $(SRCS_DYNINSTCOMP)
153         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
154
155 $(OBJS_SYMTABCOMP): $(SRCS_SYMTABCOMP)
156         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
157
158 $(OBJS_PROCCONTROLCOMP): $(SRCS_PROCCONTROLCOMP)
159         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
160
161
162 $(OBJS_INSTRUCTIONCOMP): $(SRCS_INSTRUCTIONCOMP)
163         $(CXX) $(CXXFLAGS_NORM) -DCOMPLIB_DLL_BUILD -DTESTLIB_DLL_BUILD -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
164
165 $(DYNINST_TESTLIBS_OBJS) : $(SRCS_DYNINSTTESTLIB)
166         $(CC) -c $(LDFLAGS) $(CFLAGS) $(CFLAGS_TESTLIBS)$**
167
168 $(DYNINST_TESTLIBS): $(DYNINST_TESTLIBS_OBJS)
169         $(LINK) $(TESTLIB_FLAGS) /base:@dlls.txt,$* $*.obj -out:$@
170
171
172 #CXXTFLAGS := $(filter-out -fno-implicit-templates, $(CXXFLAGS))
173
174 $(OBJS_TEMPLATES): $(SRCS_TEMPLATES)
175         $(CXX) $(CXXFLAGS) -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
176
177 test_info_new.gen.obj: test_info_new.gen.C
178         $(CXX) $(CXXFLAGS_NORM) -Dnative_cc=VC.exe -Dnative_cxx=_VC++.exe -I../src/ -c $**
179
180 test_driver.exe:  test_driver.obj dynlmon.obj $(LIBTESTSUITE)
181         $(LINK) $(LDFLAGS) test_driver.obj dynlmon.obj $(TESTDRIVER_LIBS)
182
183 test_driver.obj: ../src/test_driver.C
184         $(CXX) $(CXXFLAGS_NORM) -Dnative_cc=_VC.exe -Dnative_cxx=_VC++.exe -c $**
185
186 runTests.exe: runTests.obj runTests-utils-nt.obj $(OBJS_TEMPLATES)
187         $(LINK) $(LDFLAGS) runTests.obj runTests-utils-nt.obj $(OBJS_TEMPLATES)
188
189 runTests.obj:  ../src/runTests.C
190         $(CXX) $(CXXFLAGS_NORM) -c $**
191 runTests-utils-nt.obj: ../src/runTests-utils-nt.C
192         $(CXX) $(CXXFLAGS_NORM) -c $**
193
194 DatabaseOutputDriver.obj: ../src/DatabaseOutputDriver.C
195         $(CXX) $(CXXFLAGS_NORM) -c -I../src/ $**
196
197 DatabaseOutputDriver.dll: DatabaseOutputDriver.obj
198 # Advapi32.lib needed for GetUserName, Ws2_32.lib required for gethostname
199         $(LINK) $(LDFLAGS) -DLL -out:$@ $(TESTDRIVER_LIBS) Advapi32.lib Ws2_32.lib $**