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.
|
---|
28 | DEPTH ?= ../../..
|
---|
29 | SUB_DEPTH = ../..
|
---|
30 | include $(PATH_KBUILD)/subheader.kmk
|
---|
31 |
|
---|
32 |
|
---|
33 | #
|
---|
34 | # Templates for the testcases.
|
---|
35 | #
|
---|
36 | TEMPLATE_TST = Testcase template
|
---|
37 | ifeq ($(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 |
|
---|
60 | else
|
---|
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
|
---|
78 | endif
|
---|
79 | TEMPLATE_TST_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include
|
---|
80 |
|
---|
81 |
|
---|
82 | TEMPLATE_TSTPROG = Testcase program template
|
---|
83 | TEMPLATE_TSTPROG_EXTENDS = TST
|
---|
84 |
|
---|
85 |
|
---|
86 | TEMPLATE_TSTDLL = Testcase dll template
|
---|
87 | TEMPLATE_TSTDLL_EXTENDS = TST
|
---|
88 |
|
---|
89 |
|
---|
90 | TEMPLATE_TSTBARE = Bare bone testcase template
|
---|
91 | ifeq ($(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 |
|
---|
106 | else
|
---|
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
|
---|
129 | endif
|
---|
130 | TEMPLATE_TSTBARE_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include
|
---|
131 |
|
---|
132 | TEMPLATE_TSTBAREPROG = Bare bone testcase program template
|
---|
133 | TEMPLATE_TSTBAREPROG_EXTENDS = TSTBARE
|
---|
134 | ifneq ($(filter win win32 win64,$(BUILD_TARGET)),)
|
---|
135 | TEMPLATE_TSTBAREPROG_LDFLAGS += -Entry:WindowsMain -FIXED:NO
|
---|
136 | else
|
---|
137 | TEMPLATE_TSTBAREPROG_LDFLAGS.nt += -FIXED:NO
|
---|
138 | endif
|
---|
139 |
|
---|
140 |
|
---|
141 | TEMPLATE_TSTBAREDLL = Bare bone testcase dll template
|
---|
142 | TEMPLATE_TSTBAREDLL_EXTENDS = TSTBARE
|
---|
143 | ifeq ($(BUILD_TARGET),win)
|
---|
144 | TEMPLATE_TSTBAREDLL_LDFLAGS += -Entry:DllMain
|
---|
145 | else ifeq ($(BUILD_TARGET),darwin)
|
---|
146 | # TEMPLATE_TSTBAREDLL_CFLAGS += -dynamiclib
|
---|
147 | # TEMPLATE_TSTBAREDLL_LDFLAGS += -dynamiclib
|
---|
148 | endif
|
---|
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 | #
|
---|
158 | PROGRAMS += tst-0 tst-0-driver
|
---|
159 | DLLS += tst-0-a tst-0-b tst-0-c tst-0-d
|
---|
160 |
|
---|
161 | tst-0-driver_TEMPLATE = TSTPROG
|
---|
162 | tst-0-driver_SOURCES = tst-0-driver.c
|
---|
163 |
|
---|
164 | tst-0-a_TEMPLATE = TSTBAREDLL
|
---|
165 | tst-0-a_SOURCES = tst-0-a.c tstDllMainStub.c
|
---|
166 | tst-0-a_SOURCES.os2= tstDllMainStub-os2.asm
|
---|
167 |
|
---|
168 | tst-0-b_TEMPLATE = TSTBAREDLL
|
---|
169 | tst-0-b_SOURCES = tst-0-b.c tstDllMainStub.c
|
---|
170 | tst-0-b_SOURCES.os2= tstDllMainStub-os2.asm
|
---|
171 |
|
---|
172 | tst-0-c_TEMPLATE = TSTBAREDLL
|
---|
173 | tst-0-c_SOURCES = tst-0-c.c tstDllMainStub.c
|
---|
174 | tst-0-c_SOURCES.os2= tstDllMainStub-os2.asm
|
---|
175 |
|
---|
176 | tst-0-d_TEMPLATE = TSTBAREDLL
|
---|
177 | tst-0-d_SOURCES = tst-0-d.c tstDllMainStub.c
|
---|
178 | tst-0-d_SOURCES.os2= tstDllMainStub-os2.asm
|
---|
179 |
|
---|
180 | tst-0_TEMPLATE = TSTBAREPROG
|
---|
181 | tst-0_SOURCES = tst-0.c tstExeMainStub.c
|
---|
182 | tst-0_SOURCES.os2= tstExeMainStub-os2.asm
|
---|
183 |
|
---|
184 | ifeq ($(BUILD_TARGET),win)
|
---|
185 | tst-0-driver_LIBS= $(PATH_LIB)/kLdr.lib
|
---|
186 | tst-0-a_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
|
---|
187 | tst-0-b_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
|
---|
188 | tst-0-c_LIBS = $(PATH_TARGET)/tst-0-d/tst-0-d.lib
|
---|
189 | tst-0_LIBS = $(TARGET_tst-0-a:.dll=.lib) $(TARGET_tst-0-b:.dll=.lib) $(TARGET_tst-0-c:.dll=.lib)
|
---|
190 | else
|
---|
191 | tst-0-driver_LIBS= $(PATH_DLL)/kLdr$(SUFF_DLL)
|
---|
192 | tst-0-a_LIBS = $(subst -a,-d,$(TARGET_tst-0-a))
|
---|
193 | tst-0-b_LIBS = $(subst -b,-d,$(TARGET_tst-0-b))
|
---|
194 | tst-0-c_LIBS = $(subst -c,-d,$(TARGET_tst-0-c))
|
---|
195 | tst-0_LIBS = $(TARGET_tst-0-a) $(TARGET_tst-0-b) $(TARGET_tst-0-c)
|
---|
196 | endif
|
---|
197 |
|
---|
198 |
|
---|
199 | #
|
---|
200 | # tst-1: four dlls, three of which depends on the 4th and the testcase depends on those three again.
|
---|
201 | #
|
---|
202 | PROGRAMS += tst-1
|
---|
203 | DLLS += tst-1-a tst-1-b tst-1-c tst-1-d
|
---|
204 |
|
---|
205 | tst-1-a_TEMPLATE = TSTDLL
|
---|
206 | tst-1-a_SOURCES = tst-1-a.c tstDllMain.c
|
---|
207 |
|
---|
208 | tst-1-b_TEMPLATE = TSTDLL
|
---|
209 | tst-1-b_SOURCES = tst-1-b.c tstDllMain.c
|
---|
210 |
|
---|
211 | tst-1-c_TEMPLATE = TSTDLL
|
---|
212 | tst-1-c_SOURCES = tst-1-c.c tstDllMain.c
|
---|
213 |
|
---|
214 | tst-1-d_TEMPLATE = TSTDLL
|
---|
215 | tst-1-d_SOURCES = tst-1-d.c tstDllMain.c
|
---|
216 |
|
---|
217 | tst-1_TEMPLATE = TSTPROG
|
---|
218 | tst-1_SOURCES = tst-1.c
|
---|
219 |
|
---|
220 | ifeq ($(BUILD_TARGET),win)
|
---|
221 | tst-1-a_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
|
---|
222 | tst-1-b_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
|
---|
223 | tst-1-c_LIBS = $(PATH_TARGET)/tst-1-d/tst-1-d.lib
|
---|
224 | tst-1_LIBS = $(TARGET_tst-1-a:.dll=.lib) $(TARGET_tst-1-b:.dll=.lib) $(TARGET_tst-1-c:.dll=.lib)
|
---|
225 | else
|
---|
226 | tst-1-a_LIBS = $(subst -a,-d,$(TARGET_tst-1-a))
|
---|
227 | tst-1-b_LIBS = $(subst -b,-d,$(TARGET_tst-1-b))
|
---|
228 | tst-1-c_LIBS = $(subst -c,-d,$(TARGET_tst-1-c))
|
---|
229 | tst-1_LIBS = $(TARGET_tst-1-a) $(TARGET_tst-1-b) $(TARGET_tst-1-c)
|
---|
230 | endif
|
---|
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 | #
|
---|
236 | PROGRAMS += tst-2
|
---|
237 | DLLS += tst-2-a tst-2-b tst-2-c tst-2-d
|
---|
238 |
|
---|
239 | tst-2-a_TEMPLATE = TSTDLL
|
---|
240 | tst-2-a_SOURCES = tst-2-a.c tstDllMain.c
|
---|
241 |
|
---|
242 | tst-2-b_TEMPLATE = TSTDLL
|
---|
243 | tst-2-b_SOURCES = tst-2-b.c tstDllMain.c
|
---|
244 |
|
---|
245 | tst-2-c_TEMPLATE = TSTDLL
|
---|
246 | tst-2-c_SOURCES = tst-2-c.c tstDllMain.c
|
---|
247 |
|
---|
248 | tst-2-d_TEMPLATE = TSTDLL
|
---|
249 | tst-2-d_SOURCES = tst-2-d.c tstDllMain.c
|
---|
250 |
|
---|
251 | tst-2_TEMPLATE = TSTPROG
|
---|
252 | tst-2_SOURCES = tst-2.c
|
---|
253 |
|
---|
254 | ifeq ($(BUILD_TARGET),win)
|
---|
255 | tst-2-b_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
|
---|
256 | tst-2-c_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
|
---|
257 | tst-2-d_LIBS = $(PATH_TARGET)/tst-2-a/tst-2-a.lib
|
---|
258 | tst-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)
|
---|
259 | else
|
---|
260 | tst-2-b_LIBS = $(subst -b,-a,$(TARGET_tst-2-b))
|
---|
261 | tst-2-c_LIBS = $(subst -c,-a,$(TARGET_tst-2-c))
|
---|
262 | tst-2-d_LIBS = $(subst -d,-a,$(TARGET_tst-2-d))
|
---|
263 | tst-2_LIBS = $(TARGET_tst-2-a) $(TARGET_tst-2-b) $(TARGET_tst-2-c) $(TARGET_tst-2-d)
|
---|
264 | endif
|
---|
265 |
|
---|
266 |
|
---|
267 | #
|
---|
268 | # tst-3: Single module.
|
---|
269 | #
|
---|
270 | PROGRAMS += tst-3-driver
|
---|
271 | ifeq ($(BUILD_TARGET),darwin)
|
---|
272 | SYSMODS += tst-3
|
---|
273 | else
|
---|
274 | DLLS += tst-3
|
---|
275 | LIBRARIES.win += tst-3-imp
|
---|
276 | LIBRARIES.os2 += tst-3-imp
|
---|
277 | endif
|
---|
278 |
|
---|
279 | tst-3_TEMPLATE = TSTBAREDLL
|
---|
280 | tst-3_SOURCES = tst-3.c tst-3-ext.c tstDllMainStub.c
|
---|
281 | tst-3_SOURCES.os2= tstDllMainStub-os2.asm
|
---|
282 | tst-3_LIBS.os2 = $(TARGET_tst-3-imp)
|
---|
283 | tst-3_LIBS.win = $(TARGET_tst-3-imp)
|
---|
284 |
|
---|
285 | tst-3-imp_TEMPLATE = TSTBAREDLL
|
---|
286 | tst-3-imp_SOURCES.win = tst-3-imp-win.def
|
---|
287 | tst-3-imp_SOURCES.os2 = tst-3-imp-os2.def
|
---|
288 |
|
---|
289 | tst-3-driver_TEMPLATE = TSTPROG
|
---|
290 | tst-3-driver_SOURCES = tst-3-driver.c
|
---|
291 |
|
---|
292 | ifeq ($(BUILD_TARGET),win)
|
---|
293 | tst-3-driver_LIBS = $(PATH_LIB)/kLdr.lib
|
---|
294 | else
|
---|
295 | tst-3-driver_LIBS = $(PATH_DLL)/kLdr$(SUFF_DLL)
|
---|
296 | endif
|
---|
297 |
|
---|
298 |
|
---|
299 | # generate rules.
|
---|
300 | include $(PATH_KBUILD)/subfooter.kmk
|
---|
301 |
|
---|