VirtualBox

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

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

Environment / globals cleanup. The new policy is to use KBUILD_ and KMK_ prefixes for things that is put into or/and picked from the environment. This will take a good while to complete.

Renamed (old still valid for some versions):
PATH_KBUILD -> KBUILD_PATH
PATH_KBUILD_BIN -> KBUILD_BIN_PATH
BUILD_PLATFORM -> KBUILD_HOST
BUILD_PLATFORM_ARCH -> KBUILD_HOST_ARCH
BUILD_PLATFORM_CPU -> KBUILD_HOST_CPU

Renamed - old not checked:
MAKELEVEL -> KMK_LEVEL
KMKFLAGS -> KMK_FLAGS
MAKEFLAGS -> KMK_FLAGS
MAKEOVERRIDES -> KMK_OVERRIDES

Removed:
MAKE_VERSION
MFLAGS

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