VirtualBox

source: kBuild/trunk/src/kmk/Makefile.kmk@ 1167

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

skip some unnecessary system calls during process creation and termination.

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