1 | # $Id: Makefile.kmk 778 2007-01-21 00:29:17Z bird $
|
---|
2 |
|
---|
3 |
|
---|
4 | DEPTH = ../..
|
---|
5 | include $(PATH_KBUILD)/header.kmk
|
---|
6 |
|
---|
7 | #
|
---|
8 | # kmk
|
---|
9 | #
|
---|
10 | PROGRAMS += kmk
|
---|
11 |
|
---|
12 | kmk_TEMPLATE = BIN
|
---|
13 | kmk_DEPS = $(PATH_TARGET)/config.h
|
---|
14 | kmk_INCS = $(PATH_TARGET) .
|
---|
15 | kmk_INCS.darwin = glob
|
---|
16 | kmk_INCS.freebsd = glob
|
---|
17 | #ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
18 | #kmk_INCS += kmkbuiltin/w32
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | kmk_DEFS = \
|
---|
22 | HAVE_CONFIG_H \
|
---|
23 | NO_ARCHIVES \
|
---|
24 | CONFIG_NO_DEFAULT_SUFFIXES \
|
---|
25 | CONFIG_NO_DEFAULT_PATTERN_RULES \
|
---|
26 | CONFIG_NO_DEFAULT_TERMINAL_RULES \
|
---|
27 | CONFIG_NO_DEFAULT_SUFFIX_RULES \
|
---|
28 | CONFIG_NO_DEFAULT_VARIABLES \
|
---|
29 | CONFIG_WITH_EXTENDED_NOTPARALLEL \
|
---|
30 | CONFIG_WITH_INCLUDEDEP \
|
---|
31 | CONFIG_WITH_TOUPPER_TOLOWER \
|
---|
32 | CONFIG_WITH_ABSPATHEX \
|
---|
33 | CONFIG_PRETTY_COMMAND_PRINTING \
|
---|
34 | KMK \
|
---|
35 | \
|
---|
36 | KMK_HELPERS \
|
---|
37 | VARIABLE_HASH \
|
---|
38 | CONFIG_WITH_OPTIMIZATION_HACKS \
|
---|
39 | CONFIG_WITH_VALUE_LENGTH \
|
---|
40 | CONFIG_WITH_COMPARE \
|
---|
41 | CONFIG_WITH_STACK \
|
---|
42 | CONFIG_WITH_MATH \
|
---|
43 | EXPERIMENTAL \
|
---|
44 | \
|
---|
45 | BUILD_PLATFORM=\"$(BUILD_TARGET)\" \
|
---|
46 | BUILD_PLATFORM_ARCH=\"$(BUILD_TARGET_ARCH)\" \
|
---|
47 | BUILD_PLATFORM_CPU=\"$(BUILD_TARGET_CPU)\"
|
---|
48 | kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT
|
---|
49 |
|
---|
50 | kmk_SOURCES = \
|
---|
51 | main.c \
|
---|
52 | read.c \
|
---|
53 | hash.c \
|
---|
54 | strcache.c \
|
---|
55 | variable.c \
|
---|
56 | ar.c \
|
---|
57 | arscan.c \
|
---|
58 | commands.c \
|
---|
59 | default.c \
|
---|
60 | dir.c \
|
---|
61 | expand.c \
|
---|
62 | file.c \
|
---|
63 | function.c \
|
---|
64 | implicit.c \
|
---|
65 | job.c \
|
---|
66 | misc.c \
|
---|
67 | remake.c \
|
---|
68 | rule.c \
|
---|
69 | signame.c \
|
---|
70 | version.c \
|
---|
71 | vpath.c \
|
---|
72 | remote-stub.c \
|
---|
73 | kbuild.c
|
---|
74 |
|
---|
75 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
76 | kmk_SOURCES += \
|
---|
77 | getopt.c \
|
---|
78 | getopt1.c \
|
---|
79 | getloadavg.c \
|
---|
80 | w32/subproc/misc.c \
|
---|
81 | w32/subproc/sub_proc.c \
|
---|
82 | w32/subproc/w32err.c \
|
---|
83 | glob/glob.c \
|
---|
84 | glob/fnmatch.c \
|
---|
85 | w32/compat/dirent.c \
|
---|
86 | w32/pathstuff.c
|
---|
87 | endif
|
---|
88 |
|
---|
89 | kmk_SOURCES.freebsd = \
|
---|
90 | glob/glob.c \
|
---|
91 | glob/fnmatch.c
|
---|
92 |
|
---|
93 | kmk_SOURCES.darwin = \
|
---|
94 | glob/glob.c \
|
---|
95 | glob/fnmatch.c
|
---|
96 |
|
---|
97 | #
|
---|
98 | # kmkbuiltin commands
|
---|
99 | #
|
---|
100 | kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
|
---|
101 | kmk_SOURCES += \
|
---|
102 | kmkbuiltin.c \
|
---|
103 | kmkbuiltin/append.c \
|
---|
104 | kmkbuiltin/cat.c \
|
---|
105 | kmkbuiltin/cp.c \
|
---|
106 | kmkbuiltin/cp_utils.c \
|
---|
107 | kmkbuiltin/echo.c \
|
---|
108 | kmkbuiltin/install.c \
|
---|
109 | kmkbuiltin/mkdir.c \
|
---|
110 | kmkbuiltin/mv.c \
|
---|
111 | kmkbuiltin/ln.c \
|
---|
112 | kmkbuiltin/printf.c \
|
---|
113 | kmkbuiltin/rm.c \
|
---|
114 | kmkbuiltin/rmdir.c \
|
---|
115 | \
|
---|
116 | kmkbuiltin/err.c \
|
---|
117 | kmkbuiltin/setmode.c \
|
---|
118 | kmkbuiltin/strmode.c \
|
---|
119 | kmkbuiltin/strlcpy.c
|
---|
120 |
|
---|
121 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
122 | kmk_SOURCES += \
|
---|
123 | kmkbuiltin/mscfakes.c \
|
---|
124 | kmkbuiltin/fts.c
|
---|
125 | endif
|
---|
126 |
|
---|
127 | kmk_SOURCES.darwin += \
|
---|
128 | kmkbuiltin/darwin.c
|
---|
129 |
|
---|
130 |
|
---|
131 | #
|
---|
132 | # Standalone kmkbuiltin commands.
|
---|
133 | #
|
---|
134 | PROGRAMS += kmk_append kmk_cat kmk_cp kmk_echo kmk_mkdir kmk_mv kmk_install kmk_ln kmk_printf kmk_rm kmk_rmdir
|
---|
135 |
|
---|
136 | kmk_append_TEMPLATE = BIN
|
---|
137 | kmk_append_DEFS = kmk_builtin_append=main
|
---|
138 | kmk_append_INCS = .
|
---|
139 | kmk_append_SOURCES = \
|
---|
140 | kmkbuiltin/append.c \
|
---|
141 | kmkbuiltin/err.c
|
---|
142 |
|
---|
143 | kmk_cat_TEMPLATE = BIN
|
---|
144 | kmk_cat_DEFS = kmk_builtin_cat=main
|
---|
145 | kmk_cat_SOURCES = \
|
---|
146 | kmkbuiltin/cat.c \
|
---|
147 | kmkbuiltin/err.c
|
---|
148 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
149 | kmk_cat_INCS += $(PATH_TARGET) .
|
---|
150 | kmk_cat_DEFS += HAVE_CONFIG_H
|
---|
151 | kmk_cat_SOURCES += \
|
---|
152 | kmkbuiltin/mscfakes.c \
|
---|
153 | getopt.c \
|
---|
154 | getopt1.c
|
---|
155 | endif
|
---|
156 |
|
---|
157 | kmk_cp_TEMPLATE = BIN
|
---|
158 | kmk_cp_DEFS = kmk_builtin_cp=main
|
---|
159 | kmk_cp_SOURCES = \
|
---|
160 | kmkbuiltin/cp.c \
|
---|
161 | kmkbuiltin/cp_utils.c \
|
---|
162 | kmkbuiltin/strlcpy.c \
|
---|
163 | kmkbuiltin/err.c
|
---|
164 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
165 | kmk_cp_INCS += $(PATH_TARGET) .
|
---|
166 | kmk_cp_DEFS += HAVE_CONFIG_H
|
---|
167 | kmk_cp_SOURCES += \
|
---|
168 | kmkbuiltin/mscfakes.c \
|
---|
169 | kmkbuiltin/fts.c \
|
---|
170 | w32/compat/dirent.c \
|
---|
171 | getopt.c \
|
---|
172 | getopt1.c
|
---|
173 | endif
|
---|
174 | kmk_cp_SOURCES.darwin = \
|
---|
175 | kmkbuiltin/darwin.c
|
---|
176 |
|
---|
177 | kmk_echo_TEMPLATE = BIN
|
---|
178 | kmk_echo_DEFS = kmk_builtin_echo=main
|
---|
179 | kmk_echo_SOURCES = \
|
---|
180 | kmkbuiltin/echo.c
|
---|
181 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
182 | kmk_echo_SOURCES += \
|
---|
183 | kmkbuiltin/mscfakes.c \
|
---|
184 | kmkbuiltin/err.c
|
---|
185 | endif
|
---|
186 |
|
---|
187 | kmk_install_TEMPLATE = BIN
|
---|
188 | kmk_install_DEFS = kmk_builtin_install=main
|
---|
189 | kmk_install_SOURCES = \
|
---|
190 | kmkbuiltin/install.c \
|
---|
191 | kmkbuiltin/err.c \
|
---|
192 | kmkbuiltin/strmode.c \
|
---|
193 | kmkbuiltin/setmode.c
|
---|
194 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
195 | kmk_install_INCS += $(PATH_TARGET) .
|
---|
196 | kmk_install_DEFS += HAVE_CONFIG_H
|
---|
197 | kmk_install_SOURCES += \
|
---|
198 | kmkbuiltin/mscfakes.c \
|
---|
199 | getopt.c \
|
---|
200 | getopt1.c
|
---|
201 | endif
|
---|
202 |
|
---|
203 | kmk_ln_TEMPLATE = BIN
|
---|
204 | kmk_ln_DEFS = kmk_builtin_ln=main
|
---|
205 | kmk_ln_SOURCES = \
|
---|
206 | kmkbuiltin/ln.c \
|
---|
207 | kmkbuiltin/err.c
|
---|
208 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
209 | kmk_ln_INCS += $(PATH_TARGET) .
|
---|
210 | kmk_ln_DEFS += HAVE_CONFIG_H
|
---|
211 | kmk_ln_SOURCES += \
|
---|
212 | kmkbuiltin/mscfakes.c\
|
---|
213 | getopt.c \
|
---|
214 | getopt1.c
|
---|
215 | endif
|
---|
216 |
|
---|
217 | kmk_mkdir_TEMPLATE = BIN
|
---|
218 | kmk_mkdir_DEFS = kmk_builtin_mkdir=main
|
---|
219 | kmk_mkdir_SOURCES = \
|
---|
220 | kmkbuiltin/mkdir.c \
|
---|
221 | kmkbuiltin/err.c \
|
---|
222 | kmkbuiltin/setmode.c
|
---|
223 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
224 | kmk_mkdir_INCS += $(PATH_TARGET) .
|
---|
225 | kmk_mkdir_DEFS += HAVE_CONFIG_H
|
---|
226 | kmk_mkdir_SOURCES += \
|
---|
227 | kmkbuiltin/mscfakes.c \
|
---|
228 | getopt.c \
|
---|
229 | getopt1.c
|
---|
230 | endif
|
---|
231 |
|
---|
232 | kmk_mv_TEMPLATE = BIN
|
---|
233 | kmk_mv_DEFS = kmk_builtin_mv=main
|
---|
234 | kmk_mv_SOURCES = \
|
---|
235 | kmkbuiltin/mv.c \
|
---|
236 | kmkbuiltin/err.c \
|
---|
237 | kmkbuiltin/strmode.c
|
---|
238 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
239 | kmk_mv_INCS += $(PATH_TARGET) .
|
---|
240 | kmk_mv_DEFS += HAVE_CONFIG_H
|
---|
241 | kmk_mv_SOURCES += \
|
---|
242 | kmkbuiltin/mscfakes.c \
|
---|
243 | getopt.c \
|
---|
244 | getopt1.c
|
---|
245 | endif
|
---|
246 |
|
---|
247 | kmk_printf_TEMPLATE = BIN
|
---|
248 | kmk_printf_DEFS = kmk_builtin_printf=main
|
---|
249 | kmk_printf_SOURCES = \
|
---|
250 | kmkbuiltin/printf.c \
|
---|
251 | kmkbuiltin/err.c
|
---|
252 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
253 | kmk_printf_INCS += $(PATH_TARGET) .
|
---|
254 | kmk_printf_DEFS += HAVE_CONFIG_H
|
---|
255 | kmk_printf_SOURCES += \
|
---|
256 | kmkbuiltin/mscfakes.c \
|
---|
257 | getopt.c \
|
---|
258 | getopt1.c
|
---|
259 | endif
|
---|
260 |
|
---|
261 | kmk_rm_TEMPLATE = BIN
|
---|
262 | kmk_rm_DEFS = kmk_builtin_rm=main
|
---|
263 | kmk_rm_SOURCES = \
|
---|
264 | kmkbuiltin/rm.c \
|
---|
265 | kmkbuiltin/err.c \
|
---|
266 | kmkbuiltin/strmode.c
|
---|
267 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
268 | kmk_rm_INCS += $(PATH_TARGET) .
|
---|
269 | kmk_rm_DEFS += HAVE_CONFIG_H
|
---|
270 | kmk_rm_SOURCES += \
|
---|
271 | kmkbuiltin/mscfakes.c\
|
---|
272 | getopt.c \
|
---|
273 | getopt1.c
|
---|
274 | endif
|
---|
275 |
|
---|
276 | kmk_rmdir_TEMPLATE = BIN
|
---|
277 | kmk_rmdir_DEFS = kmk_builtin_rmdir=main
|
---|
278 | kmk_rmdir_SOURCES = \
|
---|
279 | kmkbuiltin/rmdir.c \
|
---|
280 | kmkbuiltin/err.c \
|
---|
281 | kmkbuiltin/setmode.c
|
---|
282 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
283 | kmk_rmdir_INCS += $(PATH_TARGET) .
|
---|
284 | kmk_rmdir_DEFS += HAVE_CONFIG_H
|
---|
285 | kmk_rmdir_SOURCES += \
|
---|
286 | kmkbuiltin/mscfakes.c \
|
---|
287 | getopt.c \
|
---|
288 | getopt1.c
|
---|
289 | endif
|
---|
290 |
|
---|
291 |
|
---|
292 |
|
---|
293 | #
|
---|
294 | # kmk_gmake - almost plain GNU Make.
|
---|
295 | #
|
---|
296 | PROGRAMS += kmk_gmake
|
---|
297 | kmk_gmake_TEMPLATE = BIN
|
---|
298 | kmk_gmake_DEPS = $(PATH_TARGET)/config.h
|
---|
299 | kmk_gmake_INCS = $(PATH_TARGET) .
|
---|
300 | kmk_gmake_INCS.darwin = glob
|
---|
301 | kmk_gmake_INCS.freebsd = glob
|
---|
302 |
|
---|
303 |
|
---|
304 | kmk_gmake_DEFS = \
|
---|
305 | HAVE_CONFIG_H \
|
---|
306 | NO_ARCHIVES \
|
---|
307 | CONFIG_WITH_TOUPPER_TOLOWER \
|
---|
308 | EXPERIMENTAL
|
---|
309 |
|
---|
310 | kmk_gmake_SOURCES = \
|
---|
311 | main.c \
|
---|
312 | read.c \
|
---|
313 | hash.c \
|
---|
314 | strcache.c \
|
---|
315 | variable.c \
|
---|
316 | ar.c \
|
---|
317 | arscan.c \
|
---|
318 | commands.c \
|
---|
319 | default.c \
|
---|
320 | dir.c \
|
---|
321 | expand.c \
|
---|
322 | file.c \
|
---|
323 | function.c \
|
---|
324 | implicit.c \
|
---|
325 | job.c \
|
---|
326 | misc.c \
|
---|
327 | remake.c \
|
---|
328 | rule.c \
|
---|
329 | signame.c \
|
---|
330 | version.c \
|
---|
331 | vpath.c \
|
---|
332 | remote-stub.c
|
---|
333 |
|
---|
334 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_TARGET)),)
|
---|
335 | kmk_gmake_SOURCES += \
|
---|
336 | getopt.c \
|
---|
337 | getopt1.c \
|
---|
338 | getloadavg.c \
|
---|
339 | w32/subproc/misc.c \
|
---|
340 | w32/subproc/sub_proc.c \
|
---|
341 | w32/subproc/w32err.c \
|
---|
342 | glob/glob.c \
|
---|
343 | glob/fnmatch.c \
|
---|
344 | w32/compat/dirent.c \
|
---|
345 | w32/pathstuff.c
|
---|
346 | endif
|
---|
347 |
|
---|
348 | kmk_gmake_SOURCES.freebsd = \
|
---|
349 | glob/glob.c \
|
---|
350 | glob/fnmatch.c
|
---|
351 |
|
---|
352 | kmk_gmake_SOURCES.darwin = \
|
---|
353 | glob/glob.c \
|
---|
354 | glob/fnmatch.c
|
---|
355 |
|
---|
356 |
|
---|
357 |
|
---|
358 | include $(PATH_KBUILD)/footer.kmk
|
---|
359 |
|
---|
360 |
|
---|
361 | #
|
---|
362 | # Use checked in config.h instead of running ./Configure for it.
|
---|
363 | #
|
---|
364 | config.h.$(BUILD_TARGET) := config.h.$(BUILD_TARGET)
|
---|
365 | config.h.win := config.h.W32
|
---|
366 | config.h.win32 := config.h.W32
|
---|
367 | config.h.win64 := config.h.W32
|
---|
368 | config.h.nt := config.h.W32
|
---|
369 |
|
---|
370 | $(PATH_TARGET)/config.h: $(config.h.$(BUILD_TARGET))
|
---|
371 | $(MKDIR) -p $(dir $@)
|
---|
372 | $(CP) $^ $@
|
---|
373 |
|
---|
374 |
|
---|
375 | #
|
---|
376 | # Some tests.
|
---|
377 | #
|
---|
378 | parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
|
---|
379 | parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
|
---|
380 | echo $@_start ; sleep 1; echo $@_done
|
---|
381 |
|
---|
382 | test:
|
---|
383 | echo "1"
|
---|
384 | echo "2"
|
---|
385 | echo "3"
|
---|
386 | echo "4"
|
---|
387 |
|
---|
388 |
|
---|
389 | #
|
---|
390 | # Shell execution tests.
|
---|
391 | #
|
---|
392 | test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
|
---|
393 |
|
---|
394 | # shell double and single quoting check (was busted on windows in 3.81).
|
---|
395 | test_shell_quoting:
|
---|
396 | $(ECHO_EXT) "double quoted sTrInG"
|
---|
397 | $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
|
---|
398 | $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
|
---|
399 | $(ECHO) "This string should not be printed with double quotes."
|
---|
400 | $(ECHO) 'This string should not be printed with single quotes.'
|
---|
401 | ( echo " #define PWD \"`pwd`\""; )
|
---|
402 |
|
---|
403 | test_shell_double_quoting:
|
---|
404 | $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
|
---|
405 | "s/foo/$@/" -e \
|
---|
406 | "s/foo/works/" \
|
---|
407 | -e "s/foo/\!/"
|
---|
408 |
|
---|
409 | test_shell_double_quoting2:
|
---|
410 | $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
|
---|
411 | "s/foo/$@/" -e \
|
---|
412 | "s/foo/works/" \
|
---|
413 | -e\
|
---|
414 | "s/foo/\!/"
|
---|
415 |
|
---|
416 | # when using batch mode shell, the newline got escaped twice and spoiling everything.
|
---|
417 | test_shell_newline:
|
---|
418 | $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
|
---|
419 | 's/foo/$@/' -e \
|
---|
420 | 's/foo/works/' \
|
---|
421 | -e 's/foo/\!/'
|
---|
422 |
|
---|
423 |
|
---|
424 | test_stack:
|
---|
425 | $(MAKE) -f testcase-stack.kmk
|
---|
426 |
|
---|
427 | test_math:
|
---|
428 | $(MAKE) -f testcase-math.kmk
|
---|
429 |
|
---|
430 |
|
---|
431 | test_all: test_math test_stack test_shell
|
---|