VirtualBox

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

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

kmk_builtin_cmp.

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