VirtualBox

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

Last change on this file since 986 was 986, checked in by bird, 18 years ago

New function 'nanots', no arguments.

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