VirtualBox

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

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

Optimized kDebIDB a bit for Windows; use nt_fullpath and map the IDB file into memory.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.3 KB
Line 
1# $Id: Makefile.kmk 1165 2007-09-30 07:36:23Z 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_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_WITH_DATE \
117 CONFIG_WITH_FILE_SIZE \
118 CONFIG_PRETTY_COMMAND_PRINTING \
119 \
120 BUILD_PLATFORM=\"$(BUILD_TARGET)\" \
121 BUILD_PLATFORM_ARCH=\"$(BUILD_TARGET_ARCH)\" \
122 BUILD_PLATFORM_CPU=\"$(BUILD_TARGET_CPU)\"
123kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS
124kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS
125kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT
126
127kmk_SOURCES = \
128 main.c \
129 read.c \
130 hash.c \
131 strcache.c \
132 variable.c \
133 ar.c \
134 arscan.c \
135 commands.c \
136 default.c \
137 dir.c \
138 expand.c \
139 file.c \
140 function.c \
141 implicit.c \
142 job.c \
143 misc.c \
144 remake.c \
145 rule.c \
146 signame.c \
147 version.c \
148 vpath.c \
149 remote-stub.c \
150 kbuild.c
151
152#
153# kmkbuiltin commands
154#
155kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
156kmk_LIBS += $(LIB_KUTIL) $(LIB_KDEP)
157kmk_SOURCES += \
158 kmkbuiltin.c \
159 kmkbuiltin/append.c \
160 kmkbuiltin/cat.c \
161 kmkbuiltin/cmp.c \
162 kmkbuiltin/cp.c \
163 kmkbuiltin/cp_utils.c \
164 kmkbuiltin/echo.c \
165 kmkbuiltin/install.c \
166 kmkbuiltin/kDepIDB.c \
167 kmkbuiltin/md5sum.c \
168 kmkbuiltin/mkdir.c \
169 kmkbuiltin/mv.c \
170 kmkbuiltin/ln.c \
171 kmkbuiltin/printf.c \
172 kmkbuiltin/rm.c \
173 kmkbuiltin/rmdir.c \
174
175
176#
177# Standalone kmkbuiltin commands.
178#
179PROGRAMS += \
180 kmk_append \
181 kmk_cat \
182 kmk_cp \
183 kmk_cmp \
184 kmk_echo \
185 kmk_md5sum \
186 kmk_mkdir \
187 kmk_mv \
188 kmk_install \
189 kmk_ln \
190 kmk_printf \
191 kmk_rm \
192 kmk_rmdir \
193 kDepIDB \
194
195kmk_append_TEMPLATE = BIN-KMK
196kmk_append_DEFS = kmk_builtin_append=main
197kmk_append_INCS = .
198kmk_append_SOURCES = \
199 kmkbuiltin/append.c
200
201kmk_cat_TEMPLATE = BIN-KMK
202kmk_cat_DEFS = kmk_builtin_cat=main
203kmk_cat_SOURCES = \
204 kmkbuiltin/cat.c
205
206kmk_cmp_TEMPLATE = BIN-KMK
207kmk_cmp_DEFS = kmk_builtin_cmp=main
208kmk_cmp_SOURCES = \
209 kmkbuiltin/cmp.c
210
211kmk_cp_TEMPLATE = BIN-KMK
212kmk_cp_DEFS = kmk_builtin_cp=main
213kmk_cp_SOURCES = \
214 kmkbuiltin/cp.c \
215 kmkbuiltin/cp_utils.c
216
217kmk_echo_TEMPLATE = BIN-KMK
218kmk_echo_DEFS = kmk_builtin_echo=main
219kmk_echo_SOURCES = \
220 kmkbuiltin/echo.c
221
222kmk_install_TEMPLATE = BIN-KMK
223kmk_install_DEFS = kmk_builtin_install=main
224kmk_install_SOURCES = \
225 kmkbuiltin/install.c
226
227kmk_ln_TEMPLATE = BIN-KMK
228kmk_ln_DEFS = kmk_builtin_ln=main
229kmk_ln_SOURCES = \
230 kmkbuiltin/ln.c
231
232kmk_mkdir_TEMPLATE = BIN-KMK
233kmk_mkdir_DEFS = kmk_builtin_mkdir=main
234kmk_mkdir_SOURCES = \
235 kmkbuiltin/mkdir.c
236
237kmk_md5sum_TEMPLATE = BIN-KMK
238kmk_md5sum_DEFS = kmk_builtin_md5sum=main
239kmk_md5sum_SOURCES = \
240 kmkbuiltin/md5sum.c
241kmk_md5sum_LIBS = $(LIB_KUTIL)
242
243kmk_mv_TEMPLATE = BIN-KMK
244kmk_mv_DEFS = kmk_builtin_mv=main
245kmk_mv_SOURCES = \
246 kmkbuiltin/mv.c
247
248kmk_printf_TEMPLATE = BIN-KMK
249kmk_printf_DEFS = kmk_builtin_printf=main
250kmk_printf_SOURCES = \
251 kmkbuiltin/printf.c
252
253kmk_rm_TEMPLATE = BIN-KMK
254kmk_rm_DEFS = kmk_builtin_rm=main
255kmk_rm_SOURCES = \
256 kmkbuiltin/rm.c
257
258kmk_rmdir_TEMPLATE = BIN-KMK
259kmk_rmdir_DEFS = kmk_builtin_rmdir=main
260kmk_rmdir_SOURCES = \
261 kmkbuiltin/rmdir.c
262
263kDepIDB_TEMPLATE = BIN-KMK
264kDepIDB_DEFS = kmk_builtin_kDepIDB=main
265kDepIDB_INCS = .
266kDepIDB_LIBS = $(LIB_KDEP)
267kDepIDB_SOURCES = \
268 kmkbuiltin/kDepIDB.c
269
270
271#
272# kmk_gmake - almost plain GNU Make.
273#
274PROGRAMS += kmk_gmake
275
276kmk_gmake_TEMPLATE = BIN-KMK
277kmk_gmake_DEFS = \
278 HAVE_CONFIG_H \
279 NO_ARCHIVES \
280 CONFIG_WITH_TOUPPER_TOLOWER \
281 EXPERIMENTAL
282
283kmk_gmake_SOURCES = \
284 main.c \
285 read.c \
286 hash.c \
287 strcache.c \
288 variable.c \
289 ar.c \
290 arscan.c \
291 commands.c \
292 default.c \
293 dir.c \
294 expand.c \
295 file.c \
296 function.c \
297 implicit.c \
298 job.c \
299 misc.c \
300 remake.c \
301 rule.c \
302 signame.c \
303 version.c \
304 vpath.c \
305 remote-stub.c
306
307
308include $(PATH_KBUILD)/footer.kmk
309
310
311#
312# Use checked in config.h instead of running ./Configure for it.
313#
314config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
315$(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
316 $(MKDIR) -p $(dir $@)
317 $(CP) $^ $@
318
319#
320# Some missing headers.
321#
322$(PATH_TARGET)/fts.h: kmkbuiltin/ftsfake.h | $(call DIRDEP,$(PATH_TARGET))
323 $(CP) $^ $@
324
325$(PATH_TARGET)/unistd.h: | $(call DIRDEP,$(PATH_TARGET))
326 $(ECHO_EXT) > $@
327
328$(PATH_TARGET)/sysexits.h: | $(call DIRDEP,$(PATH_TARGET))
329 $(ECHO_EXT) > $@
330
331$(PATH_TARGET)/inttypes.h: | $(call DIRDEP,$(PATH_TARGET))
332 $(ECHO_EXT) > $@
333
334$(PATH_TARGET)/paths.h: | $(call DIRDEP,$(PATH_TARGET))
335 $(ECHO_EXT) > $@
336
337$(PATH_TARGET)/pwd.h: | $(call DIRDEP,$(PATH_TARGET))
338 $(ECHO_EXT) > $@
339
340$(PATH_TARGET)/grp.h: | $(call DIRDEP,$(PATH_TARGET))
341 $(ECHO_EXT) > $@
342
343
344#
345# Some tests.
346#
347parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
348parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
349 echo $@_start ; sleep 1; echo $@_done
350
351test:
352 echo "1"
353 echo "2"
354 echo "3"
355 echo "4"
356
357
358#
359# Shell execution tests.
360#
361test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
362
363# shell double and single quoting check (was busted on windows in 3.81).
364test_shell_quoting:
365 $(ECHO_EXT) "double quoted sTrInG"
366 $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
367 $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
368 $(ECHO) "This string should not be printed with double quotes."
369 $(ECHO) 'This string should not be printed with single quotes.'
370 ( echo " #define PWD \"`pwd`\""; )
371
372test_shell_double_quoting:
373 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
374 "s/foo/$@/" -e \
375 "s/foo/works/" \
376 -e "s/foo/\!/"
377
378test_shell_double_quoting2:
379 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
380 "s/foo/$@/" -e \
381 "s/foo/works/" \
382 -e\
383 "s/foo/\!/"
384
385# when using batch mode shell, the newline got escaped twice and spoiling everything.
386test_shell_newline:
387 $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
388 's/foo/$@/' -e \
389 's/foo/works/' \
390 -e 's/foo/\!/'
391
392
393test_stack:
394 $(MAKE) -f testcase-stack.kmk
395
396test_math:
397 $(MAKE) -f testcase-math.kmk
398
399test_if1of:
400 $(MAKE) -f testcase-if1of.kmk
401
402test_all: test_math test_stack test_shell test_if1of
403
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