1 | # $Id: Makefile.kmk 3572 2022-10-24 08:36:35Z bird $
|
---|
2 | ## @file
|
---|
3 | # Sub-makefile for kmk / GNU Make.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2004-2011 knut st. osmundsen <[email protected]>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 3 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild. If not, see <http://www.gnu.org/licenses/>
|
---|
23 | #
|
---|
24 | #
|
---|
25 |
|
---|
26 | SUB_DEPTH = ../..
|
---|
27 | include $(KBUILD_PATH)/subheader.kmk
|
---|
28 |
|
---|
29 | # Enable new children handling for windows.
|
---|
30 | CONFIG_NEW_WIN_CHILDREN = 1
|
---|
31 |
|
---|
32 | #
|
---|
33 | # Template for kmk and the kmk_* binaries in this makefile.
|
---|
34 | #
|
---|
35 | TEMPLATE_BIN-KMK = Template for src/gmake binaries
|
---|
36 | TEMPLATE_BIN-KMK_EXTENDS = BIN-THREADED
|
---|
37 | TEMPLATE_BIN-KMK_DEFS = \
|
---|
38 | HAVE_CONFIG_H \
|
---|
39 | $(TEMPLATE_BIN_DEFS) \
|
---|
40 | KBUILD_SVN_REV=$(KBUILD_SVN_REV) \
|
---|
41 | KBUILD_TYPE=$(TMP_QUOTE_SLASH)"$(KBUILD_TYPE)$(TMP_QUOTE_SLASH)"
|
---|
42 | TEMPLATE_BIN-KMK_DEPS = \
|
---|
43 | $(kmk_0_OUTDIR)/config.h \
|
---|
44 | $(kmk_0_OUTDIR)/fts.h
|
---|
45 | TEMPLATE_BIN-KMK_CLEAN = $(TEMPLATE_BIN-KMK_DEPS)
|
---|
46 | TEMPLATE_BIN-KMK_DEPS.solaris = \
|
---|
47 | $(kmk_0_OUTDIR)/paths.h
|
---|
48 | TEMPLATE_BIN-KMK_CLEAN.solaris = $(TEMPLATE_BIN-KMK_DEPS.solaris)
|
---|
49 | TEMPLATE_BIN-KMK_DEPS.win = \
|
---|
50 | $(kmk_0_OUTDIR)/sysexits.h \
|
---|
51 | $(kmk_0_OUTDIR)/unistd.h \
|
---|
52 | $(kmk_0_OUTDIR)/paths.h \
|
---|
53 | $(kmk_0_OUTDIR)/grp.h \
|
---|
54 | $(kmk_0_OUTDIR)/pwd.h \
|
---|
55 | $(kmk_0_OUTDIR)/inttypes.h
|
---|
56 | TEMPLATE_BIN-KMK_CFLAGS.win.amd64 = $(TEMPLATE_BIN-THREADED_CFLAGS.win.amd64) -wd4244 -wd4267
|
---|
57 | TEMPLATE_BIN-KMK_CLEAN.win = $(TEMPLATE_BIN-KMK_DEPS.win)
|
---|
58 | TEMPLATE_BIN-KMK_DEFS.debug = $(TEMPLATE_BIN_DEFS.debug) MAKE_MAINTAINER_MODE
|
---|
59 | TEMPLATE_BIN-KMK_INCS = $(kmk_0_OUTDIR) . $(TEMPLATE_BIN-THREADED_INCS)
|
---|
60 | ifneq ($(KBUILD_TARGET),os2)
|
---|
61 | TEMPLATE_BIN-KMK_INCS += glob
|
---|
62 | endif
|
---|
63 | TEMPLATE_BIN-KMK_LIBS = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL)
|
---|
64 | TEMPLATE_BIN-KMK_LIBS.x86 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.x86)
|
---|
65 | TEMPLATE_BIN-KMK_LIBS.amd64 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.amd64)
|
---|
66 | ifdef ELECTRIC_HEAP # for electric heap (see electric.c).
|
---|
67 | ifeq ($(KBUILD_TARGET),win)
|
---|
68 | TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
|
---|
69 | else
|
---|
70 | TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -include $(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
|
---|
71 | endif
|
---|
72 | endif
|
---|
73 | ifdef CONFIG_WITH_ALLOCCACHE_DEBUG
|
---|
74 | TEMPLATE_BIN-KMK_DEFS += CONFIG_WITH_ALLOCCACHE_DEBUG
|
---|
75 | endif
|
---|
76 | ifdef CONFIG_NEW_WIN_CHILDREN
|
---|
77 | TEMPLATE_BIN-KMK_DEFS.win = $(TEMPLATE_BIN_DEFS.win) CONFIG_NEW_WIN_CHILDREN
|
---|
78 | endif
|
---|
79 | # GCC sanitizers.
|
---|
80 | ifdef GCC_SANITIZERS
|
---|
81 | TEMPLATE_BIN-KMK_CFLAGS ?= $(TEMPLATE_BIN-THREADED_CFLAGS)
|
---|
82 | # TEMPLATE_BIN-KMK_CFLAGS += -fsanitize=address -fsanitize=undefined -static-libubsan -D GCC_ADDRESS_SANITIZER
|
---|
83 | TEMPLATE_BIN-KMK_CFLAGS += -fsanitize=address -fsanitize=undefined -D GCC_ADDRESS_SANITIZER
|
---|
84 | TEMPLATE_BIN-KMK_LDFLAGS ?= $(TEMPLATE_BIN-THREADED_LDFLAGS)
|
---|
85 | TEMPLATE_BIN-KMK_LDFLAGS += -fsanitize=address -fsanitize=undefined
|
---|
86 | endif
|
---|
87 |
|
---|
88 | #
|
---|
89 | # Library version of the above.
|
---|
90 | #
|
---|
91 | TEMPLATE_LIB-KMK = Template for src/gmake libraries
|
---|
92 | TEMPLATE_LIB-KMK_EXTENDS = BIN-KMK
|
---|
93 | TEMPLATE_LIB-KMK_POST_CMDS.win = $(NO_SUCH_VARIABLE)
|
---|
94 |
|
---|
95 | #
|
---|
96 | # Template for building standalone built-in utilities.
|
---|
97 | #
|
---|
98 | TEMPLATE_BIN-KMK-BUILTIN = Template for standalone built-in utilies.
|
---|
99 | TEMPLATE_BIN-KMK-BUILTIN_EXTENDS = BIN-KMK
|
---|
100 | TEMPLATE_BIN-KMK-BUILTIN_EXTENDS_BY = appending
|
---|
101 | TEMPLATE_BIN-KMK-BUILTIN_DEFS += KMK_BUILTIN_STANDALONE
|
---|
102 | TEMPLATE_BIN-KMK-BUILTIN_SOURCES += kmkbuiltin/err.c
|
---|
103 |
|
---|
104 | #
|
---|
105 | # A library containing the missing features needed by kmk and the
|
---|
106 | # kmk_* binaries. Saves a bit of work later on.
|
---|
107 | #
|
---|
108 | LIBRARIES += kmkmissing
|
---|
109 | kmkmissing_TEMPLATE = LIB-KMK
|
---|
110 | kmkmissing_DEFS = KMK
|
---|
111 | kmkmissing_NOINST = 1
|
---|
112 | kmkmissing_SOURCES = \
|
---|
113 | kmkbuiltin/fts.c \
|
---|
114 | kmkbuiltin/setmode.c \
|
---|
115 | kmkbuiltin/strmode.c \
|
---|
116 | kmkbuiltin/kbuild_protection.c \
|
---|
117 | kmkbuiltin/common-env-and-cwd-opt.c \
|
---|
118 | kmkbuiltin/getopt_r.c \
|
---|
119 | kmkbuiltin/getopt1_r.c \
|
---|
120 | getopt.c \
|
---|
121 | getopt1.c \
|
---|
122 | electric.c
|
---|
123 | ifneq ($(KBUILD_TARGET),os2)
|
---|
124 | kmkmissing_SOURCES += \
|
---|
125 | glob/glob.c
|
---|
126 | endif
|
---|
127 |
|
---|
128 | kmkmissing_SOURCES.darwin = \
|
---|
129 | kmkbuiltin/darwin.c \
|
---|
130 | glob/fnmatch.c
|
---|
131 |
|
---|
132 | kmkmissing_SOURCES.dragonfly = \
|
---|
133 | glob/fnmatch.c
|
---|
134 |
|
---|
135 | kmkmissing_SOURCES.freebsd = \
|
---|
136 | glob/fnmatch.c
|
---|
137 |
|
---|
138 | kmkmissing_SOURCES.gnuhurd += \
|
---|
139 | kmkbuiltin/strlcpy.c
|
---|
140 |
|
---|
141 | kmkmissing_SOURCES.gnukfbsd += \
|
---|
142 | kmkbuiltin/strlcpy.c
|
---|
143 |
|
---|
144 | kmkmissing_SOURCES.gnuknbsd += \
|
---|
145 | kmkbuiltin/strlcpy.c
|
---|
146 |
|
---|
147 | kmkmissing_SOURCES.haiku = \
|
---|
148 | kmkbuiltin/haikufakes.c \
|
---|
149 | glob/fnmatch.c
|
---|
150 |
|
---|
151 | kmkmissing_SOURCES.linux += \
|
---|
152 | kmkbuiltin/strlcpy.c
|
---|
153 |
|
---|
154 | kmkmissing_SOURCES.netbsd = \
|
---|
155 | glob/fnmatch.c
|
---|
156 |
|
---|
157 | kmkmissing_SOURCES.openbsd = \
|
---|
158 | kmkbuiltin/openbsd.c
|
---|
159 |
|
---|
160 | kmkmissing_SOURCES.solaris = \
|
---|
161 | kmkbuiltin/strlcpy.c \
|
---|
162 | kmkbuiltin/solfakes.c \
|
---|
163 | glob/fnmatch.c
|
---|
164 |
|
---|
165 | kmkmissing_SOURCES.win += \
|
---|
166 | kmkbuiltin/strlcpy.c \
|
---|
167 | kmkbuiltin/mscfakes.c \
|
---|
168 | glob/fnmatch.c \
|
---|
169 | getloadavg.c \
|
---|
170 | w32/subproc/misc.c \
|
---|
171 | w32/subproc/w32err.c \
|
---|
172 | w32/pathstuff.c \
|
---|
173 | w32/imagecache.c \
|
---|
174 | w32/compat/posixfcn.c
|
---|
175 |
|
---|
176 | #
|
---|
177 | # kmk
|
---|
178 | #
|
---|
179 | PROGRAMS += kmk
|
---|
180 |
|
---|
181 | kmk_TEMPLATE = BIN-KMK
|
---|
182 |
|
---|
183 | kmk_DEFS = \
|
---|
184 | NO_ARCHIVES \
|
---|
185 | EXPERIMENTAL \
|
---|
186 | CONFIG_WITH_TOUPPER_TOLOWER \
|
---|
187 | CONFIG_WITH_DEFINED \
|
---|
188 | CONFIG_WITH_EXPLICIT_MULTITARGET \
|
---|
189 | CONFIG_WITH_DOT_MUST_MAKE \
|
---|
190 | CONFIG_WITH_PREPEND_ASSIGNMENT \
|
---|
191 | CONFIG_WITH_LOCAL_VARIABLES \
|
---|
192 | CONFIG_WITH_2ND_TARGET_EXPANSION \
|
---|
193 | CONFIG_WITH_ALLOC_CACHES \
|
---|
194 | CONFIG_WITH_STRCACHE2 \
|
---|
195 | \
|
---|
196 | KMK \
|
---|
197 | KMK_HELPERS \
|
---|
198 | CONFIG_NO_DEFAULT_SUFFIXES \
|
---|
199 | CONFIG_NO_DEFAULT_PATTERN_RULES \
|
---|
200 | CONFIG_NO_DEFAULT_TERMINAL_RULES \
|
---|
201 | CONFIG_NO_DEFAULT_SUFFIX_RULES \
|
---|
202 | CONFIG_NO_DEFAULT_VARIABLES \
|
---|
203 | \
|
---|
204 | CONFIG_WITH_ABSPATHEX \
|
---|
205 | CONFIG_WITH_COMMANDS_FUNC \
|
---|
206 | CONFIG_WITH_DATE \
|
---|
207 | CONFIG_WITH_DEFINED_FUNCTIONS \
|
---|
208 | CONFIG_WITH_EVALPLUS \
|
---|
209 | CONFIG_WITH_FILE_SIZE \
|
---|
210 | CONFIG_WITH_LOOP_FUNCTIONS \
|
---|
211 | CONFIG_WITH_MATH \
|
---|
212 | CONFIG_WITH_NANOTS \
|
---|
213 | CONFIG_WITH_ROOT_FUNC \
|
---|
214 | CONFIG_WITH_RSORT \
|
---|
215 | CONFIG_WITH_STACK \
|
---|
216 | CONFIG_WITH_STRING_FUNCTIONS \
|
---|
217 | CONFIG_WITH_WHERE_FUNCTION \
|
---|
218 | CONFIG_WITH_WHICH \
|
---|
219 | CONFIG_WITH_XARGS \
|
---|
220 | \
|
---|
221 | CONFIG_WITH_EXTENDED_NOTPARALLEL \
|
---|
222 | CONFIG_WITH_INCLUDEDEP \
|
---|
223 | CONFIG_WITH_VALUE_LENGTH \
|
---|
224 | CONFIG_WITH_COMPARE \
|
---|
225 | CONFIG_WITH_SET_CONDITIONALS \
|
---|
226 | CONFIG_WITH_IF_CONDITIONALS \
|
---|
227 | CONFIG_WITH_PRINTF \
|
---|
228 | CONFIG_WITH_MINIMAL_STATS \
|
---|
229 | \
|
---|
230 | CONFIG_PRETTY_COMMAND_PRINTING \
|
---|
231 | CONFIG_WITH_PRINT_STATS_SWITCH \
|
---|
232 | CONFIG_WITH_PRINT_TIME_SWITCH \
|
---|
233 | CONFIG_WITH_RDONLY_VARIABLE_VALUE \
|
---|
234 | CONFIG_WITH_LAZY_DEPS_VARS \
|
---|
235 | CONFIG_WITH_MEMORY_OPTIMIZATIONS \
|
---|
236 | \
|
---|
237 | KBUILD_HOST=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET)$(TMP_QUOTE_SLASH)" \
|
---|
238 | KBUILD_HOST_ARCH=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET_ARCH)$(TMP_QUOTE_SLASH)" \
|
---|
239 | KBUILD_HOST_CPU=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET_CPU)$(TMP_QUOTE_SLASH)"
|
---|
240 | # kmk_DEFS += CONFIG_WITH_COMPILER # experimental, doesn't work 101% right it seems.
|
---|
241 | kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS
|
---|
242 | kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS
|
---|
243 | kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT CONFIG_WITH_OUTPUT_IN_MEMORY
|
---|
244 | kmk_DEFS.debug = CONFIG_WITH_MAKE_STATS
|
---|
245 | ifdef CONFIG_WITH_MAKE_STATS
|
---|
246 | kmk_DEFS += CONFIG_WITH_MAKE_STATS
|
---|
247 | endif
|
---|
248 | #ifdef CONFIG_WITH_KMK_BUILTIN_STATS
|
---|
249 | kmk_DEFS += CONFIG_WITH_KMK_BUILTIN_STATS
|
---|
250 | #endif
|
---|
251 | ifdef CONFIG_WITH_EVAL_COMPILER
|
---|
252 | kmk_DEFS += CONFIG_WITH_EVAL_COMPILER
|
---|
253 | endif
|
---|
254 | ifdef CONFIG_WITH_COMPILE_EVERYTHING
|
---|
255 | kmk_DEFS += CONFIG_WITH_COMPILE_EVERYTHING
|
---|
256 | endif
|
---|
257 |
|
---|
258 | #ifeq ($(KBUILD_TYPE).$(USERNAME),debug.bird)
|
---|
259 | # kmk_DEFS += CONFIG_WITH_COMPILER CONFIG_WITH_EVAL_COMPILER CONFIG_WITH_COMPILE_EVERYTHING
|
---|
260 | #endif
|
---|
261 |
|
---|
262 | kmk_SOURCES = \
|
---|
263 | main.c \
|
---|
264 | read.c \
|
---|
265 | hash.c \
|
---|
266 | strcache.c \
|
---|
267 | variable.c \
|
---|
268 | ar.c \
|
---|
269 | arscan.c \
|
---|
270 | commands.c \
|
---|
271 | default.c \
|
---|
272 | expand.c \
|
---|
273 | file.c \
|
---|
274 | function.c \
|
---|
275 | implicit.c \
|
---|
276 | job.c \
|
---|
277 | misc.c \
|
---|
278 | output.c \
|
---|
279 | remake.c \
|
---|
280 | rule.c \
|
---|
281 | signame.c \
|
---|
282 | version.c \
|
---|
283 | vpath.c \
|
---|
284 | remote-stub.c \
|
---|
285 | guile.c \
|
---|
286 | load.c \
|
---|
287 | \
|
---|
288 | alloccache.c \
|
---|
289 | expreval.c \
|
---|
290 | incdep.c \
|
---|
291 | strcache2.c \
|
---|
292 | kmk_cc_exec.c \
|
---|
293 | kbuild.c \
|
---|
294 | kbuild-object.c
|
---|
295 | ifeq ($(KBUILD_TARGET),win)
|
---|
296 | kmk_SOURCES += \
|
---|
297 | dir-nt-bird.c \
|
---|
298 | w32/w32os.c
|
---|
299 | else
|
---|
300 | kmk_SOURCES += \
|
---|
301 | dir.c \
|
---|
302 | posixos.c
|
---|
303 | endif
|
---|
304 |
|
---|
305 | ifndef CONFIG_NEW_WIN_CHILDREN
|
---|
306 | kmk_SOURCES.win = \
|
---|
307 | w32/subproc/sub_proc.c
|
---|
308 | else
|
---|
309 | kmk_SOURCES.win = \
|
---|
310 | w32/winchildren.c
|
---|
311 | endif
|
---|
312 |
|
---|
313 | kmk_DEFS.freebsd.x86 = CONFIG_WITHOUT_THREADS
|
---|
314 |
|
---|
315 | #kmk_LIBS.solaris = malloc
|
---|
316 | #kmk_DEFS.solaris += HAVE_MALLINFO
|
---|
317 |
|
---|
318 | #
|
---|
319 | # kmkbuiltin commands
|
---|
320 | #
|
---|
321 | kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
|
---|
322 | kmk_LIBS += $(LIB_KUTIL) #$(LIB_KDEP)
|
---|
323 | kmk_SOURCES += \
|
---|
324 | kmkbuiltin.c \
|
---|
325 | kmkbuiltin/append.c \
|
---|
326 | kmkbuiltin/cat.c \
|
---|
327 | kmkbuiltin/chmod.c \
|
---|
328 | kmkbuiltin/cmp.c \
|
---|
329 | kmkbuiltin/cmp_util.c \
|
---|
330 | kmkbuiltin/cp.c \
|
---|
331 | kmkbuiltin/cp_utils.c \
|
---|
332 | kmkbuiltin/echo.c \
|
---|
333 | kmkbuiltin/expr.c \
|
---|
334 | kmkbuiltin/install.c \
|
---|
335 | kmkbuiltin/kDepIDB.c \
|
---|
336 | kmkbuiltin/kDepObj.c \
|
---|
337 | ../lib/kDep.c \
|
---|
338 | kmkbuiltin/md5sum.c \
|
---|
339 | kmkbuiltin/mkdir.c \
|
---|
340 | kmkbuiltin/mv.c \
|
---|
341 | kmkbuiltin/ln.c \
|
---|
342 | kmkbuiltin/printf.c \
|
---|
343 | kmkbuiltin/redirect.c \
|
---|
344 | kmkbuiltin/rm.c \
|
---|
345 | kmkbuiltin/rmdir.c \
|
---|
346 | $(if-expr $(KBUILD_TARGET) == win,kmkbuiltin/kSubmit.c) \
|
---|
347 | kmkbuiltin/sleep.c \
|
---|
348 | kmkbuiltin/test.c \
|
---|
349 | kmkbuiltin/touch.c \
|
---|
350 | \
|
---|
351 | kmkbuiltin/err.c
|
---|
352 | kmk_SOURCES.win += \
|
---|
353 | kmkbuiltin/kill.c
|
---|
354 |
|
---|
355 |
|
---|
356 | ## @todo kmkbuiltin/redirect.c
|
---|
357 |
|
---|
358 | ## Some profiling
|
---|
359 | #kmk_SOURCES += kbuildprf.c
|
---|
360 | #kmk_DEFS += open=prf_open read=prf_read lseek=prf_lseek close=prf_close
|
---|
361 | ##kmk_DEFS += KMK_PRF=1
|
---|
362 | ##kmkmissing_DEFS += KMK_PRF=1
|
---|
363 |
|
---|
364 | #
|
---|
365 | # Standalone kmkbuiltin commands.
|
---|
366 | #
|
---|
367 | PROGRAMS += \
|
---|
368 | kmk_append \
|
---|
369 | kmk_cat \
|
---|
370 | kmk_chmod \
|
---|
371 | kmk_cp \
|
---|
372 | kmk_cmp \
|
---|
373 | kmk_echo \
|
---|
374 | kmk_expr \
|
---|
375 | kmk_md5sum \
|
---|
376 | kmk_mkdir \
|
---|
377 | kmk_mv \
|
---|
378 | kmk_install \
|
---|
379 | kmk_ln \
|
---|
380 | kmk_printf \
|
---|
381 | kmk_redirect \
|
---|
382 | kmk_rm \
|
---|
383 | kmk_rmdir \
|
---|
384 | kmk_sleep \
|
---|
385 | kmk_test \
|
---|
386 | kmk_touch \
|
---|
387 | kDepIDB \
|
---|
388 | kDepObj
|
---|
389 | PROGRAMS.win += \
|
---|
390 | kmk_kill
|
---|
391 |
|
---|
392 | kmk_append_TEMPLATE = BIN-KMK-BUILTIN
|
---|
393 | kmk_append_INCS = .
|
---|
394 | kmk_append_SOURCES = \
|
---|
395 | kmkbuiltin/append.c
|
---|
396 |
|
---|
397 | kmk_cat_TEMPLATE = BIN-KMK-BUILTIN
|
---|
398 | kmk_cat_SOURCES = \
|
---|
399 | kmkbuiltin/cat.c
|
---|
400 |
|
---|
401 | kmk_chmod_TEMPLATE = BIN-KMK-BUILTIN
|
---|
402 | kmk_chmod_SOURCES = \
|
---|
403 | kmkbuiltin/chmod.c
|
---|
404 |
|
---|
405 | kmk_cmp_TEMPLATE = BIN-KMK-BUILTIN
|
---|
406 | kmk_cmp_SOURCES = \
|
---|
407 | kmkbuiltin/cmp.c \
|
---|
408 | kmkbuiltin/cmp_util.c
|
---|
409 |
|
---|
410 | kmk_cp_TEMPLATE = BIN-KMK-BUILTIN
|
---|
411 | kmk_cp_SOURCES = \
|
---|
412 | kmkbuiltin/cp.c \
|
---|
413 | kmkbuiltin/cp_utils.c \
|
---|
414 | kmkbuiltin/cmp_util.c
|
---|
415 |
|
---|
416 | kmk_echo_TEMPLATE = BIN-KMK-BUILTIN
|
---|
417 | kmk_echo_SOURCES = \
|
---|
418 | kmkbuiltin/echo.c
|
---|
419 |
|
---|
420 | kmk_expr_TEMPLATE = BIN-KMK-BUILTIN
|
---|
421 | kmk_expr_SOURCES = \
|
---|
422 | kmkbuiltin/expr.c
|
---|
423 |
|
---|
424 | kmk_install_TEMPLATE = BIN-KMK-BUILTIN
|
---|
425 | kmk_install_SOURCES = \
|
---|
426 | kmkbuiltin/install.c
|
---|
427 |
|
---|
428 | kmk_kill_TEMPLATE = BIN-KMK-BUILTIN
|
---|
429 | kmk_kill_SOURCES = \
|
---|
430 | kmkbuiltin/kill.c
|
---|
431 |
|
---|
432 | kmk_ln_TEMPLATE = BIN-KMK-BUILTIN
|
---|
433 | kmk_ln_SOURCES = \
|
---|
434 | kmkbuiltin/ln.c
|
---|
435 |
|
---|
436 | kmk_mkdir_TEMPLATE = BIN-KMK-BUILTIN
|
---|
437 | kmk_mkdir_SOURCES = \
|
---|
438 | kmkbuiltin/mkdir.c
|
---|
439 |
|
---|
440 | kmk_md5sum_TEMPLATE = BIN-KMK-BUILTIN
|
---|
441 | kmk_md5sum_SOURCES = \
|
---|
442 | kmkbuiltin/md5sum.c
|
---|
443 | kmk_md5sum_LIBS = $(LIB_KUTIL)
|
---|
444 |
|
---|
445 | kmk_mv_TEMPLATE = BIN-KMK-BUILTIN
|
---|
446 | kmk_mv_SOURCES = \
|
---|
447 | kmkbuiltin/mv.c
|
---|
448 |
|
---|
449 | kmk_printf_TEMPLATE = BIN-KMK-BUILTIN
|
---|
450 | kmk_printf_SOURCES = \
|
---|
451 | kmkbuiltin/printf.c
|
---|
452 |
|
---|
453 | kmk_rm_TEMPLATE = BIN-KMK-BUILTIN
|
---|
454 | kmk_rm_SOURCES = \
|
---|
455 | kmkbuiltin/rm.c
|
---|
456 |
|
---|
457 | kmk_redirect_TEMPLATE = BIN-KMK-BUILTIN
|
---|
458 | kmk_redirect_SOURCES = \
|
---|
459 | kmkbuiltin/redirect.c
|
---|
460 | kmk_redirect_SOURCES.win = \
|
---|
461 | ../lib/startuphacks-win.c
|
---|
462 |
|
---|
463 | kmk_rmdir_TEMPLATE = BIN-KMK-BUILTIN
|
---|
464 | kmk_rmdir_SOURCES = \
|
---|
465 | kmkbuiltin/rmdir.c
|
---|
466 |
|
---|
467 | kmk_sleep_TEMPLATE = BIN-KMK-BUILTIN
|
---|
468 | kmk_sleep_SOURCES = \
|
---|
469 | kmkbuiltin/sleep.c
|
---|
470 |
|
---|
471 | kmk_test_TEMPLATE = BIN-KMK-BUILTIN
|
---|
472 | kmk_test_SOURCES = \
|
---|
473 | kmkbuiltin/test.c
|
---|
474 |
|
---|
475 | kmk_touch_TEMPLATE = BIN-KMK-BUILTIN
|
---|
476 | kmk_touch_SOURCES = \
|
---|
477 | kmkbuiltin/touch.c
|
---|
478 |
|
---|
479 | kDepIDB_TEMPLATE = BIN-KMK-BUILTIN
|
---|
480 | kDepIDB_INCS = .
|
---|
481 | kDepIDB_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
|
---|
482 | kDepIDB_SOURCES = \
|
---|
483 | kmkbuiltin/kDepIDB.c
|
---|
484 |
|
---|
485 | kDepObj_TEMPLATE = BIN-KMK-BUILTIN
|
---|
486 | kDepObj_INCS = .
|
---|
487 | kDepObj_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
|
---|
488 | kDepObj_SOURCES = \
|
---|
489 | kmkbuiltin/kDepObj.c
|
---|
490 |
|
---|
491 |
|
---|
492 | #
|
---|
493 | # kmk_gmake - almost plain GNU Make.
|
---|
494 | #
|
---|
495 | PROGRAMS += kmk_gmake
|
---|
496 |
|
---|
497 | kmk_gmake_TEMPLATE = BIN-KMK
|
---|
498 | kmk_gmake_DEFS = \
|
---|
499 | HAVE_CONFIG_H \
|
---|
500 | CONFIG_WITH_TOUPPER_TOLOWER \
|
---|
501 | EXPERIMENTAL
|
---|
502 | # NO_ARCHIVES
|
---|
503 |
|
---|
504 | kmk_gmake_SOURCES = \
|
---|
505 | main.c \
|
---|
506 | read.c \
|
---|
507 | hash.c \
|
---|
508 | strcache.c \
|
---|
509 | variable.c \
|
---|
510 | ar.c \
|
---|
511 | arscan.c \
|
---|
512 | commands.c \
|
---|
513 | default.c \
|
---|
514 | dir.c \
|
---|
515 | expand.c \
|
---|
516 | file.c \
|
---|
517 | function.c \
|
---|
518 | implicit.c \
|
---|
519 | job.c \
|
---|
520 | misc.c \
|
---|
521 | output.c \
|
---|
522 | remake.c \
|
---|
523 | rule.c \
|
---|
524 | signame.c \
|
---|
525 | version.c \
|
---|
526 | vpath.c \
|
---|
527 | remote-stub.c \
|
---|
528 | guile.c \
|
---|
529 | load.c
|
---|
530 | ifeq ($(KBUILD_TARGET),win)
|
---|
531 | kmk_gmake_SOURCES += \
|
---|
532 | w32/w32os.c
|
---|
533 | else
|
---|
534 | kmk_gmake_SOURCES += \
|
---|
535 | posixos.c
|
---|
536 | endif
|
---|
537 |
|
---|
538 | ifndef CONFIG_NEW_WIN_CHILDREN
|
---|
539 | kmk_gmake_SOURCES.win = \
|
---|
540 | w32/subproc/sub_proc.c
|
---|
541 | else
|
---|
542 | kmk_gmake_SOURCES.win = \
|
---|
543 | w32/winchildren.c
|
---|
544 | endif
|
---|
545 |
|
---|
546 |
|
---|
547 | #
|
---|
548 | # kmk_fmake - Faster GNU Make.
|
---|
549 | #
|
---|
550 | ifeq ($(USER),bird) # for experimental purposes only.
|
---|
551 | PROGRAMS += kmk_fgmake
|
---|
552 | endif
|
---|
553 |
|
---|
554 | kmk_fgmake_TEMPLATE = BIN-KMK
|
---|
555 | kmk_fgmake_DEFS = \
|
---|
556 | HAVE_CONFIG_H \
|
---|
557 | NO_ARCHIVES \
|
---|
558 | CONFIG_WITH_TOUPPER_TOLOWER \
|
---|
559 | EXPERIMENTAL \
|
---|
560 | \
|
---|
561 | CONFIG_WITH_ALLOC_CACHES \
|
---|
562 | CONFIG_WITH_LAZY_DEPS_VARS \
|
---|
563 | CONFIG_WITH_STRCACHE2 \
|
---|
564 | CONFIG_WITH_VALUE_LENGTH \
|
---|
565 | CONFIG_WITH_RDONLY_VARIABLE_VALUE
|
---|
566 | # TODO ?
|
---|
567 | # CONFIG_WITH_PRINT_STATS_SWITCH \
|
---|
568 | # CONFIG_WITH_EXTENDED_NOTPARALLEL \
|
---|
569 |
|
---|
570 | kmk_fgmake_SOURCES = \
|
---|
571 | main.c \
|
---|
572 | read.c \
|
---|
573 | hash.c \
|
---|
574 | strcache.c \
|
---|
575 | strcache2.c \
|
---|
576 | variable.c \
|
---|
577 | ar.c \
|
---|
578 | arscan.c \
|
---|
579 | commands.c \
|
---|
580 | default.c \
|
---|
581 | dir.c \
|
---|
582 | expand.c \
|
---|
583 | file.c \
|
---|
584 | function.c \
|
---|
585 | implicit.c \
|
---|
586 | job.c \
|
---|
587 | misc.c \
|
---|
588 | output.c \
|
---|
589 | alloccache.c \
|
---|
590 | remake.c \
|
---|
591 | rule.c \
|
---|
592 | signame.c \
|
---|
593 | version.c \
|
---|
594 | vpath.c \
|
---|
595 | remote-stub.c \
|
---|
596 | guile.c \
|
---|
597 | load.c
|
---|
598 | ifeq ($(KBUILD_TARGET),win)
|
---|
599 | kmk_fgmake_SOURCES += \
|
---|
600 | w32/w32os.c
|
---|
601 | # @todo: dir-nt-bird.c for fgmake
|
---|
602 | else
|
---|
603 | kmk_fgmake_SOURCES += \
|
---|
604 | posixos.c
|
---|
605 | endif
|
---|
606 |
|
---|
607 | kmk_fgmake_SOURCES.win = \
|
---|
608 | w32/subproc/sub_proc.c
|
---|
609 |
|
---|
610 |
|
---|
611 | #
|
---|
612 | # tstFileInfo
|
---|
613 | #
|
---|
614 | PROGRAMS.win += tstFileInfo
|
---|
615 | tstFileInfo_TEMPLATE = BIN
|
---|
616 | tstFileInfo_SOURCES = w32/tstFileInfo.c
|
---|
617 |
|
---|
618 | #
|
---|
619 | # tstFileInfo
|
---|
620 | #
|
---|
621 | PROGRAMS.win += tstFtsFake
|
---|
622 | tstFtsFake_TEMPLATE = BIN-KMK
|
---|
623 | tstFtsFake_NOINST = 1
|
---|
624 | tstFtsFake_DEFS = USE_OLD_FTS
|
---|
625 | tstFtsFake_SOURCES = ../lib/nt/tstNtFts.c
|
---|
626 |
|
---|
627 |
|
---|
628 |
|
---|
629 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
630 |
|
---|
631 |
|
---|
632 | #
|
---|
633 | # Use checked in config.h instead of running ./Configure for it.
|
---|
634 | #
|
---|
635 | kmk_config.h.$(KBUILD_TARGET) := $(kmk_DEFPATH)/config.h.$(KBUILD_TARGET)
|
---|
636 | $(kmk_0_OUTDIR)/config.h: $(kmk_config.h.$(KBUILD_TARGET))
|
---|
637 | $(MKDIR) -p $(dir $@)
|
---|
638 | $(CP) $^ $@
|
---|
639 |
|
---|
640 | #
|
---|
641 | # Some missing headers.
|
---|
642 | #
|
---|
643 | if1of ($(KBUILD_TARGET), win nt)
|
---|
644 | $(kmk_0_OUTDIR)/fts.h: $(MAKEFILE) | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
645 | $(APPEND) -t "$@" "#include <nt/fts-nt.h>"
|
---|
646 | else
|
---|
647 | $(kmk_0_OUTDIR)/fts.h: $(kmk_DEFPATH)/kmkbuiltin/ftsfake.h | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
648 | $(CP) $^ $@
|
---|
649 | endif
|
---|
650 |
|
---|
651 | $(kmk_0_OUTDIR)/unistd.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
652 | $(ECHO_EXT) > $@
|
---|
653 |
|
---|
654 | $(kmk_0_OUTDIR)/sysexits.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
655 | $(ECHO_EXT) > $@
|
---|
656 |
|
---|
657 | $(kmk_0_OUTDIR)/inttypes.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
658 | $(ECHO_EXT) > $@
|
---|
659 |
|
---|
660 | $(kmk_0_OUTDIR)/paths.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
661 | $(ECHO_EXT) > $@
|
---|
662 |
|
---|
663 | $(kmk_0_OUTDIR)/pwd.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
664 | $(ECHO_EXT) > $@
|
---|
665 |
|
---|
666 | $(kmk_0_OUTDIR)/grp.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
|
---|
667 | $(ECHO_EXT) > $@
|
---|
668 |
|
---|
669 |
|
---|
670 | #
|
---|
671 | # Some tests.
|
---|
672 | #
|
---|
673 | parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
|
---|
674 | parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
|
---|
675 | echo $@_start ; sleep 1; echo $@_done
|
---|
676 |
|
---|
677 | my_test:
|
---|
678 | echo "1"
|
---|
679 | echo "2"
|
---|
680 | echo "3"
|
---|
681 | echo "4"
|
---|
682 |
|
---|
683 |
|
---|
684 | #
|
---|
685 | # Shell execution tests.
|
---|
686 | #
|
---|
687 | test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
|
---|
688 |
|
---|
689 | # shell double and single quoting check (was busted on windows in 3.81).
|
---|
690 | test_shell_quoting:
|
---|
691 | $(ECHO_EXT) "double quoted sTrInG"
|
---|
692 | $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
|
---|
693 | $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
|
---|
694 | $(ECHO) "This string should not be printed with double quotes."
|
---|
695 | $(ECHO) 'This string should not be printed with single quotes.'
|
---|
696 | ( echo " #define PWD \"`pwd`\""; )
|
---|
697 |
|
---|
698 | test_shell_double_quoting:
|
---|
699 | $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
|
---|
700 | "s/foo/$@/" -e \
|
---|
701 | "s/foo/works/" \
|
---|
702 | -e "s/foo/\!/"
|
---|
703 |
|
---|
704 | test_shell_double_quoting2:
|
---|
705 | $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
|
---|
706 | "s/foo/$@/" -e \
|
---|
707 | "s/foo/works/" \
|
---|
708 | -e\
|
---|
709 | "s/foo/\!/"
|
---|
710 |
|
---|
711 | # when using batch mode shell, the newline got escaped twice and spoiling everything.
|
---|
712 | test_shell_newline:
|
---|
713 | $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
|
---|
714 | 's/foo/$@/' -e \
|
---|
715 | 's/foo/works/' \
|
---|
716 | -e 's/foo/\!/'
|
---|
717 |
|
---|
718 |
|
---|
719 | test_stack:
|
---|
720 | $(MAKE) -f $(kmk_DEFPATH)/testcase-stack.kmk
|
---|
721 |
|
---|
722 | test_math:
|
---|
723 | $(MAKE) -f $(kmk_DEFPATH)/testcase-math.kmk
|
---|
724 |
|
---|
725 | test_if1of:
|
---|
726 | $(MAKE) -f $(kmk_DEFPATH)/testcase-if1of.kmk
|
---|
727 |
|
---|
728 | test_local:
|
---|
729 | $(MAKE) -f $(kmk_DEFPATH)/testcase-local.kmk
|
---|
730 |
|
---|
731 | test_includedep:
|
---|
732 | $(MAKE) -f $(kmk_DEFPATH)/testcase-includedep.kmk
|
---|
733 |
|
---|
734 | test_root:
|
---|
735 | $(MAKE) -f $(kmk_DEFPATH)/testcase-root.kmk
|
---|
736 |
|
---|
737 | test_2ndtargetexp:
|
---|
738 | $(MAKE) -f $(kmk_DEFPATH)/testcase-2ndtargetexp.kmk
|
---|
739 |
|
---|
740 | test_30_continued_on_failure_worker:
|
---|
741 | this_executable_does_not_exist.exe
|
---|
742 | echo "We shouldn't see this..."
|
---|
743 |
|
---|
744 | test_30_continued_on_failure:
|
---|
745 | $(MAKE) -f $(MAKEFILE) test_30_continued_on_failure_worker; \
|
---|
746 | RC=$$?; \
|
---|
747 | if test $${RC} -ne 2; then \
|
---|
748 | echo "$@: FAILED - exit code $${RC} instead of 2."; \
|
---|
749 | exit 1; \
|
---|
750 | else \
|
---|
751 | echo "$@: SUCCESS"; \
|
---|
752 | fi
|
---|
753 |
|
---|
754 | test_lazy_deps_vars:
|
---|
755 | $(MAKE) -C $(kmk_DEFPATH) -f testcase-lazy-deps-vars.kmk
|
---|
756 |
|
---|
757 |
|
---|
758 | test_all: \
|
---|
759 | test_math \
|
---|
760 | test_stack \
|
---|
761 | test_shell \
|
---|
762 | test_if1of \
|
---|
763 | test_local \
|
---|
764 | test_root \
|
---|
765 | test_includedep \
|
---|
766 | test_2ndtargetexp \
|
---|
767 | test_30_continued_on_failure \
|
---|
768 | test_lazy_deps_vars
|
---|
769 |
|
---|
770 |
|
---|