VirtualBox

source: kBuild/trunk/src/gmake/Makefile.kmk@ 803

Last change on this file since 803 was 778, checked in by bird, 18 years ago

Attempt at dealing with deadlocked kmk on Ctrl-C by dispatching the SIGINT/SIGBREAK on the main thread instead of the ctrl-event thread (Windows).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1# $Id: Makefile.kmk 778 2007-01-21 00:29:17Z bird $
2
3
4DEPTH = ../..
5include $(PATH_KBUILD)/header.kmk
6
7#
8# kmk
9#
10PROGRAMS += kmk
11
12kmk_TEMPLATE = BIN
13kmk_DEPS = $(PATH_TARGET)/config.h
14kmk_INCS = $(PATH_TARGET) .
15kmk_INCS.darwin = glob
16kmk_INCS.freebsd = glob
17#ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
18#kmk_INCS += kmkbuiltin/w32
19#endif
20
21kmk_DEFS = \
22 HAVE_CONFIG_H \
23 NO_ARCHIVES \
24 CONFIG_NO_DEFAULT_SUFFIXES \
25 CONFIG_NO_DEFAULT_PATTERN_RULES \
26 CONFIG_NO_DEFAULT_TERMINAL_RULES \
27 CONFIG_NO_DEFAULT_SUFFIX_RULES \
28 CONFIG_NO_DEFAULT_VARIABLES \
29 CONFIG_WITH_EXTENDED_NOTPARALLEL \
30 CONFIG_WITH_INCLUDEDEP \
31 CONFIG_WITH_TOUPPER_TOLOWER \
32 CONFIG_WITH_ABSPATHEX \
33 CONFIG_PRETTY_COMMAND_PRINTING \
34 KMK \
35 \
36 KMK_HELPERS \
37 VARIABLE_HASH \
38 CONFIG_WITH_OPTIMIZATION_HACKS \
39 CONFIG_WITH_VALUE_LENGTH \
40 CONFIG_WITH_COMPARE \
41 CONFIG_WITH_STACK \
42 CONFIG_WITH_MATH \
43 EXPERIMENTAL \
44 \
45 BUILD_PLATFORM=\"$(BUILD_TARGET)\" \
46 BUILD_PLATFORM_ARCH=\"$(BUILD_TARGET_ARCH)\" \
47 BUILD_PLATFORM_CPU=\"$(BUILD_TARGET_CPU)\"
48kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT
49
50kmk_SOURCES = \
51 main.c \
52 read.c \
53 hash.c \
54 strcache.c \
55 variable.c \
56 ar.c \
57 arscan.c \
58 commands.c \
59 default.c \
60 dir.c \
61 expand.c \
62 file.c \
63 function.c \
64 implicit.c \
65 job.c \
66 misc.c \
67 remake.c \
68 rule.c \
69 signame.c \
70 version.c \
71 vpath.c \
72 remote-stub.c \
73 kbuild.c
74
75ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
76kmk_SOURCES += \
77 getopt.c \
78 getopt1.c \
79 getloadavg.c \
80 w32/subproc/misc.c \
81 w32/subproc/sub_proc.c \
82 w32/subproc/w32err.c \
83 glob/glob.c \
84 glob/fnmatch.c \
85 w32/compat/dirent.c \
86 w32/pathstuff.c
87endif
88
89kmk_SOURCES.freebsd = \
90 glob/glob.c \
91 glob/fnmatch.c
92
93kmk_SOURCES.darwin = \
94 glob/glob.c \
95 glob/fnmatch.c
96
97#
98# kmkbuiltin commands
99#
100kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
101kmk_SOURCES += \
102 kmkbuiltin.c \
103 kmkbuiltin/append.c \
104 kmkbuiltin/cat.c \
105 kmkbuiltin/cp.c \
106 kmkbuiltin/cp_utils.c \
107 kmkbuiltin/echo.c \
108 kmkbuiltin/install.c \
109 kmkbuiltin/mkdir.c \
110 kmkbuiltin/mv.c \
111 kmkbuiltin/ln.c \
112 kmkbuiltin/printf.c \
113 kmkbuiltin/rm.c \
114 kmkbuiltin/rmdir.c \
115 \
116 kmkbuiltin/err.c \
117 kmkbuiltin/setmode.c \
118 kmkbuiltin/strmode.c \
119 kmkbuiltin/strlcpy.c
120
121ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
122kmk_SOURCES += \
123 kmkbuiltin/mscfakes.c \
124 kmkbuiltin/fts.c
125endif
126
127kmk_SOURCES.darwin += \
128 kmkbuiltin/darwin.c
129
130
131#
132# Standalone kmkbuiltin commands.
133#
134PROGRAMS += kmk_append kmk_cat kmk_cp kmk_echo kmk_mkdir kmk_mv kmk_install kmk_ln kmk_printf kmk_rm kmk_rmdir
135
136kmk_append_TEMPLATE = BIN
137kmk_append_DEFS = kmk_builtin_append=main
138kmk_append_INCS = .
139kmk_append_SOURCES = \
140 kmkbuiltin/append.c \
141 kmkbuiltin/err.c
142
143kmk_cat_TEMPLATE = BIN
144kmk_cat_DEFS = kmk_builtin_cat=main
145kmk_cat_SOURCES = \
146 kmkbuiltin/cat.c \
147 kmkbuiltin/err.c
148ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
149kmk_cat_INCS += $(PATH_TARGET) .
150kmk_cat_DEFS += HAVE_CONFIG_H
151kmk_cat_SOURCES += \
152 kmkbuiltin/mscfakes.c \
153 getopt.c \
154 getopt1.c
155endif
156
157kmk_cp_TEMPLATE = BIN
158kmk_cp_DEFS = kmk_builtin_cp=main
159kmk_cp_SOURCES = \
160 kmkbuiltin/cp.c \
161 kmkbuiltin/cp_utils.c \
162 kmkbuiltin/strlcpy.c \
163 kmkbuiltin/err.c
164ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
165kmk_cp_INCS += $(PATH_TARGET) .
166kmk_cp_DEFS += HAVE_CONFIG_H
167kmk_cp_SOURCES += \
168 kmkbuiltin/mscfakes.c \
169 kmkbuiltin/fts.c \
170 w32/compat/dirent.c \
171 getopt.c \
172 getopt1.c
173endif
174kmk_cp_SOURCES.darwin = \
175 kmkbuiltin/darwin.c
176
177kmk_echo_TEMPLATE = BIN
178kmk_echo_DEFS = kmk_builtin_echo=main
179kmk_echo_SOURCES = \
180 kmkbuiltin/echo.c
181ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
182kmk_echo_SOURCES += \
183 kmkbuiltin/mscfakes.c \
184 kmkbuiltin/err.c
185endif
186
187kmk_install_TEMPLATE = BIN
188kmk_install_DEFS = kmk_builtin_install=main
189kmk_install_SOURCES = \
190 kmkbuiltin/install.c \
191 kmkbuiltin/err.c \
192 kmkbuiltin/strmode.c \
193 kmkbuiltin/setmode.c
194ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
195kmk_install_INCS += $(PATH_TARGET) .
196kmk_install_DEFS += HAVE_CONFIG_H
197kmk_install_SOURCES += \
198 kmkbuiltin/mscfakes.c \
199 getopt.c \
200 getopt1.c
201endif
202
203kmk_ln_TEMPLATE = BIN
204kmk_ln_DEFS = kmk_builtin_ln=main
205kmk_ln_SOURCES = \
206 kmkbuiltin/ln.c \
207 kmkbuiltin/err.c
208ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
209kmk_ln_INCS += $(PATH_TARGET) .
210kmk_ln_DEFS += HAVE_CONFIG_H
211kmk_ln_SOURCES += \
212 kmkbuiltin/mscfakes.c\
213 getopt.c \
214 getopt1.c
215endif
216
217kmk_mkdir_TEMPLATE = BIN
218kmk_mkdir_DEFS = kmk_builtin_mkdir=main
219kmk_mkdir_SOURCES = \
220 kmkbuiltin/mkdir.c \
221 kmkbuiltin/err.c \
222 kmkbuiltin/setmode.c
223ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
224kmk_mkdir_INCS += $(PATH_TARGET) .
225kmk_mkdir_DEFS += HAVE_CONFIG_H
226kmk_mkdir_SOURCES += \
227 kmkbuiltin/mscfakes.c \
228 getopt.c \
229 getopt1.c
230endif
231
232kmk_mv_TEMPLATE = BIN
233kmk_mv_DEFS = kmk_builtin_mv=main
234kmk_mv_SOURCES = \
235 kmkbuiltin/mv.c \
236 kmkbuiltin/err.c \
237 kmkbuiltin/strmode.c
238ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
239kmk_mv_INCS += $(PATH_TARGET) .
240kmk_mv_DEFS += HAVE_CONFIG_H
241kmk_mv_SOURCES += \
242 kmkbuiltin/mscfakes.c \
243 getopt.c \
244 getopt1.c
245endif
246
247kmk_printf_TEMPLATE = BIN
248kmk_printf_DEFS = kmk_builtin_printf=main
249kmk_printf_SOURCES = \
250 kmkbuiltin/printf.c \
251 kmkbuiltin/err.c
252ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
253kmk_printf_INCS += $(PATH_TARGET) .
254kmk_printf_DEFS += HAVE_CONFIG_H
255kmk_printf_SOURCES += \
256 kmkbuiltin/mscfakes.c \
257 getopt.c \
258 getopt1.c
259endif
260
261kmk_rm_TEMPLATE = BIN
262kmk_rm_DEFS = kmk_builtin_rm=main
263kmk_rm_SOURCES = \
264 kmkbuiltin/rm.c \
265 kmkbuiltin/err.c \
266 kmkbuiltin/strmode.c
267ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
268kmk_rm_INCS += $(PATH_TARGET) .
269kmk_rm_DEFS += HAVE_CONFIG_H
270kmk_rm_SOURCES += \
271 kmkbuiltin/mscfakes.c\
272 getopt.c \
273 getopt1.c
274endif
275
276kmk_rmdir_TEMPLATE = BIN
277kmk_rmdir_DEFS = kmk_builtin_rmdir=main
278kmk_rmdir_SOURCES = \
279 kmkbuiltin/rmdir.c \
280 kmkbuiltin/err.c \
281 kmkbuiltin/setmode.c
282ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
283kmk_rmdir_INCS += $(PATH_TARGET) .
284kmk_rmdir_DEFS += HAVE_CONFIG_H
285kmk_rmdir_SOURCES += \
286 kmkbuiltin/mscfakes.c \
287 getopt.c \
288 getopt1.c
289endif
290
291
292
293#
294# kmk_gmake - almost plain GNU Make.
295#
296PROGRAMS += kmk_gmake
297kmk_gmake_TEMPLATE = BIN
298kmk_gmake_DEPS = $(PATH_TARGET)/config.h
299kmk_gmake_INCS = $(PATH_TARGET) .
300kmk_gmake_INCS.darwin = glob
301kmk_gmake_INCS.freebsd = glob
302
303
304kmk_gmake_DEFS = \
305 HAVE_CONFIG_H \
306 NO_ARCHIVES \
307 CONFIG_WITH_TOUPPER_TOLOWER \
308 EXPERIMENTAL
309
310kmk_gmake_SOURCES = \
311 main.c \
312 read.c \
313 hash.c \
314 strcache.c \
315 variable.c \
316 ar.c \
317 arscan.c \
318 commands.c \
319 default.c \
320 dir.c \
321 expand.c \
322 file.c \
323 function.c \
324 implicit.c \
325 job.c \
326 misc.c \
327 remake.c \
328 rule.c \
329 signame.c \
330 version.c \
331 vpath.c \
332 remote-stub.c
333
334ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
335kmk_gmake_SOURCES += \
336 getopt.c \
337 getopt1.c \
338 getloadavg.c \
339 w32/subproc/misc.c \
340 w32/subproc/sub_proc.c \
341 w32/subproc/w32err.c \
342 glob/glob.c \
343 glob/fnmatch.c \
344 w32/compat/dirent.c \
345 w32/pathstuff.c
346endif
347
348kmk_gmake_SOURCES.freebsd = \
349 glob/glob.c \
350 glob/fnmatch.c
351
352kmk_gmake_SOURCES.darwin = \
353 glob/glob.c \
354 glob/fnmatch.c
355
356
357
358include $(PATH_KBUILD)/footer.kmk
359
360
361#
362# Use checked in config.h instead of running ./Configure for it.
363#
364config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
365config.h.win := config.h.W32
366config.h.win32 := config.h.W32
367config.h.win64 := config.h.W32
368config.h.nt := config.h.W32
369
370$(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
371 $(MKDIR) -p $(dir $@)
372 $(CP) $^ $@
373
374
375#
376# Some tests.
377#
378parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
379parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
380 echo $@_start ; sleep 1; echo $@_done
381
382test:
383 echo "1"
384 echo "2"
385 echo "3"
386 echo "4"
387
388
389#
390# Shell execution tests.
391#
392test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
393
394# shell double and single quoting check (was busted on windows in 3.81).
395test_shell_quoting:
396 $(ECHO_EXT) "double quoted sTrInG"
397 $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
398 $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
399 $(ECHO) "This string should not be printed with double quotes."
400 $(ECHO) 'This string should not be printed with single quotes.'
401 ( echo " #define PWD \"`pwd`\""; )
402
403test_shell_double_quoting:
404 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
405 "s/foo/$@/" -e \
406 "s/foo/works/" \
407 -e "s/foo/\!/"
408
409test_shell_double_quoting2:
410 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
411 "s/foo/$@/" -e \
412 "s/foo/works/" \
413 -e\
414 "s/foo/\!/"
415
416# when using batch mode shell, the newline got escaped twice and spoiling everything.
417test_shell_newline:
418 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
419 's/foo/$@/' -e \
420 's/foo/works/' \
421 -e 's/foo/\!/'
422
423
424test_stack:
425 $(MAKE) -f testcase-stack.kmk
426
427test_math:
428 $(MAKE) -f testcase-math.kmk
429
430
431test_all: test_math test_stack test_shell
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