VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Makefile.kmk@ 4071

Last change on this file since 4071 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.3 KB
Line 
1# $Id: Makefile.kmk 4071 2007-08-07 17:07:59Z vboxsync $
2## @file
3# Sub-Makefile for the VMM testcases.
4#
5
6#
7# Copyright (C) 2006-2007 innotek GmbH
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License as published by the Free Software Foundation,
13# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14# distribution. VirtualBox OSE is distributed in the hope that it will
15# be useful, but WITHOUT ANY WARRANTY of any kind.
16
17DEPTH ?= ../../../..
18SUB_DEPTH = ..
19include $(PATH_KBUILD)/subheader.kmk
20
21#
22# Target lists.
23#
24PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm
25ifdef VBOX_WITH_TESTCASES
26 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
27 ifneq ($(BUILD_TARGET),l4)
28 PROGRAMS += tstAnimate
29 endif
30 SYSMODS += tstMicroGC
31endif # VBOX_WITH_TESTCASES
32
33#
34# We setup two 'other' targets for executing the two structure & alignment
35# validation testcases. Perhaps a bit hackish, but extremely useful.
36#
37ifeq ($(BUILD_TARGET),$(BUILD_PLATFORM))
38 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(BUILD_TARGET_ARCH).$(BUILD_PLATFORM_ARCH)),)
39 OTHERS += \
40 $(PATH_TARGET)/tstAsmStructs.run \
41 $(PATH_TARGET)/tstVMStructSize.run
42 endif
43endif
44OTHER_CLEAN += \
45 $(PATH_TARGET)/tstAsmStructs.run \
46 $(PATH_TARGET)/tstVMStructSize.run \
47 $(PATH_TARGET)/tstAsmStructs.h \
48 $(PATH_TARGET)/tstAsmStructsAsm.o \
49 $(PATH_TARGET)/tstAsmStructsAsm.mac \
50 $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
51 $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
52 $(PATH_TARGET)/tstAsmStructs.h.dump \
53 $(PATH_TARGET)/tstAsmStructsGC.h \
54 $(PATH_TARGET)/tstAsmStructsHC.h \
55 $(PATH_TARGET)/tstVMStructGC.h
56
57#
58# Globals
59#
60VBOX_PATH_VMM_SRC = $(PATH_SUB_ROOT)
61
62#
63# Targets
64#
65tstVMStructGC_TEMPLATE = VBOXGCEXE
66tstVMStructGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_REM_GC IN_RRM_GC
67tstVMStructGC_SOURCES = tstVMStructGC.cpp
68tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
69
70tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
71tstVMStructSize_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3 IN_REM_R3
72tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
73tstVMStructSize_SOURCES = tstVMStructSize.cpp
74tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
75tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
76
77tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
78tstAsmStructs_DEFS = IN_VMM_R3 IN_PDM_R3 IN_CFGM_R3 IN_IOM_R3 IN_VM_R3 IN_CPUM_R3 IN_SELM_R3 IN_PGM_R3 IN_TRPM_R3 IN_MM_R3 IN_PDM_R3 IN_DBGF_R3 IN_PATM_R3 IN_DIS_R3 IN_STAM_R3 IN_VGADEVICE_R3 IN_CSAM_R3 IN_SSM_R3
79tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
80tstAsmStructs_SOURCES = tstAsmStructs.cpp
81tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
82
83tstAsmStructsGC_TEMPLATE= VBOXGCEXE
84tstAsmStructsGC_DEFS = IN_VMM_GC IN_PDM_GC IN_CFGM_GC IN_IOM_GC IN_VM_GC IN_CPUM_GC IN_SELM_GC IN_PGM_GC IN_TRPM_GC IN_MM_GC IN_PDM_GC IN_DBGF_GC IN_PATM_GC IN_DIS_GC IN_STAM_GC IN_VGADEVICE_GC IN_CSAM_GC IN_SSM_GC IN_RRM_GC
85tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
86tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
87
88tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
89
90
91tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
92tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
93tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
94
95tstSSM_TEMPLATE = VBOXR3TSTEXE
96tstSSM_SOURCES = tstSSM.cpp
97tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
98
99tstCFGM_TEMPLATE = VBOXR3TSTEXE
100tstCFGM_SOURCES = tstCFGM.cpp
101tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
102
103tstVMM_TEMPLATE = VBOXR3EXE
104tstVMM_SOURCES = tstVMM.cpp
105tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
106
107tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
108tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
109tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
110
111tstVMM-2_TEMPLATE = VBOXR3EXE
112tstVMM-2_SOURCES = tstVMM-2.cpp
113tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
114
115tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
116tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
117tstVMMR0CallHost-1_SOURCES = \
118 tstVMMR0CallHost-1.cpp \
119 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
120tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
121
122tstVMREQ_TEMPLATE = VBOXR3EXE
123tstVMREQ_SOURCES = tstVMREQ.cpp
124tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
125
126tstAnimate_TEMPLATE = VBOXR3EXE
127tstAnimate_SOURCES = tstAnimate.cpp
128tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
129
130tstCompiler_TEMPLATE = VBOXR3TSTEXE
131tstCompiler_SOURCES = tstCompiler.cpp
132tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
133
134tstMicro_TEMPLATE = VBOXR3EXE
135tstMicro_SOURCES = tstMicro.cpp
136tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
137
138# tstMicroGC.gc
139tstMicroGC_TEMPLATE = VBOXGC
140tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
141tstMicroGC_DEFS =
142tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
143ifeq ($(VBOX_LDR_FMT32),pe)
144tstMicroGC_LDFLAGS = -Entry:tstMicroGC
145endif
146tstMicroGC_SYSSUFF = .gc
147tstMicroGC_LIBS = \
148 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
149 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
150ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
151tstMicroGC_LIBS += \
152 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
153 $(LIB_VMMGC)
154endif
155tstMicroGC_SOURCES.win = tstMicroGC.def
156
157
158
159
160include $(PATH_KBUILD)/subfooter.kmk
161
162
163ifndef USE_MULTI_TARGET
164# temporary hack.
165.NOTPARALLEL: $(TARGET_tstMicroGC) $(LIB_VMMGC)
166endif
167
168
169#
170# Some handcrafted support targets for tstAsmStructs.
171#
172
173ifeq ($(BUILD_PLATFORM),win)
174 include $(PATH_KBUILD)/tools/MINGW32.kmk
175 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
176else
177 VBOX_NM ?= nm -p
178endif
179
180# 1a. make a header file which makes all the structures+members globals.
181$(PATH_TARGET)/tstAsmStructsAsm.mac: \
182 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
183 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
184 $(DEPTH)/include/iprt/asmdefs.mac \
185 $(DEPTH)/include/VBox/cpum.mac \
186 $(DEPTH)/include/VBox/vm.mac \
187 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
188 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
189 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
190 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
191 | $(call DIRDEP,$(PATH_TARGET))
192 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
193ifndef DONT_USE_YASM
194 $(QUIET)$(TOOL_YASM_AS) \
195 $(addprefix -D, \
196 $(DEFS) \
197 $(DEFS.$(BUILD_TYPE)) \
198 $(DEFS.$(BUILD_TARGET)) \
199 IN_RING3 \
200 $(DEFS.$(BUILD_TARGET_ARCH)) \
201 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
202 ) \
203 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
204 $(foreach inc,$(INCS),-I$(inc)/) -o $@.o -l $@.lst $<
205 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed $@.lst > $@
206else
207 $(QUIET)$(TOOL_NASM_AS) \
208 -g \
209 $(addprefix -D, \
210 $(DEFS) \
211 $(DEFS.$(BUILD_TYPE)) \
212 $(DEFS.$(BUILD_TARGET)) \
213 IN_RING3 \
214 $(DEFS.$(BUILD_TARGET_ARCH)) \
215 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
216 ) \
217 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
218 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase,-I$(inc)/) -o $@.o -l $@.lst $<
219 $(VBOX_NM) $@.o | $(SED) \
220 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
221 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
222 > $@
223endif
224
225# 1b. make an elf/macho object containing the offsets.
226$(PATH_TARGET)/tstAsmStructsAsm.o: \
227 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
228 $(PATH_TARGET)/tstAsmStructsAsm.mac \
229 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
230 | $(call DIRDEP,$(PATH_TARGET))
231 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
232ifndef DONT_USE_YASM
233 $(QUIET)$(TOOL_YASM_AS) \
234 $(addprefix -D, \
235 DO_GLOBALS \
236 $(DEFS) \
237 $(DEFS.$(BUILD_TYPE)) \
238 $(DEFS.$(BUILD_TARGET)) \
239 IN_RING3 \
240 $(DEFS.$(BUILD_TARGET_ARCH)) \
241 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
242 ) \
243 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf -g stabs) \
244 $(foreach inc,$(INCS) $(PATH_TARGET),-I$(inc)/) -o $@ $<
245else
246 $(QUIET)$(TOOL_NASM_AS) \
247 $(addprefix -D, \
248 DO_GLOBALS \
249 $(DEFS) \
250 $(DEFS.$(BUILD_TYPE)) \
251 $(DEFS.$(BUILD_TARGET)) \
252 IN_RING3 \
253 $(DEFS.$(BUILD_TARGET_ARCH)) \
254 $(DEFS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
255 ) \
256 -f $(if $(eq $(BUILD_TARGET),darwin),macho,elf) \
257 $(foreach inc,$(INCS) $(PATH_TARGET) $(VBOX_PATH_VMM_SRC)/testcase,-I$(inc)/) -o $@ $<
258endif
259
260# 2. use nm and sed to transform this into the header we want.
261$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
262 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
263 $(QUIET)$(RM) -f $@ $@.dump $@.tmp
264 $(VBOX_NM) $< > $@.dump
265 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
266 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
267 $@.dump > $@.tmp
268 $(QUIET)$(SED) -e '/VM_size$$/d' \
269 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
270 $@.dump >> $@.tmp
271 $(QUIET)$(MV) -f $@.tmp $@
272 $(QUIET)$(RM) -f $@.dump
273
274# 3. transform the HC header into a GC one by omitting some HC only structures.
275$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
276 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
277 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' \
278 $^ > $@
279
280## @todo make this default kBuild behaviour.
281.SECONDEXPANSION:
282
283# 4. run it.
284$(PATH_TARGET)/tstAsmStructs.run: $$(INSTARGET_tstAsmStructs) $$(INSTARGET_tstAsmStructsGC)
285 $(QUIET)$(RM) -f $@
286 $(INSTARGET_tstAsmStructs)
287 $(INSTARGET_tstAsmStructsGC)
288 $(QUIET)$(APPEND) "$@" "done"
289
290
291
292#
293# Run rule for tstVMStructSize.
294#
295
296# 1. Manually dump selected structures and members.
297$(PATH_TARGET)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC)
298 $(call MSG_GENERATE,tstVMStructSize,$@)
299 $(QUIET)$(INSTARGET_tstVMStructGC) > $@
300
301# 2. run it.
302$(PATH_TARGET)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize)
303 $(QUIET)$(RM) -f $@
304 $^
305 $(QUIET)$(APPEND) "$@" "done"
306
307# alias for the two struct tests.
308run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
309
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette