VirtualBox

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

Last change on this file was 3572, checked in by bird, 2 years ago

Config.kmk,src/kmk/Makefile.kmk: Added temporary kludge for inconsistent quoting and escaping of DEFS properties among the compiler tools.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 16.8 KB
Line 
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
26SUB_DEPTH = ../..
27include $(KBUILD_PATH)/subheader.kmk
28
29# Enable new children handling for windows.
30CONFIG_NEW_WIN_CHILDREN = 1
31
32#
33# Template for kmk and the kmk_* binaries in this makefile.
34#
35TEMPLATE_BIN-KMK = Template for src/gmake binaries
36TEMPLATE_BIN-KMK_EXTENDS = BIN-THREADED
37TEMPLATE_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)"
42TEMPLATE_BIN-KMK_DEPS = \
43 $(kmk_0_OUTDIR)/config.h \
44 $(kmk_0_OUTDIR)/fts.h
45TEMPLATE_BIN-KMK_CLEAN = $(TEMPLATE_BIN-KMK_DEPS)
46TEMPLATE_BIN-KMK_DEPS.solaris = \
47 $(kmk_0_OUTDIR)/paths.h
48TEMPLATE_BIN-KMK_CLEAN.solaris = $(TEMPLATE_BIN-KMK_DEPS.solaris)
49TEMPLATE_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
56TEMPLATE_BIN-KMK_CFLAGS.win.amd64 = $(TEMPLATE_BIN-THREADED_CFLAGS.win.amd64) -wd4244 -wd4267
57TEMPLATE_BIN-KMK_CLEAN.win = $(TEMPLATE_BIN-KMK_DEPS.win)
58TEMPLATE_BIN-KMK_DEFS.debug = $(TEMPLATE_BIN_DEFS.debug) MAKE_MAINTAINER_MODE
59TEMPLATE_BIN-KMK_INCS = $(kmk_0_OUTDIR) . $(TEMPLATE_BIN-THREADED_INCS)
60ifneq ($(KBUILD_TARGET),os2)
61 TEMPLATE_BIN-KMK_INCS += glob
62endif
63TEMPLATE_BIN-KMK_LIBS = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL)
64TEMPLATE_BIN-KMK_LIBS.x86 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.x86)
65TEMPLATE_BIN-KMK_LIBS.amd64 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.amd64)
66ifdef ELECTRIC_HEAP # for electric heap (see electric.c).
67ifeq ($(KBUILD_TARGET),win)
68 TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
69else
70 TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -include $(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
71endif
72endif
73ifdef CONFIG_WITH_ALLOCCACHE_DEBUG
74 TEMPLATE_BIN-KMK_DEFS += CONFIG_WITH_ALLOCCACHE_DEBUG
75endif
76ifdef CONFIG_NEW_WIN_CHILDREN
77 TEMPLATE_BIN-KMK_DEFS.win = $(TEMPLATE_BIN_DEFS.win) CONFIG_NEW_WIN_CHILDREN
78endif
79# GCC sanitizers.
80ifdef 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
86endif
87
88#
89# Library version of the above.
90#
91TEMPLATE_LIB-KMK = Template for src/gmake libraries
92TEMPLATE_LIB-KMK_EXTENDS = BIN-KMK
93TEMPLATE_LIB-KMK_POST_CMDS.win = $(NO_SUCH_VARIABLE)
94
95#
96# Template for building standalone built-in utilities.
97#
98TEMPLATE_BIN-KMK-BUILTIN = Template for standalone built-in utilies.
99TEMPLATE_BIN-KMK-BUILTIN_EXTENDS = BIN-KMK
100TEMPLATE_BIN-KMK-BUILTIN_EXTENDS_BY = appending
101TEMPLATE_BIN-KMK-BUILTIN_DEFS += KMK_BUILTIN_STANDALONE
102TEMPLATE_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#
108LIBRARIES += kmkmissing
109kmkmissing_TEMPLATE = LIB-KMK
110kmkmissing_DEFS = KMK
111kmkmissing_NOINST = 1
112kmkmissing_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
123ifneq ($(KBUILD_TARGET),os2)
124kmkmissing_SOURCES += \
125 glob/glob.c
126endif
127
128kmkmissing_SOURCES.darwin = \
129 kmkbuiltin/darwin.c \
130 glob/fnmatch.c
131
132kmkmissing_SOURCES.dragonfly = \
133 glob/fnmatch.c
134
135kmkmissing_SOURCES.freebsd = \
136 glob/fnmatch.c
137
138kmkmissing_SOURCES.gnuhurd += \
139 kmkbuiltin/strlcpy.c
140
141kmkmissing_SOURCES.gnukfbsd += \
142 kmkbuiltin/strlcpy.c
143
144kmkmissing_SOURCES.gnuknbsd += \
145 kmkbuiltin/strlcpy.c
146
147kmkmissing_SOURCES.haiku = \
148 kmkbuiltin/haikufakes.c \
149 glob/fnmatch.c
150
151kmkmissing_SOURCES.linux += \
152 kmkbuiltin/strlcpy.c
153
154kmkmissing_SOURCES.netbsd = \
155 glob/fnmatch.c
156
157kmkmissing_SOURCES.openbsd = \
158 kmkbuiltin/openbsd.c
159
160kmkmissing_SOURCES.solaris = \
161 kmkbuiltin/strlcpy.c \
162 kmkbuiltin/solfakes.c \
163 glob/fnmatch.c
164
165kmkmissing_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#
179PROGRAMS += kmk
180
181kmk_TEMPLATE = BIN-KMK
182
183kmk_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.
241kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS
242kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS
243kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT CONFIG_WITH_OUTPUT_IN_MEMORY
244kmk_DEFS.debug = CONFIG_WITH_MAKE_STATS
245ifdef CONFIG_WITH_MAKE_STATS
246 kmk_DEFS += CONFIG_WITH_MAKE_STATS
247endif
248#ifdef CONFIG_WITH_KMK_BUILTIN_STATS
249 kmk_DEFS += CONFIG_WITH_KMK_BUILTIN_STATS
250#endif
251ifdef CONFIG_WITH_EVAL_COMPILER
252 kmk_DEFS += CONFIG_WITH_EVAL_COMPILER
253endif
254ifdef CONFIG_WITH_COMPILE_EVERYTHING
255 kmk_DEFS += CONFIG_WITH_COMPILE_EVERYTHING
256endif
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
262kmk_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
295ifeq ($(KBUILD_TARGET),win)
296 kmk_SOURCES += \
297 dir-nt-bird.c \
298 w32/w32os.c
299else
300 kmk_SOURCES += \
301 dir.c \
302 posixos.c
303endif
304
305ifndef CONFIG_NEW_WIN_CHILDREN
306kmk_SOURCES.win = \
307 w32/subproc/sub_proc.c
308else
309kmk_SOURCES.win = \
310 w32/winchildren.c
311endif
312
313kmk_DEFS.freebsd.x86 = CONFIG_WITHOUT_THREADS
314
315#kmk_LIBS.solaris = malloc
316#kmk_DEFS.solaris += HAVE_MALLINFO
317
318#
319# kmkbuiltin commands
320#
321kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
322kmk_LIBS += $(LIB_KUTIL) #$(LIB_KDEP)
323kmk_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
352kmk_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#
367PROGRAMS += \
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
389PROGRAMS.win += \
390 kmk_kill
391
392kmk_append_TEMPLATE = BIN-KMK-BUILTIN
393kmk_append_INCS = .
394kmk_append_SOURCES = \
395 kmkbuiltin/append.c
396
397kmk_cat_TEMPLATE = BIN-KMK-BUILTIN
398kmk_cat_SOURCES = \
399 kmkbuiltin/cat.c
400
401kmk_chmod_TEMPLATE = BIN-KMK-BUILTIN
402kmk_chmod_SOURCES = \
403 kmkbuiltin/chmod.c
404
405kmk_cmp_TEMPLATE = BIN-KMK-BUILTIN
406kmk_cmp_SOURCES = \
407 kmkbuiltin/cmp.c \
408 kmkbuiltin/cmp_util.c
409
410kmk_cp_TEMPLATE = BIN-KMK-BUILTIN
411kmk_cp_SOURCES = \
412 kmkbuiltin/cp.c \
413 kmkbuiltin/cp_utils.c \
414 kmkbuiltin/cmp_util.c
415
416kmk_echo_TEMPLATE = BIN-KMK-BUILTIN
417kmk_echo_SOURCES = \
418 kmkbuiltin/echo.c
419
420kmk_expr_TEMPLATE = BIN-KMK-BUILTIN
421kmk_expr_SOURCES = \
422 kmkbuiltin/expr.c
423
424kmk_install_TEMPLATE = BIN-KMK-BUILTIN
425kmk_install_SOURCES = \
426 kmkbuiltin/install.c
427
428kmk_kill_TEMPLATE = BIN-KMK-BUILTIN
429kmk_kill_SOURCES = \
430 kmkbuiltin/kill.c
431
432kmk_ln_TEMPLATE = BIN-KMK-BUILTIN
433kmk_ln_SOURCES = \
434 kmkbuiltin/ln.c
435
436kmk_mkdir_TEMPLATE = BIN-KMK-BUILTIN
437kmk_mkdir_SOURCES = \
438 kmkbuiltin/mkdir.c
439
440kmk_md5sum_TEMPLATE = BIN-KMK-BUILTIN
441kmk_md5sum_SOURCES = \
442 kmkbuiltin/md5sum.c
443kmk_md5sum_LIBS = $(LIB_KUTIL)
444
445kmk_mv_TEMPLATE = BIN-KMK-BUILTIN
446kmk_mv_SOURCES = \
447 kmkbuiltin/mv.c
448
449kmk_printf_TEMPLATE = BIN-KMK-BUILTIN
450kmk_printf_SOURCES = \
451 kmkbuiltin/printf.c
452
453kmk_rm_TEMPLATE = BIN-KMK-BUILTIN
454kmk_rm_SOURCES = \
455 kmkbuiltin/rm.c
456
457kmk_redirect_TEMPLATE = BIN-KMK-BUILTIN
458kmk_redirect_SOURCES = \
459 kmkbuiltin/redirect.c
460kmk_redirect_SOURCES.win = \
461 ../lib/startuphacks-win.c
462
463kmk_rmdir_TEMPLATE = BIN-KMK-BUILTIN
464kmk_rmdir_SOURCES = \
465 kmkbuiltin/rmdir.c
466
467kmk_sleep_TEMPLATE = BIN-KMK-BUILTIN
468kmk_sleep_SOURCES = \
469 kmkbuiltin/sleep.c
470
471kmk_test_TEMPLATE = BIN-KMK-BUILTIN
472kmk_test_SOURCES = \
473 kmkbuiltin/test.c
474
475kmk_touch_TEMPLATE = BIN-KMK-BUILTIN
476kmk_touch_SOURCES = \
477 kmkbuiltin/touch.c
478
479kDepIDB_TEMPLATE = BIN-KMK-BUILTIN
480kDepIDB_INCS = .
481kDepIDB_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
482kDepIDB_SOURCES = \
483 kmkbuiltin/kDepIDB.c
484
485kDepObj_TEMPLATE = BIN-KMK-BUILTIN
486kDepObj_INCS = .
487kDepObj_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
488kDepObj_SOURCES = \
489 kmkbuiltin/kDepObj.c
490
491
492#
493# kmk_gmake - almost plain GNU Make.
494#
495PROGRAMS += kmk_gmake
496
497kmk_gmake_TEMPLATE = BIN-KMK
498kmk_gmake_DEFS = \
499 HAVE_CONFIG_H \
500 CONFIG_WITH_TOUPPER_TOLOWER \
501 EXPERIMENTAL
502# NO_ARCHIVES
503
504kmk_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
530ifeq ($(KBUILD_TARGET),win)
531 kmk_gmake_SOURCES += \
532 w32/w32os.c
533else
534 kmk_gmake_SOURCES += \
535 posixos.c
536endif
537
538ifndef CONFIG_NEW_WIN_CHILDREN
539kmk_gmake_SOURCES.win = \
540 w32/subproc/sub_proc.c
541else
542kmk_gmake_SOURCES.win = \
543 w32/winchildren.c
544endif
545
546
547#
548# kmk_fmake - Faster GNU Make.
549#
550ifeq ($(USER),bird) # for experimental purposes only.
551PROGRAMS += kmk_fgmake
552endif
553
554kmk_fgmake_TEMPLATE = BIN-KMK
555kmk_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
570kmk_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
598ifeq ($(KBUILD_TARGET),win)
599 kmk_fgmake_SOURCES += \
600 w32/w32os.c
601# @todo: dir-nt-bird.c for fgmake
602else
603 kmk_fgmake_SOURCES += \
604 posixos.c
605endif
606
607kmk_fgmake_SOURCES.win = \
608 w32/subproc/sub_proc.c
609
610
611#
612# tstFileInfo
613#
614PROGRAMS.win += tstFileInfo
615tstFileInfo_TEMPLATE = BIN
616tstFileInfo_SOURCES = w32/tstFileInfo.c
617
618#
619# tstFileInfo
620#
621PROGRAMS.win += tstFtsFake
622tstFtsFake_TEMPLATE = BIN-KMK
623tstFtsFake_NOINST = 1
624tstFtsFake_DEFS = USE_OLD_FTS
625tstFtsFake_SOURCES = ../lib/nt/tstNtFts.c
626
627
628
629include $(FILE_KBUILD_SUB_FOOTER)
630
631
632#
633# Use checked in config.h instead of running ./Configure for it.
634#
635kmk_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#
643if1of ($(KBUILD_TARGET), win nt)
644$(kmk_0_OUTDIR)/fts.h: $(MAKEFILE) | $(call DIRDEP,$(kmk_0_OUTDIR))
645 $(APPEND) -t "$@" "#include <nt/fts-nt.h>"
646else
647$(kmk_0_OUTDIR)/fts.h: $(kmk_DEFPATH)/kmkbuiltin/ftsfake.h | $(call DIRDEP,$(kmk_0_OUTDIR))
648 $(CP) $^ $@
649endif
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#
673parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
674parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
675 echo $@_start ; sleep 1; echo $@_done
676
677my_test:
678 echo "1"
679 echo "2"
680 echo "3"
681 echo "4"
682
683
684#
685# Shell execution tests.
686#
687test_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).
690test_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
698test_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
704test_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.
712test_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
719test_stack:
720 $(MAKE) -f $(kmk_DEFPATH)/testcase-stack.kmk
721
722test_math:
723 $(MAKE) -f $(kmk_DEFPATH)/testcase-math.kmk
724
725test_if1of:
726 $(MAKE) -f $(kmk_DEFPATH)/testcase-if1of.kmk
727
728test_local:
729 $(MAKE) -f $(kmk_DEFPATH)/testcase-local.kmk
730
731test_includedep:
732 $(MAKE) -f $(kmk_DEFPATH)/testcase-includedep.kmk
733
734test_root:
735 $(MAKE) -f $(kmk_DEFPATH)/testcase-root.kmk
736
737test_2ndtargetexp:
738 $(MAKE) -f $(kmk_DEFPATH)/testcase-2ndtargetexp.kmk
739
740test_30_continued_on_failure_worker:
741 this_executable_does_not_exist.exe
742 echo "We shouldn't see this..."
743
744test_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
754test_lazy_deps_vars:
755 $(MAKE) -C $(kmk_DEFPATH) -f testcase-lazy-deps-vars.kmk
756
757
758test_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
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