VirtualBox

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

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

Implemented local variable definitions - CONFIG_WITH_LOCAL_VARIABLES.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.1 KB
Line 
1# $Id: Makefile.kmk 1408 2008-03-17 22:21:36Z 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_PRETTY_COMMAND_PRINTING \
127 \
128 BUILD_PLATFORM=\"$(BUILD_TARGET)\" \
129 BUILD_PLATFORM_ARCH=\"$(BUILD_TARGET_ARCH)\" \
130 BUILD_PLATFORM_CPU=\"$(BUILD_TARGET_CPU)\"
131kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS
132kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS
133kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT
134
135kmk_SOURCES = \
136 main.c \
137 read.c \
138 hash.c \
139 strcache.c \
140 variable.c \
141 ar.c \
142 arscan.c \
143 commands.c \
144 default.c \
145 dir.c \
146 expand.c \
147 file.c \
148 function.c \
149 implicit.c \
150 job.c \
151 misc.c \
152 remake.c \
153 rule.c \
154 signame.c \
155 version.c \
156 vpath.c \
157 remote-stub.c \
158 kbuild.c
159
160#
161# kmkbuiltin commands
162#
163kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
164kmk_LIBS += $(LIB_KUTIL) $(LIB_KDEP)
165kmk_SOURCES += \
166 kmkbuiltin.c \
167 kmkbuiltin/append.c \
168 kmkbuiltin/cat.c \
169 kmkbuiltin/cmp.c \
170 kmkbuiltin/cmp_util.c \
171 kmkbuiltin/cp.c \
172 kmkbuiltin/cp_utils.c \
173 kmkbuiltin/echo.c \
174 kmkbuiltin/install.c \
175 kmkbuiltin/kDepIDB.c \
176 kmkbuiltin/md5sum.c \
177 kmkbuiltin/mkdir.c \
178 kmkbuiltin/mv.c \
179 kmkbuiltin/ln.c \
180 kmkbuiltin/printf.c \
181 kmkbuiltin/rm.c \
182 kmkbuiltin/rmdir.c \
183 kmkbuiltin/test.c \
184
185## @todo kmkbuiltin/redirect.c
186
187## Some profiling
188#kmk_SOURCES += kbuildprf.c
189#kmk_DEFS += open=prf_open read=prf_read lseek=prf_lseek close=prf_close
190##kmk_DEFS += KMK_PRF=1
191##kmkmissing_DEFS += KMK_PRF=1
192
193#
194# Standalone kmkbuiltin commands.
195#
196PROGRAMS += \
197 kmk_append \
198 kmk_cat \
199 kmk_cp \
200 kmk_cmp \
201 kmk_echo \
202 kmk_md5sum \
203 kmk_mkdir \
204 kmk_mv \
205 kmk_install \
206 kmk_ln \
207 kmk_printf \
208 kmk_redirect \
209 kmk_rm \
210 kmk_rmdir \
211 kmk_test \
212 kDepIDB \
213
214kmk_append_TEMPLATE = BIN-KMK
215kmk_append_DEFS = kmk_builtin_append=main
216kmk_append_INCS = .
217kmk_append_SOURCES = \
218 kmkbuiltin/append.c
219
220kmk_cat_TEMPLATE = BIN-KMK
221kmk_cat_DEFS = kmk_builtin_cat=main
222kmk_cat_SOURCES = \
223 kmkbuiltin/cat.c
224
225kmk_cmp_TEMPLATE = BIN-KMK
226kmk_cmp_DEFS = kmk_builtin_cmp=main
227kmk_cmp_SOURCES = \
228 kmkbuiltin/cmp.c \
229 kmkbuiltin/cmp_util.c
230
231kmk_cp_TEMPLATE = BIN-KMK
232kmk_cp_DEFS = kmk_builtin_cp=main
233kmk_cp_SOURCES = \
234 kmkbuiltin/cp.c \
235 kmkbuiltin/cp_utils.c \
236 kmkbuiltin/cmp_util.c
237
238kmk_echo_TEMPLATE = BIN-KMK
239kmk_echo_DEFS = kmk_builtin_echo=main
240kmk_echo_SOURCES = \
241 kmkbuiltin/echo.c
242
243kmk_install_TEMPLATE = BIN-KMK
244kmk_install_DEFS = kmk_builtin_install=main
245kmk_install_SOURCES = \
246 kmkbuiltin/install.c
247
248kmk_ln_TEMPLATE = BIN-KMK
249kmk_ln_DEFS = kmk_builtin_ln=main
250kmk_ln_SOURCES = \
251 kmkbuiltin/ln.c
252
253kmk_mkdir_TEMPLATE = BIN-KMK
254kmk_mkdir_DEFS = kmk_builtin_mkdir=main
255kmk_mkdir_SOURCES = \
256 kmkbuiltin/mkdir.c
257
258kmk_md5sum_TEMPLATE = BIN-KMK
259kmk_md5sum_DEFS = kmk_builtin_md5sum=main
260kmk_md5sum_SOURCES = \
261 kmkbuiltin/md5sum.c
262kmk_md5sum_LIBS = $(LIB_KUTIL)
263
264kmk_mv_TEMPLATE = BIN-KMK
265kmk_mv_DEFS = kmk_builtin_mv=main
266kmk_mv_SOURCES = \
267 kmkbuiltin/mv.c
268
269kmk_printf_TEMPLATE = BIN-KMK
270kmk_printf_DEFS = kmk_builtin_printf=main
271kmk_printf_SOURCES = \
272 kmkbuiltin/printf.c
273
274kmk_rm_TEMPLATE = BIN-KMK
275kmk_rm_DEFS = kmk_builtin_rm=main
276kmk_rm_SOURCES = \
277 kmkbuiltin/rm.c
278
279kmk_redirect_TEMPLATE = BIN-KMK
280kmk_redirect_DEFS = kmk_builtin_redirect=main
281kmk_redirect_SOURCES = \
282 kmkbuiltin/redirect.c
283
284kmk_rmdir_TEMPLATE = BIN-KMK
285kmk_rmdir_DEFS = kmk_builtin_rmdir=main
286kmk_rmdir_SOURCES = \
287 kmkbuiltin/rmdir.c
288
289kmk_test_TEMPLATE = BIN-KMK
290kmk_test_DEFS = kmk_builtin_test=main
291kmk_test_SOURCES = \
292 kmkbuiltin/test.c
293
294kDepIDB_TEMPLATE = BIN-KMK
295kDepIDB_DEFS = kmk_builtin_kDepIDB=main
296kDepIDB_INCS = .
297kDepIDB_LIBS = $(LIB_KDEP)
298kDepIDB_SOURCES = \
299 kmkbuiltin/kDepIDB.c
300
301
302#
303# kmk_gmake - almost plain GNU Make.
304#
305PROGRAMS += kmk_gmake
306
307kmk_gmake_TEMPLATE = BIN-KMK
308kmk_gmake_DEFS = \
309 HAVE_CONFIG_H \
310 NO_ARCHIVES \
311 CONFIG_WITH_TOUPPER_TOLOWER \
312 EXPERIMENTAL
313
314kmk_gmake_SOURCES = \
315 main.c \
316 read.c \
317 hash.c \
318 strcache.c \
319 variable.c \
320 ar.c \
321 arscan.c \
322 commands.c \
323 default.c \
324 dir.c \
325 expand.c \
326 file.c \
327 function.c \
328 implicit.c \
329 job.c \
330 misc.c \
331 remake.c \
332 rule.c \
333 signame.c \
334 version.c \
335 vpath.c \
336 remote-stub.c
337
338
339include $(PATH_KBUILD)/footer.kmk
340
341
342#
343# Use checked in config.h instead of running ./Configure for it.
344#
345config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
346$(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
347 $(MKDIR) -p $(dir $@)
348 $(CP) $^ $@
349
350#
351# Some missing headers.
352#
353$(PATH_TARGET)/fts.h: kmkbuiltin/ftsfake.h | $(call DIRDEP,$(PATH_TARGET))
354 $(CP) $^ $@
355
356$(PATH_TARGET)/unistd.h: | $(call DIRDEP,$(PATH_TARGET))
357 $(ECHO_EXT) > $@
358
359$(PATH_TARGET)/sysexits.h: | $(call DIRDEP,$(PATH_TARGET))
360 $(ECHO_EXT) > $@
361
362$(PATH_TARGET)/inttypes.h: | $(call DIRDEP,$(PATH_TARGET))
363 $(ECHO_EXT) > $@
364
365$(PATH_TARGET)/paths.h: | $(call DIRDEP,$(PATH_TARGET))
366 $(ECHO_EXT) > $@
367
368$(PATH_TARGET)/pwd.h: | $(call DIRDEP,$(PATH_TARGET))
369 $(ECHO_EXT) > $@
370
371$(PATH_TARGET)/grp.h: | $(call DIRDEP,$(PATH_TARGET))
372 $(ECHO_EXT) > $@
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
430test_if1of:
431 $(MAKE) -f testcase-if1of.kmk
432
433test_local:
434 $(MAKE) -f testcase-local.kmk
435
436test_all: test_math test_stack test_shell test_if1of test_local
437
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