VirtualBox

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

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

New feature: if1of and ifn1of (CONFIG_WITH_SET_CONDITIONALS).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
1# $Id: Makefile.kmk 1109 2007-09-24 02:27: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)
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/cp.c \
161 kmkbuiltin/cp_utils.c \
162 kmkbuiltin/echo.c \
163 kmkbuiltin/install.c \
164 kmkbuiltin/md5sum.c \
165 kmkbuiltin/mkdir.c \
166 kmkbuiltin/mv.c \
167 kmkbuiltin/ln.c \
168 kmkbuiltin/printf.c \
169 kmkbuiltin/rm.c \
170 kmkbuiltin/rmdir.c \
171
172
173#
174# Standalone kmkbuiltin commands.
175#
176## @todo should probably put all those
177PROGRAMS += kmk_append kmk_cat kmk_cp 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_cp_TEMPLATE = BIN-KMK
191kmk_cp_DEFS = kmk_builtin_cp=main
192kmk_cp_SOURCES = \
193 kmkbuiltin/cp.c \
194 kmkbuiltin/cp_utils.c
195
196kmk_echo_TEMPLATE = BIN-KMK
197kmk_echo_DEFS = kmk_builtin_echo=main
198kmk_echo_SOURCES = \
199 kmkbuiltin/echo.c
200
201kmk_install_TEMPLATE = BIN-KMK
202kmk_install_DEFS = kmk_builtin_install=main
203kmk_install_SOURCES = \
204 kmkbuiltin/install.c
205
206kmk_ln_TEMPLATE = BIN-KMK
207kmk_ln_DEFS = kmk_builtin_ln=main
208kmk_ln_SOURCES = \
209 kmkbuiltin/ln.c
210
211kmk_mkdir_TEMPLATE = BIN-KMK
212kmk_mkdir_DEFS = kmk_builtin_mkdir=main
213kmk_mkdir_SOURCES = \
214 kmkbuiltin/mkdir.c
215
216kmk_md5sum_TEMPLATE = BIN-KMK
217kmk_md5sum_DEFS = kmk_builtin_md5sum=main
218kmk_md5sum_SOURCES = \
219 kmkbuiltin/md5sum.c
220kmk_md5sum_LIBS = $(LIB_KUTIL)
221
222kmk_mv_TEMPLATE = BIN-KMK
223kmk_mv_DEFS = kmk_builtin_mv=main
224kmk_mv_SOURCES = \
225 kmkbuiltin/mv.c
226
227kmk_printf_TEMPLATE = BIN-KMK
228kmk_printf_DEFS = kmk_builtin_printf=main
229kmk_printf_SOURCES = \
230 kmkbuiltin/printf.c
231
232kmk_rm_TEMPLATE = BIN-KMK
233kmk_rm_DEFS = kmk_builtin_rm=main
234kmk_rm_SOURCES = \
235 kmkbuiltin/rm.c
236
237kmk_rmdir_TEMPLATE = BIN-KMK
238kmk_rmdir_DEFS = kmk_builtin_rmdir=main
239kmk_rmdir_SOURCES = \
240 kmkbuiltin/rmdir.c
241
242
243#
244# kmk_gmake - almost plain GNU Make.
245#
246PROGRAMS += kmk_gmake
247
248kmk_gmake_TEMPLATE = BIN-KMK
249kmk_gmake_DEFS = \
250 HAVE_CONFIG_H \
251 NO_ARCHIVES \
252 CONFIG_WITH_TOUPPER_TOLOWER \
253 EXPERIMENTAL
254
255kmk_gmake_SOURCES = \
256 main.c \
257 read.c \
258 hash.c \
259 strcache.c \
260 variable.c \
261 ar.c \
262 arscan.c \
263 commands.c \
264 default.c \
265 dir.c \
266 expand.c \
267 file.c \
268 function.c \
269 implicit.c \
270 job.c \
271 misc.c \
272 remake.c \
273 rule.c \
274 signame.c \
275 version.c \
276 vpath.c \
277 remote-stub.c
278
279
280include $(PATH_KBUILD)/footer.kmk
281
282
283#
284# Use checked in config.h instead of running ./Configure for it.
285#
286config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
287$(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
288 $(MKDIR) -p $(dir $@)
289 $(CP) $^ $@
290
291#
292# Some missing headers.
293#
294$(PATH_TARGET)/fts.h: kmkbuiltin/ftsfake.h | $(call DIRDEP,$(PATH_TARGET))
295 $(CP) $^ $@
296
297$(PATH_TARGET)/unistd.h: | $(call DIRDEP,$(PATH_TARGET))
298 $(ECHO_EXT) > $@
299
300$(PATH_TARGET)/sysexits.h: | $(call DIRDEP,$(PATH_TARGET))
301 $(ECHO_EXT) > $@
302
303$(PATH_TARGET)/inttypes.h: | $(call DIRDEP,$(PATH_TARGET))
304 $(ECHO_EXT) > $@
305
306$(PATH_TARGET)/paths.h: | $(call DIRDEP,$(PATH_TARGET))
307 $(ECHO_EXT) > $@
308
309$(PATH_TARGET)/pwd.h: | $(call DIRDEP,$(PATH_TARGET))
310 $(ECHO_EXT) > $@
311
312$(PATH_TARGET)/grp.h: | $(call DIRDEP,$(PATH_TARGET))
313 $(ECHO_EXT) > $@
314
315
316#
317# Some tests.
318#
319parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
320parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
321 echo $@_start ; sleep 1; echo $@_done
322
323test:
324 echo "1"
325 echo "2"
326 echo "3"
327 echo "4"
328
329
330#
331# Shell execution tests.
332#
333test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
334
335# shell double and single quoting check (was busted on windows in 3.81).
336test_shell_quoting:
337 $(ECHO_EXT) "double quoted sTrInG"
338 $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
339 $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
340 $(ECHO) "This string should not be printed with double quotes."
341 $(ECHO) 'This string should not be printed with single quotes.'
342 ( echo " #define PWD \"`pwd`\""; )
343
344test_shell_double_quoting:
345 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
346 "s/foo/$@/" -e \
347 "s/foo/works/" \
348 -e "s/foo/\!/"
349
350test_shell_double_quoting2:
351 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
352 "s/foo/$@/" -e \
353 "s/foo/works/" \
354 -e\
355 "s/foo/\!/"
356
357# when using batch mode shell, the newline got escaped twice and spoiling everything.
358test_shell_newline:
359 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
360 's/foo/$@/' -e \
361 's/foo/works/' \
362 -e 's/foo/\!/'
363
364
365test_stack:
366 $(MAKE) -f testcase-stack.kmk
367
368test_math:
369 $(MAKE) -f testcase-math.kmk
370
371test_if1of:
372 $(MAKE) -f testcase-if1of.kmk
373
374test_all: test_math test_stack test_shell test_if1of
375
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