VirtualBox

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

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

combined the bulk of the cmp stuff into cmp_util.c. implemented cp --changed.

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