VirtualBox

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

Last change on this file since 11731 was 11731, checked in by vboxsync, 16 years ago

#3076: More DYLD_FALLBACK_LIBRARY_PATH hacking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.3 KB
Line 
1# $Id: Makefile.kmk 11731 2008-08-28 00:23:52Z vboxsync $
2## @file
3# Sub-Makefile for the VMM testcases.
4#
5
6#
7# Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18# Clara, CA 95054 USA or visit http://www.sun.com if you need
19# additional information or have any questions.
20#
21
22ifdef VBOX_KBUILD_HACKING
23SUB_DEPTH = ../../../..
24else
25SUB_DEPTH = ..
26DEPTH ?= ../../../..
27endif
28include $(KBUILD_PATH)/subheader.kmk
29
30#
31# Target lists.
32#
33PROGRAMS += tstVMStructSize tstVMStructGC tstAsmStructs tstAsmStructsGC tstVMM tstVMM-HwAccm tstGlobalConfig
34ifneq ($(KBUILD_TARGET),win)
35PROGRAMS += tstVMMFork
36endif
37ifdef VBOX_WITH_TESTCASES
38 PROGRAMS += tstCFGM tstSSM tstMMHyperHeap tstVMM-2 tstVMREQ tstMicro tstCompiler tstVMMR0CallHost-1
39 ifneq ($(KBUILD_TARGET),l4)
40 PROGRAMS += tstAnimate
41 endif
42 SYSMODS += tstMicroGC
43endif # VBOX_WITH_TESTCASES
44
45ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
46 PROGRAMS += tstPDMAsyncCompletion
47endif
48
49
50#
51# We setup two 'other' targets for executing the two structure & alignment
52# validation testcases. Perhaps a bit hackish, but extremely useful.
53#
54ifndef VBOX_ONLY_SDK
55 ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
56 ifeq ($(filter-out x86.x86 amd64.amd64 x86.amd64, $(KBUILD_TARGET_ARCH).$(KBUILD_HOST_ARCH)),)
57 OTHERS += \
58 $(PATH_TARGET)/tstAsmStructs.run \
59 $(PATH_TARGET)/tstVMStructSize.run
60 endif
61 endif
62endif
63
64# The normal testing pass.
65TESTING += \
66 $(PATH_TARGET)/tstAsmStructs.run \
67 $(PATH_TARGET)/tstVMStructSize.run
68
69OTHER_CLEAN += \
70 $(PATH_TARGET)/tstAsmStructs.run \
71 $(PATH_TARGET)/tstVMStructSize.run \
72 $(PATH_TARGET)/tstAsmStructs.h \
73 $(PATH_TARGET)/tstAsmStructsAsm.o \
74 $(PATH_TARGET)/tstAsmStructsAsm.mac \
75 $(PATH_TARGET)/tstAsmStructsAsm.mac.o \
76 $(PATH_TARGET)/tstAsmStructsAsm.mac.lst \
77 $(PATH_TARGET)/tstAsmStructs.h.dump \
78 $(PATH_TARGET)/tstAsmStructsGC.h \
79 $(PATH_TARGET)/tstAsmStructsHC.h \
80 $(PATH_TARGET)/tstVMStructGC.h
81
82#
83# Globals
84#
85VBOX_PATH_VMM_SRC = $(PATH_ROOT)/src/VBox/VMM
86
87#
88# Targets
89#
90tstVMStructGC_TEMPLATE = VBOXGCEXE
91tstVMStructGC_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
92ifdef VBOX_WITH_IDT_PATCHING
93tstVMStructGC_DEFS += VBOX_WITH_IDT_PATCHING
94endif
95tstVMStructGC_SOURCES = tstVMStructGC.cpp
96tstVMStructGC_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM
97
98tstVMStructSize_TEMPLATE= VBOXR3TSTEXE
99tstVMStructSize_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
100ifdef VBOX_WITH_IDT_PATCHING
101tstVMStructSize_DEFS += VBOX_WITH_IDT_PATCHING
102endif
103tstVMStructSize_INCS = $(VBOX_PATH_VMM_SRC) $(VBOX_PATH_VMM_SRC)/PATM $(PATH_TARGET)
104tstVMStructSize_SOURCES = tstVMStructSize.cpp
105tstVMStructSize_LIBS.l4 = $(LIB_RUNTIME)
106tstVMStructSize.cpp_DEPS= $(PATH_TARGET)/tstVMStructGC.h
107
108tstAsmStructs_TEMPLATE = VBOXR3TSTEXE
109tstAsmStructs_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
110ifdef VBOX_WITH_IDT_PATCHING
111tstAsmStructs_DEFS += VBOX_WITH_IDT_PATCHING
112endif
113tstAsmStructs_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
114tstAsmStructs_SOURCES = tstAsmStructs.cpp
115tstAsmStructs_LIBS.l4 = $(LIB_RUNTIME)
116
117tstAsmStructsGC_TEMPLATE= VBOXGCEXE
118tstAsmStructsGC_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
119ifdef VBOX_WITH_IDT_PATCHING
120tstAsmStructsGC_DEFS += VBOX_WITH_IDT_PATCHING
121endif
122tstAsmStructsGC_INCS = $(VBOX_PATH_VMM_SRC) $(PATH_TARGET)
123tstAsmStructsGC_SOURCES = tstAsmStructs.cpp
124
125tstAsmStructs.cpp_DEPS = $(PATH_TARGET)/tstAsmStructsHC.h $(PATH_TARGET)/tstAsmStructsGC.h
126
127
128tstGlobalConfig_TEMPLATE= VBOXR3TSTEXE
129tstGlobalConfig_SOURCES = tstGlobalConfig.cpp
130tstGlobalConfig_LIBS = $(LIB_RUNTIME)
131
132tstMMHyperHeap_TEMPLATE = VBOXR3TSTEXE
133tstMMHyperHeap_SOURCES = tstMMHyperHeap.cpp
134tstMMHyperHeap_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
135
136tstSSM_TEMPLATE = VBOXR3TSTEXE
137tstSSM_SOURCES = tstSSM.cpp
138tstSSM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
139
140tstCFGM_TEMPLATE = VBOXR3TSTEXE
141tstCFGM_SOURCES = tstCFGM.cpp
142tstCFGM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
143
144tstVMM_TEMPLATE = VBOXR3EXE
145tstVMM_SOURCES = tstVMM.cpp
146tstVMM_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
147
148tstVMM-HwAccm_TEMPLATE = VBOXR3EXE
149tstVMM-HwAccm_SOURCES = tstVMM-HwAccm.cpp
150tstVMM-HwAccm_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
151
152tstVMMFork_TEMPLATE = VBOXR3EXE
153tstVMMFork_SOURCES = tstVMMFork.cpp
154tstVMMFork_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
155
156tstVMM-2_TEMPLATE = VBOXR3EXE
157tstVMM-2_SOURCES = tstVMM-2.cpp
158tstVMM-2_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
159
160tstVMMR0CallHost-1_TEMPLATE = VBOXR3EXE
161tstVMMR0CallHost-1_INCS = $(VBOX_PATH_VMM_SRC)
162tstVMMR0CallHost-1_SOURCES = \
163 tstVMMR0CallHost-1.cpp \
164 $(VBOX_PATH_VMM_SRC)/VMMR0/VMMR0A.asm
165tstVMMR0CallHost-1_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
166
167tstVMREQ_TEMPLATE = VBOXR3EXE
168tstVMREQ_SOURCES = tstVMREQ.cpp
169tstVMREQ_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
170
171tstAnimate_TEMPLATE = VBOXR3EXE
172tstAnimate_SOURCES = tstAnimate.cpp
173tstAnimate_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
174
175tstCompiler_TEMPLATE = VBOXR3TSTEXE
176tstCompiler_SOURCES = tstCompiler.cpp
177tstCompiler_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
178
179tstMicro_TEMPLATE = VBOXR3EXE
180tstMicro_SOURCES = tstMicro.cpp
181tstMicro_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
182
183# tstMicroGC.gc
184tstMicroGC_TEMPLATE = VBOXGC
185tstMicroGC_SOURCES = tstMicroGC.cpp tstMicroGCA.asm
186tstMicroGC_DEFS =
187tstMicroGC_INCS = $(VBOX_PATH_VMM_SRC)/testcase
188ifeq ($(VBOX_LDR_FMT32),pe)
189tstMicroGC_LDFLAGS = -Entry:tstMicroGC
190endif
191tstMicroGC_SYSSUFF = .gc
192tstMicroGC_LIBS = \
193 $(PATH_LIB)/DisasmGC$(VBOX_SUFF_LIB) \
194 $(PATH_LIB)/RuntimeGC$(VBOX_SUFF_LIB)
195ifeq ($(filter-out pe lx,$(VBOX_LDR_FMT32)),)
196tstMicroGC_LIBS += \
197 $(PATH_LIB)/VMMGCBuiltin$(VBOX_SUFF_LIB) \
198 $(LIB_VMMGC)
199endif
200tstMicroGC_SOURCES.win = tstMicroGC.def
201
202ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
203tstPDMAsyncCompletion_TEMPLATE = VBOXR3EXE
204tstPDMAsyncCompletion_SOURCES = tstPDMAsyncCompletion.cpp
205tstPDMAsyncCompletion_LIBS = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
206endif
207
208include $(KBUILD_PATH)/subfooter.kmk
209
210
211
212#
213# Some handcrafted support targets for tstAsmStructs.
214#
215
216ifeq ($(KBUILD_HOST),win)
217 include $(KBUILD_PATH)/tools/MINGW32.kmk
218 VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
219else
220 VBOX_NM ?= nm -p
221endif
222
223MY_ASA_ASM_STUFF = \
224 $(addprefix -D, \
225 $(DEFS) \
226 $(DEFS.$(KBUILD_TYPE)) \
227 $(DEFS.$(KBUILD_TARGET)) \
228 IN_RING3 $(ARCH_BITS_DEFS) \
229 $(DEFS.$(KBUILD_TARGET_ARCH)) \
230 $(DEFS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
231 ) \
232 -f $(if $(eq $(KBUILD_TARGET),darwin),macho,elf) \
233 $(foreach inc,$(INCS) $(VBOX_PATH_VMM_SRC)/testcase $(PATH_TARGET),-I$(inc)/)
234
235# 1a. make a header file which makes all the structures+members globals.
236$(PATH_TARGET)/tstAsmStructsAsm.mac: \
237 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
238 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed \
239 $(DEPTH)/include/iprt/asmdefs.mac \
240 $(DEPTH)/include/VBox/cpum.mac \
241 $(DEPTH)/include/VBox/sup.mac \
242 $(DEPTH)/include/VBox/vm.mac \
243 $(VBOX_PATH_VMM_SRC)/CPUMInternal.mac \
244 $(VBOX_PATH_VMM_SRC)/TRPMInternal.mac \
245 $(VBOX_PATH_VMM_SRC)/VMMInternal.mac \
246 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
247 $(PATH_ROOT)/Config.kmk $(LOCALCFG) $(AUTOCFG) \
248 | $(call DIRDEP,$(PATH_TARGET))
249 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
250ifndef DONT_USE_YASM
251 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
252 $(SED) -f $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm-lst.sed --output $@ [email protected]
253else
254 $(QUIET)$(TOOL_NASM_AS) -g $(MY_ASA_ASM_STUFF) -o [email protected] -l [email protected] $<
255 $(VBOX_NM) [email protected] | $(SED) \
256 -e '/[0-9a-fA-F][0-9a-fA-F]* [^a] /d' \
257 -e 's/[0-9a-fA-F][0-9a-fA-F]* a \([^ ]*\)/global \1/' \
258 > $@
259endif
260
261# 1b. make an elf/macho object containing the offsets.
262$(PATH_TARGET)/tstAsmStructsAsm.o: \
263 $(VBOX_PATH_VMM_SRC)/testcase/tstAsmStructsAsm.asm \
264 $(PATH_TARGET)/tstAsmStructsAsm.mac \
265 $(VBOX_PATH_VMM_SRC)/testcase/Makefile.kmk \
266 | $(call DIRDEP,$(PATH_TARGET))
267 $(call MSG_COMPILE,tstAsmStructsasm,$<,$@,AS)
268ifndef DONT_USE_YASM
269 $(QUIET)$(TOOL_YASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
270else
271 $(QUIET)$(TOOL_NASM_AS) $(MY_ASA_ASM_STUFF) -DDO_GLOBALS -o $@ $<
272endif
273
274# 2. use nm and sed to transform this into the header we want.
275$(PATH_TARGET)/tstAsmStructsHC.h: $(PATH_TARGET)/tstAsmStructsAsm.o
276 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
277 $(QUIET)$(RM) -f $@ [email protected] [email protected]
278 $(QUIET)$(REDIRECT) -wo [email protected] -- $(VBOX_NM) $<
279 $(QUIET)$(SED) -e '/STAMPROFILEADV/d' \
280 -e '/00[0-9a-fA-F]* [aA] [^_.]*\./!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^.]*\)\.\(.*$$\)/ CHECK_OFF(\2, 0x0\1, \3);/' \
281 --output [email protected] [email protected]
282 $(QUIET)$(SED) -e '/VM_size$$/d' \
283 -e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' -e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/ CHECK_SIZE(\2, 0x0\1);/' \
284 --append [email protected] [email protected]
285 $(QUIET)$(MV) -f [email protected] $@
286 $(QUIET)$(RM) -f [email protected]
287
288# 3. transform the HC header into a GC one by omitting some HC only structures.
289$(PATH_TARGET)/tstAsmStructsGC.h: $(PATH_TARGET)/tstAsmStructsHC.h
290 $(call MSG_GENERATE,tstVMStructSize,$@,$<)
291 $(QUIET)$(SED) -e '/VMMSWITCHERDEF/d' --output $@ $^
292
293## @todo make this default kBuild behaviour.
294.SECONDEXPANSION:
295
296# 4. run it.
297$(PATH_TARGET)/tstAsmStructs.run: $$(INSTARGET_tstAsmStructs) $$(INSTARGET_tstAsmStructsGC)
298 $(QUIET)$(RM) -f $@
299 $(if $(eq $(KBUILD_TARGET),darwin),$(REDIRECT) -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))' --) $(INSTARGET_tstAsmStructs)
300 $(if $(eq $(KBUILD_TARGET),darwin),$(REDIRECT) -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))' --) $(INSTARGET_tstAsmStructsGC)
301 $(QUIET)$(APPEND) "$@" "done"
302
303
304
305#
306# Run rule for tstVMStructSize.
307#
308
309# 1. Manually dump selected structures and members.
310$(PATH_TARGET)/tstVMStructGC.h: $$(INSTARGET_tstVMStructGC)
311 $(call MSG_GENERATE,tstVMStructSize,$@)
312 $(QUIET)$(REDIRECT) -wo $@ \
313 $(if $(eq $(KBUILD_TARGET),darwin), -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))') \
314 -- $^
315
316# 2. run it.
317$(PATH_TARGET)/tstVMStructSize.run: $$(INSTARGET_tstVMStructSize)
318 $(QUIET)$(RM) -f $@
319 $(if $(eq $(KBUILD_TARGET),darwin),$(REDIRECT) -E 'DYLD_FALLBACK_LIBRARY_PATH=$(dir $(LIB_RUNTIME))' --) $^
320 $(QUIET)$(APPEND) "$@" "done"
321
322# alias for the two struct tests.
323run-struct-tests: $(PATH_TARGET)/tstAsmStructs.run $(PATH_TARGET)/tstVMStructSize.run
324
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