VirtualBox

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

Last change on this file since 2 was 2, checked in by bird, 17 years ago

Imported http://svn.netlabs.org/repos/libc/trunk/kStuff, revision 3612.

  • Property svn:keywords set to Id Revision
File size: 8.9 KB
Line 
1# $Id: Makefile.kmk 2 2007-11-16 16:07:14Z 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# This file is part of kStuff.
10#
11# kStuff is free software; you can redistribute it and/or
12# modify it under the terms of the GNU Lesser General Public
13# License as published by the Free Software Foundation; either
14# version 2.1 of the License, or (at your option) any later version.
15#
16# kStuff is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19# Lesser General Public License for more details.
20#
21# You should have received a copy of the GNU Lesser General Public
22# License along with kStuff; if not, write to the Free Software
23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24#
25#
26
27# generate rules.
28DEPTH ?= ../../..
29SUB_DEPTH = ../..
30include $(PATH_KBUILD)/subheader.kmk
31
32
33#
34# Templates for the testcases.
35#
36TEMPLATE_TST = Testcase template
37ifeq ($(BUILD_TARGET),win)
38 ifeq ($(BUILD_TARGET_ARCH),x86)
39 TEMPLATE_TST_TOOL = VCC70
40 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD
41 TEMPLATE_TST_CXXFLAGS = -W3 -Zi -Zl -MD
42 TEMPLATE_TST_LIBS = \
43 $(PATH_TOOL_VCC70_LIB)/oldnames.lib \
44 $(PATH_TOOL_VCC70_LIB)/msvcrt.lib
45 else
46 TEMPLATE_TST_TOOL = VCC80AMD64
47 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD
48 TEMPLATE_TST_CXXFLAGS = -W3 -Zi -Zl -MD
49 TEMPLATE_TST_LIBS = \
50 $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \
51 $(PATH_TOOL_VCC80AMD64_LIB)/msvcrt.lib
52 endif
53 TEMPLATE_TST_CFLAGS.release = -O2
54 TEMPLATE_TST_CXXFLAGS.release = -O2
55 TEMPLATE_TST_ASFLAGS = -f win
56 TEMPLATE_TST_DEFS = __WIN__
57 TEMPLATE_TST_SDKS.x86 = WIN32SDK
58 TEMPLATE_TST_SDKS.amd64 = WIN64SDK
59
60else
61 TEMPLATE_TST_CFLAGS = -Wall -pedantic -g
62 TEMPLATE_TST_CFLAGS.release = -O2
63 TEMPLATE_TST_LDFLAGS =
64 ifneq ($(filter os2,$(BUILD_TARGET)),)
65 TEMPLATE_TST_TOOL = GCC3OMF
66 TEMPLATE_TST_ASFLAGS = -f obj
67 TEMPLATE_TST_LIBS = os2 gcc end
68 else ifneq ($(filter darwin,$(BUILD_TARGET)),)
69 TEMPLATE_TST_TOOL = GCC4MACHO
70 TEMPLATE_TST_ASFLAGS = -f macho
71 TEMPLATE_TST_DEFS = __DARWIN__
72 TEMPLATE_TST_LIBS =
73 else
74 TEMPLATE_TST_TOOL = GCC3
75 TEMPLATE_TST_ASFLAGS = -f elf
76 TEMPLATE_TST_LIBS = gcc
77 endif
78endif
79TEMPLATE_TST_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include
80
81
82TEMPLATE_TSTPROG = Testcase program template
83TEMPLATE_TSTPROG_EXTENDS = TST
84
85
86TEMPLATE_TSTDLL = Testcase dll template
87TEMPLATE_TSTDLL_EXTENDS = TST
88
89
90TEMPLATE_TSTBARE = Bare bone testcase template
91ifeq ($(BUILD_TARGET),win)
92 ifeq ($(BUILD_TARGET_ARCH),x86)
93 TEMPLATE_TSTBARE_TOOL = VCC70
94 else
95 TEMPLATE_TSTBARE_TOOL = VCC80AMD64
96 endif
97 TEMPLATE_TSTBARE_CFLAGS = -W3 -Zi -Zl
98 TEMPLATE_TSTBARE_CFLAGS.release = -O2
99 TEMPLATE_TSTBARE_CXXFLAGS = -W3 -Zi -Zl
100 TEMPLATE_TSTBARE_CXXFLAGS.release = -O2
101 TEMPLATE_TSTBARE_ASFLAGS = -f win
102 TEMPLATE_TSTBARE_DEFS = __WIN__
103 TEMPLATE_TSTBARE_SDKS.x86 = WIN32SDK
104 TEMPLATE_TSTBARE_SDKS.amd64 = WIN64SDK
105
106else
107 TEMPLATE_TSTBARE_CFLAGS = -Wall -pedantic -g
108 TEMPLATE_TSTBARE_CFLAGS.release = -O2
109 TEMPLATE_TSTBARE_LDFLAGS = -nostdlib -lgcc
110 ifeq ($(filter-out os2,$(BUILD_TARGET)),)
111 TEMPLATE_TSTBARE_TOOL = GCC3OMF
112 TEMPLATE_TSTBARE_ASFLAGS = -f obj
113 TEMPLATE_TSTBARE_ASTOOL = NASM
114 TEMPLATE_TSTBARE_DEFS = main=main_wrapped
115 TEMPLATE_TSTBARE_LIBS = os2
116 else ifeq ($(filter-out darwin,$(BUILD_TARGET)),)
117 TEMPLATE_TSTBARE_TOOL = GCC4MACHO
118 TEMPLATE_TSTBARE_ASFLAGS = -f macho
119 TEMPLATE_TSTBARE_ASTOOL = NASM
120 TEMPLATE_TSTBARE_DEFS = __DARWIN__
121 TEMPLATE_TSTBARE_LIBS =
122 TEMPLATE_TSTBARE_CFLAGS += -static -fno-common
123 TEMPLATE_TSTBARE_LDFLAGS += -nostdlib -r
124 else
125 TEMPLATE_TSTBARE_TOOL = GCC3
126 TEMPLATE_TSTBARE_ASFLAGS = -f elf
127 TEMPLATE_TSTBARE_LIBS = gcc
128 endif
129endif
130TEMPLATE_TSTBARE_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include
131
132TEMPLATE_TSTBAREPROG = Bare bone testcase program template
133TEMPLATE_TSTBAREPROG_EXTENDS = TSTBARE
134ifneq ($(filter win win32 win64,$(BUILD_TARGET)),)
135TEMPLATE_TSTBAREPROG_LDFLAGS += -Entry:WindowsMain -FIXED:NO
136else
137TEMPLATE_TSTBAREPROG_LDFLAGS.nt += -FIXED:NO
138endif
139
140
141TEMPLATE_TSTBAREDLL = Bare bone testcase dll template
142TEMPLATE_TSTBAREDLL_EXTENDS = TSTBARE
143ifeq ($(BUILD_TARGET),win)
144 TEMPLATE_TSTBAREDLL_LDFLAGS += -Entry:DllMain
145else ifeq ($(BUILD_TARGET),darwin)
146# TEMPLATE_TSTBAREDLL_CFLAGS += -dynamiclib
147# TEMPLATE_TSTBAREDLL_LDFLAGS += -dynamiclib
148endif
149
150
151
152
153#
154# tst-0: four dlls, three of which depends on the 4th and no external dependencies.
155# The purpose of this testcase is to debug the dynamic loader without
156# messing with the native loader at all.
157#
158PROGRAMS += tst-0 tst-0-driver
159DLLS += tst-0-a tst-0-b tst-0-c tst-0-d
160
161tst-0-driver_TEMPLATE = TSTPROG
162tst-0-driver_SOURCES = tst-0-driver.c
163
164tst-0-a_TEMPLATE = TSTBAREDLL
165tst-0-a_SOURCES = tst-0-a.c tstDllMainStub.c
166tst-0-a_SOURCES.os2= tstDllMainStub-os2.asm
167
168tst-0-b_TEMPLATE = TSTBAREDLL
169tst-0-b_SOURCES = tst-0-b.c tstDllMainStub.c
170tst-0-b_SOURCES.os2= tstDllMainStub-os2.asm
171
172tst-0-c_TEMPLATE = TSTBAREDLL
173tst-0-c_SOURCES = tst-0-c.c tstDllMainStub.c
174tst-0-c_SOURCES.os2= tstDllMainStub-os2.asm
175
176tst-0-d_TEMPLATE = TSTBAREDLL
177tst-0-d_SOURCES = tst-0-d.c tstDllMainStub.c
178tst-0-d_SOURCES.os2= tstDllMainStub-os2.asm
179
180tst-0_TEMPLATE = TSTBAREPROG
181tst-0_SOURCES = tst-0.c tstExeMainStub.c
182tst-0_SOURCES.os2= tstExeMainStub-os2.asm
183
184ifeq ($(BUILD_TARGET),win)
185tst-0-driver_LIBS= $(PATH_LIB)/kLdr.lib
186tst-0-a_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
187tst-0-b_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
188tst-0-c_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
189tst-0_LIBS = $(TARGET_tst-0-a:.dll=.lib) $(TARGET_tst-0-b:.dll=.lib) $(TARGET_tst-0-c:.dll=.lib)
190else
191tst-0-driver_LIBS= $(PATH_DLL)/kLdr$(SUFF_DLL)
192tst-0-a_LIBS = $(subst -a,-d,$(TARGET_tst-0-a))
193tst-0-b_LIBS = $(subst -b,-d,$(TARGET_tst-0-b))
194tst-0-c_LIBS = $(subst -c,-d,$(TARGET_tst-0-c))
195tst-0_LIBS = $(TARGET_tst-0-a) $(TARGET_tst-0-b) $(TARGET_tst-0-c)
196endif
197
198
199#
200# tst-1: four dlls, three of which depends on the 4th and the testcase depends on those three again.
201#
202PROGRAMS += tst-1
203DLLS += tst-1-a tst-1-b tst-1-c tst-1-d
204
205tst-1-a_TEMPLATE = TSTDLL
206tst-1-a_SOURCES = tst-1-a.c tstDllMain.c
207
208tst-1-b_TEMPLATE = TSTDLL
209tst-1-b_SOURCES = tst-1-b.c tstDllMain.c
210
211tst-1-c_TEMPLATE = TSTDLL
212tst-1-c_SOURCES = tst-1-c.c tstDllMain.c
213
214tst-1-d_TEMPLATE = TSTDLL
215tst-1-d_SOURCES = tst-1-d.c tstDllMain.c
216
217tst-1_TEMPLATE = TSTPROG
218tst-1_SOURCES = tst-1.c
219
220ifeq ($(BUILD_TARGET),win)
221tst-1-a_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
222tst-1-b_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
223tst-1-c_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
224tst-1_LIBS = $(TARGET_tst-1-a:.dll=.lib) $(TARGET_tst-1-b:.dll=.lib) $(TARGET_tst-1-c:.dll=.lib)
225else
226tst-1-a_LIBS = $(subst -a,-d,$(TARGET_tst-1-a))
227tst-1-b_LIBS = $(subst -b,-d,$(TARGET_tst-1-b))
228tst-1-c_LIBS = $(subst -c,-d,$(TARGET_tst-1-c))
229tst-1_LIBS = $(TARGET_tst-1-a) $(TARGET_tst-1-b) $(TARGET_tst-1-c)
230endif
231
232
233#
234# tst-2: four dlls, three of which depends on the 1st, and the testcase depends on those all of them.
235#
236PROGRAMS += tst-2
237DLLS += tst-2-a tst-2-b tst-2-c tst-2-d
238
239tst-2-a_TEMPLATE = TSTDLL
240tst-2-a_SOURCES = tst-2-a.c tstDllMain.c
241
242tst-2-b_TEMPLATE = TSTDLL
243tst-2-b_SOURCES = tst-2-b.c tstDllMain.c
244
245tst-2-c_TEMPLATE = TSTDLL
246tst-2-c_SOURCES = tst-2-c.c tstDllMain.c
247
248tst-2-d_TEMPLATE = TSTDLL
249tst-2-d_SOURCES = tst-2-d.c tstDllMain.c
250
251tst-2_TEMPLATE = TSTPROG
252tst-2_SOURCES = tst-2.c
253
254ifeq ($(BUILD_TARGET),win)
255tst-2-b_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
256tst-2-c_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
257tst-2-d_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
258tst-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)
259else
260tst-2-b_LIBS = $(subst -b,-a,$(TARGET_tst-2-b))
261tst-2-c_LIBS = $(subst -c,-a,$(TARGET_tst-2-c))
262tst-2-d_LIBS = $(subst -d,-a,$(TARGET_tst-2-d))
263tst-2_LIBS = $(TARGET_tst-2-a) $(TARGET_tst-2-b) $(TARGET_tst-2-c) $(TARGET_tst-2-d)
264endif
265
266
267#
268# tst-3: Single module.
269#
270PROGRAMS += tst-3-driver
271ifeq ($(BUILD_TARGET),darwin)
272SYSMODS += tst-3
273else
274DLLS += tst-3
275LIBRARIES.win += tst-3-imp
276LIBRARIES.os2 += tst-3-imp
277endif
278
279tst-3_TEMPLATE = TSTBAREDLL
280tst-3_SOURCES = tst-3.c tst-3-ext.c tstDllMainStub.c
281tst-3_SOURCES.os2= tstDllMainStub-os2.asm
282tst-3_LIBS.os2 = $(TARGET_tst-3-imp)
283tst-3_LIBS.win = $(TARGET_tst-3-imp)
284
285tst-3-imp_TEMPLATE = TSTBAREDLL
286tst-3-imp_SOURCES.win = tst-3-imp-win.def
287tst-3-imp_SOURCES.os2 = tst-3-imp-os2.def
288
289tst-3-driver_TEMPLATE = TSTPROG
290tst-3-driver_SOURCES = tst-3-driver.c
291
292ifeq ($(BUILD_TARGET),win)
293tst-3-driver_LIBS = $(PATH_LIB)/kLdr.lib
294else
295tst-3-driver_LIBS = $(PATH_DLL)/kLdr$(SUFF_DLL)
296endif
297
298
299# generate rules.
300include $(PATH_KBUILD)/subfooter.kmk
301
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