VirtualBox

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

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

CONFIG_WITH_EVALPLUS: evalctx, evalval, evalvalctx, evalcall and evalcall2. (all untested)

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