VirtualBox

source: kStuff/trunk/kLdr/testcase/Makefile.kmk

Last change on this file was 29, checked in by bird, 16 years ago

Finally got around execute the switch to the MIT license.

  • Property svn:keywords set to Id Revision
File size: 9.3 KB
Line 
1# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $
2## @file
3# kBuild Makefile for the kLdr testcases.
4#
5
6#
7# Copyright (c) 2006-2007 Knut St. Osmundsen <[email protected]>
8#
9# Permission is hereby granted, free of charge, to any person
10# obtaining a copy of this software and associated documentation
11# files (the "Software"), to deal in the Software without
12# restriction, including without limitation the rights to use,
13# copy, modify, merge, publish, distribute, sublicense, and/or sell
14# copies of the Software, and to permit persons to whom the
15# Software is furnished to do so, subject to the following
16# conditions:
17#
18# The above copyright notice and this permission notice shall be
19# included in all copies or substantial portions of the Software.
20#
21# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28# OTHER DEALINGS IN THE SOFTWARE.
29#
30
31# generate rules.
32DEPTH ?= ../..
33SUB_DEPTH = ../..
34include $(PATH_KBUILD)/subheader.kmk
35
36
37#
38# Templates for the testcases.
39#
40TEMPLATE_TST = Testcase template
41ifeq ($(BUILD_TARGET),win)
42 ifeq ($(BUILD_TARGET_ARCH),x86)
43 TEMPLATE_TST_TOOL = VCC70
44 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD
45 TEMPLATE_TST_CXXFLAGS = -W3 -Zi -Zl -MD
46 TEMPLATE_TST_LIBS = \
47 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
48 $(PATH_TOOL_VCC70_LIB)/msvcrt.lib
49 else
50 TEMPLATE_TST_TOOL = VCC80AMD64
51 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD
52 TEMPLATE_TST_CXXFLAGS = -W3 -Zi -Zl -MD
53 TEMPLATE_TST_LIBS = \
54 $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \
55 $(PATH_TOOL_VCC80AMD64_LIB)/msvcrt.lib
56 endif
57 TEMPLATE_TST_CFLAGS.release = -O2
58 TEMPLATE_TST_CXXFLAGS.release = -O2
59 TEMPLATE_TST_ASFLAGS = -f win
60 TEMPLATE_TST_DEFS = __WIN__
61 TEMPLATE_TST_SDKS.x86 = WIN32SDK
62 TEMPLATE_TST_SDKS.amd64 = WIN64SDK
63
64else
65 TEMPLATE_TST_CFLAGS = -Wall -pedantic -g
66 TEMPLATE_TST_CFLAGS.release = -O2
67 TEMPLATE_TST_LDFLAGS =
68 ifneq ($(filter os2,$(BUILD_TARGET)),)
69 TEMPLATE_TST_TOOL = GCC3OMF
70 TEMPLATE_TST_ASFLAGS = -f obj
71 TEMPLATE_TST_LIBS = os2 gcc end
72 else ifneq ($(filter darwin,$(BUILD_TARGET)),)
73 TEMPLATE_TST_TOOL = GCC4MACHO
74 TEMPLATE_TST_ASFLAGS = -f macho
75 TEMPLATE_TST_DEFS = __DARWIN__
76 TEMPLATE_TST_LIBS =
77 else
78 TEMPLATE_TST_TOOL = GCC3
79 TEMPLATE_TST_ASFLAGS = -f elf
80 TEMPLATE_TST_LIBS = gcc
81 endif
82endif
83TEMPLATE_TST_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include
84
85
86TEMPLATE_TSTPROG = Testcase program template
87TEMPLATE_TSTPROG_EXTENDS = TST
88
89
90TEMPLATE_TSTDLL = Testcase dll template
91TEMPLATE_TSTDLL_EXTENDS = TST
92
93
94TEMPLATE_TSTBARE = Bare bone testcase template
95ifeq ($(BUILD_TARGET),win)
96 ifeq ($(BUILD_TARGET_ARCH),x86)
97 TEMPLATE_TSTBARE_TOOL = VCC70
98 else
99 TEMPLATE_TSTBARE_TOOL = VCC80AMD64
100 endif
101 TEMPLATE_TSTBARE_CFLAGS = -W3 -Zi -Zl
102 TEMPLATE_TSTBARE_CFLAGS.release = -O2
103 TEMPLATE_TSTBARE_CXXFLAGS = -W3 -Zi -Zl
104 TEMPLATE_TSTBARE_CXXFLAGS.release = -O2
105 TEMPLATE_TSTBARE_ASFLAGS = -f win
106 TEMPLATE_TSTBARE_DEFS = __WIN__
107 TEMPLATE_TSTBARE_SDKS.x86 = WIN32SDK
108 TEMPLATE_TSTBARE_SDKS.amd64 = WIN64SDK
109
110else
111 TEMPLATE_TSTBARE_CFLAGS = -Wall -pedantic -g
112 TEMPLATE_TSTBARE_CFLAGS.release = -O2
113 TEMPLATE_TSTBARE_LDFLAGS = -nostdlib -lgcc
114 ifeq ($(filter-out os2,$(BUILD_TARGET)),)
115 TEMPLATE_TSTBARE_TOOL = GCC3OMF
116 TEMPLATE_TSTBARE_ASFLAGS = -f obj
117 TEMPLATE_TSTBARE_ASTOOL = NASM
118 TEMPLATE_TSTBARE_DEFS = main=main_wrapped
119 TEMPLATE_TSTBARE_LIBS = os2
120 else ifeq ($(filter-out darwin,$(BUILD_TARGET)),)
121 TEMPLATE_TSTBARE_TOOL = GCC4MACHO
122 TEMPLATE_TSTBARE_ASFLAGS = -f macho
123 TEMPLATE_TSTBARE_ASTOOL = NASM
124 TEMPLATE_TSTBARE_DEFS = __DARWIN__
125 TEMPLATE_TSTBARE_LIBS =
126 TEMPLATE_TSTBARE_CFLAGS += -static -fno-common
127 TEMPLATE_TSTBARE_LDFLAGS += -nostdlib -r
128 else
129 TEMPLATE_TSTBARE_TOOL = GCC3
130 TEMPLATE_TSTBARE_ASFLAGS = -f elf
131 TEMPLATE_TSTBARE_LIBS = gcc
132 endif
133endif
134TEMPLATE_TSTBARE_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include
135
136TEMPLATE_TSTBAREPROG = Bare bone testcase program template
137TEMPLATE_TSTBAREPROG_EXTENDS = TSTBARE
138ifneq ($(filter win win32 win64,$(BUILD_TARGET)),)
139TEMPLATE_TSTBAREPROG_LDFLAGS += -Entry:WindowsMain -FIXED:NO
140else
141TEMPLATE_TSTBAREPROG_LDFLAGS.nt += -FIXED:NO
142endif
143
144
145TEMPLATE_TSTBAREDLL = Bare bone testcase dll template
146TEMPLATE_TSTBAREDLL_EXTENDS = TSTBARE
147ifeq ($(BUILD_TARGET),win)
148 TEMPLATE_TSTBAREDLL_LDFLAGS += -Entry:DllMain
149else ifeq ($(BUILD_TARGET),darwin)
150# TEMPLATE_TSTBAREDLL_CFLAGS += -dynamiclib
151# TEMPLATE_TSTBAREDLL_LDFLAGS += -dynamiclib
152endif
153
154
155
156
157#
158# tst-0: four dlls, three of which depends on the 4th and no external dependencies.
159# The purpose of this testcase is to debug the dynamic loader without
160# messing with the native loader at all.
161#
162PROGRAMS += tst-0 tst-0-driver
163DLLS += tst-0-a tst-0-b tst-0-c tst-0-d
164
165tst-0-driver_TEMPLATE = TSTPROG
166tst-0-driver_SOURCES = tst-0-driver.c
167
168tst-0-a_TEMPLATE = TSTBAREDLL
169tst-0-a_SOURCES = tst-0-a.c tstDllMainStub.c
170tst-0-a_SOURCES.os2= tstDllMainStub-os2.asm
171
172tst-0-b_TEMPLATE = TSTBAREDLL
173tst-0-b_SOURCES = tst-0-b.c tstDllMainStub.c
174tst-0-b_SOURCES.os2= tstDllMainStub-os2.asm
175
176tst-0-c_TEMPLATE = TSTBAREDLL
177tst-0-c_SOURCES = tst-0-c.c tstDllMainStub.c
178tst-0-c_SOURCES.os2= tstDllMainStub-os2.asm
179
180tst-0-d_TEMPLATE = TSTBAREDLL
181tst-0-d_SOURCES = tst-0-d.c tstDllMainStub.c
182tst-0-d_SOURCES.os2= tstDllMainStub-os2.asm
183
184tst-0_TEMPLATE = TSTBAREPROG
185tst-0_SOURCES = tst-0.c tstExeMainStub.c
186tst-0_SOURCES.os2= tstExeMainStub-os2.asm
187
188ifeq ($(BUILD_TARGET),win)
189tst-0-driver_LIBS= $(PATH_LIB)/kLdr.lib
190tst-0-a_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
191tst-0-b_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
192tst-0-c_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
193tst-0_LIBS = $(TARGET_tst-0-a:.dll=.lib) $(TARGET_tst-0-b:.dll=.lib) $(TARGET_tst-0-c:.dll=.lib)
194else
195tst-0-driver_LIBS= $(PATH_DLL)/kLdr$(SUFF_DLL)
196tst-0-a_LIBS = $(subst -a,-d,$(TARGET_tst-0-a))
197tst-0-b_LIBS = $(subst -b,-d,$(TARGET_tst-0-b))
198tst-0-c_LIBS = $(subst -c,-d,$(TARGET_tst-0-c))
199tst-0_LIBS = $(TARGET_tst-0-a) $(TARGET_tst-0-b) $(TARGET_tst-0-c)
200endif
201
202
203#
204# tst-1: four dlls, three of which depends on the 4th and the testcase depends on those three again.
205#
206PROGRAMS += tst-1
207DLLS += tst-1-a tst-1-b tst-1-c tst-1-d
208
209tst-1-a_TEMPLATE = TSTDLL
210tst-1-a_SOURCES = tst-1-a.c tstDllMain.c
211
212tst-1-b_TEMPLATE = TSTDLL
213tst-1-b_SOURCES = tst-1-b.c tstDllMain.c
214
215tst-1-c_TEMPLATE = TSTDLL
216tst-1-c_SOURCES = tst-1-c.c tstDllMain.c
217
218tst-1-d_TEMPLATE = TSTDLL
219tst-1-d_SOURCES = tst-1-d.c tstDllMain.c
220
221tst-1_TEMPLATE = TSTPROG
222tst-1_SOURCES = tst-1.c
223
224ifeq ($(BUILD_TARGET),win)
225tst-1-a_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
226tst-1-b_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
227tst-1-c_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
228tst-1_LIBS = $(TARGET_tst-1-a:.dll=.lib) $(TARGET_tst-1-b:.dll=.lib) $(TARGET_tst-1-c:.dll=.lib)
229else
230tst-1-a_LIBS = $(subst -a,-d,$(TARGET_tst-1-a))
231tst-1-b_LIBS = $(subst -b,-d,$(TARGET_tst-1-b))
232tst-1-c_LIBS = $(subst -c,-d,$(TARGET_tst-1-c))
233tst-1_LIBS = $(TARGET_tst-1-a) $(TARGET_tst-1-b) $(TARGET_tst-1-c)
234endif
235
236
237#
238# tst-2: four dlls, three of which depends on the 1st, and the testcase depends on those all of them.
239#
240PROGRAMS += tst-2
241DLLS += tst-2-a tst-2-b tst-2-c tst-2-d
242
243tst-2-a_TEMPLATE = TSTDLL
244tst-2-a_SOURCES = tst-2-a.c tstDllMain.c
245
246tst-2-b_TEMPLATE = TSTDLL
247tst-2-b_SOURCES = tst-2-b.c tstDllMain.c
248
249tst-2-c_TEMPLATE = TSTDLL
250tst-2-c_SOURCES = tst-2-c.c tstDllMain.c
251
252tst-2-d_TEMPLATE = TSTDLL
253tst-2-d_SOURCES = tst-2-d.c tstDllMain.c
254
255tst-2_TEMPLATE = TSTPROG
256tst-2_SOURCES = tst-2.c
257
258ifeq ($(BUILD_TARGET),win)
259tst-2-b_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
260tst-2-c_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
261tst-2-d_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
262tst-2_LIBS = $(TARGET_tst-2-b:.dll=.lib) $(TARGET_tst-2-c:.dll=.lib) $(TARGET_tst-2-d:.dll=.lib) $(TARGET_tst-2-a:.dll=.lib)
263else
264tst-2-b_LIBS = $(subst -b,-a,$(TARGET_tst-2-b))
265tst-2-c_LIBS = $(subst -c,-a,$(TARGET_tst-2-c))
266tst-2-d_LIBS = $(subst -d,-a,$(TARGET_tst-2-d))
267tst-2_LIBS = $(TARGET_tst-2-a) $(TARGET_tst-2-b) $(TARGET_tst-2-c) $(TARGET_tst-2-d)
268endif
269
270
271#
272# tst-3: Single module.
273#
274PROGRAMS += tst-3-driver
275ifeq ($(BUILD_TARGET),darwin)
276SYSMODS += tst-3
277else
278DLLS += tst-3
279LIBRARIES.win += tst-3-imp
280LIBRARIES.os2 += tst-3-imp
281endif
282
283tst-3_TEMPLATE = TSTBAREDLL
284tst-3_SOURCES = tst-3.c tst-3-ext.c tstDllMainStub.c
285tst-3_SOURCES.os2= tstDllMainStub-os2.asm
286tst-3_LIBS.os2 = $(TARGET_tst-3-imp)
287tst-3_LIBS.win = $(TARGET_tst-3-imp)
288
289tst-3-imp_TEMPLATE = TSTBAREDLL
290tst-3-imp_SOURCES.win = tst-3-imp-win.def
291tst-3-imp_SOURCES.os2 = tst-3-imp-os2.def
292
293tst-3-driver_TEMPLATE = TSTPROG
294tst-3-driver_SOURCES = tst-3-driver.c
295
296ifeq ($(BUILD_TARGET),win)
297tst-3-driver_LIBS = $(PATH_LIB)/kLdr.lib
298else
299tst-3-driver_LIBS = $(PATH_DLL)/kLdr$(SUFF_DLL)
300endif
301
302
303# generate rules.
304include $(PATH_KBUILD)/subfooter.kmk
305
Note: See TracBrowser for help on using the repository browser.

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