source: trunk/kLdr/testcase/Makefile.kmk@ 3136

Last change on this file since 3136 was 2967, checked in by bird, 19 years ago

More testcase fun.

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