summaryrefslogtreecommitdiffstats
path: root/src/kmk/Makefile.kmk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/kmk/Makefile.kmk770
1 files changed, 770 insertions, 0 deletions
diff --git a/src/kmk/Makefile.kmk b/src/kmk/Makefile.kmk
new file mode 100644
index 0000000..ff93ae5
--- /dev/null
+++ b/src/kmk/Makefile.kmk
@@ -0,0 +1,770 @@
+# $Id: Makefile.kmk 3572 2022-10-24 08:36:35Z bird $
+## @file
+# Sub-makefile for kmk / GNU Make.
+#
+
+#
+# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild. If not, see <http://www.gnu.org/licenses/>
+#
+#
+
+SUB_DEPTH = ../..
+include $(KBUILD_PATH)/subheader.kmk
+
+# Enable new children handling for windows.
+CONFIG_NEW_WIN_CHILDREN = 1
+
+#
+# Template for kmk and the kmk_* binaries in this makefile.
+#
+TEMPLATE_BIN-KMK = Template for src/gmake binaries
+TEMPLATE_BIN-KMK_EXTENDS = BIN-THREADED
+TEMPLATE_BIN-KMK_DEFS = \
+ HAVE_CONFIG_H \
+ $(TEMPLATE_BIN_DEFS) \
+ KBUILD_SVN_REV=$(KBUILD_SVN_REV) \
+ KBUILD_TYPE=$(TMP_QUOTE_SLASH)"$(KBUILD_TYPE)$(TMP_QUOTE_SLASH)"
+TEMPLATE_BIN-KMK_DEPS = \
+ $(kmk_0_OUTDIR)/config.h \
+ $(kmk_0_OUTDIR)/fts.h
+TEMPLATE_BIN-KMK_CLEAN = $(TEMPLATE_BIN-KMK_DEPS)
+TEMPLATE_BIN-KMK_DEPS.solaris = \
+ $(kmk_0_OUTDIR)/paths.h
+TEMPLATE_BIN-KMK_CLEAN.solaris = $(TEMPLATE_BIN-KMK_DEPS.solaris)
+TEMPLATE_BIN-KMK_DEPS.win = \
+ $(kmk_0_OUTDIR)/sysexits.h \
+ $(kmk_0_OUTDIR)/unistd.h \
+ $(kmk_0_OUTDIR)/paths.h \
+ $(kmk_0_OUTDIR)/grp.h \
+ $(kmk_0_OUTDIR)/pwd.h \
+ $(kmk_0_OUTDIR)/inttypes.h
+TEMPLATE_BIN-KMK_CFLAGS.win.amd64 = $(TEMPLATE_BIN-THREADED_CFLAGS.win.amd64) -wd4244 -wd4267
+TEMPLATE_BIN-KMK_CLEAN.win = $(TEMPLATE_BIN-KMK_DEPS.win)
+TEMPLATE_BIN-KMK_DEFS.debug = $(TEMPLATE_BIN_DEFS.debug) MAKE_MAINTAINER_MODE
+TEMPLATE_BIN-KMK_INCS = $(kmk_0_OUTDIR) . $(TEMPLATE_BIN-THREADED_INCS)
+ifneq ($(KBUILD_TARGET),os2)
+ TEMPLATE_BIN-KMK_INCS += glob
+endif
+TEMPLATE_BIN-KMK_LIBS = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS) $(kmkmissing_1_TARGET) $(LIB_KUTIL)
+TEMPLATE_BIN-KMK_LIBS.x86 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.x86)
+TEMPLATE_BIN-KMK_LIBS.amd64 = $(LIB_KUTIL) $(TEMPLATE_BIN-THREADED_LIBS.amd64)
+ifdef ELECTRIC_HEAP # for electric heap (see electric.c).
+ifeq ($(KBUILD_TARGET),win)
+ TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
+else
+ TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -include $(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
+endif
+endif
+ifdef CONFIG_WITH_ALLOCCACHE_DEBUG
+ TEMPLATE_BIN-KMK_DEFS += CONFIG_WITH_ALLOCCACHE_DEBUG
+endif
+ifdef CONFIG_NEW_WIN_CHILDREN
+ TEMPLATE_BIN-KMK_DEFS.win = $(TEMPLATE_BIN_DEFS.win) CONFIG_NEW_WIN_CHILDREN
+endif
+# GCC sanitizers.
+ifdef GCC_SANITIZERS
+ TEMPLATE_BIN-KMK_CFLAGS ?= $(TEMPLATE_BIN-THREADED_CFLAGS)
+# TEMPLATE_BIN-KMK_CFLAGS += -fsanitize=address -fsanitize=undefined -static-libubsan -D GCC_ADDRESS_SANITIZER
+ TEMPLATE_BIN-KMK_CFLAGS += -fsanitize=address -fsanitize=undefined -D GCC_ADDRESS_SANITIZER
+ TEMPLATE_BIN-KMK_LDFLAGS ?= $(TEMPLATE_BIN-THREADED_LDFLAGS)
+ TEMPLATE_BIN-KMK_LDFLAGS += -fsanitize=address -fsanitize=undefined
+endif
+
+#
+# Library version of the above.
+#
+TEMPLATE_LIB-KMK = Template for src/gmake libraries
+TEMPLATE_LIB-KMK_EXTENDS = BIN-KMK
+TEMPLATE_LIB-KMK_POST_CMDS.win = $(NO_SUCH_VARIABLE)
+
+#
+# Template for building standalone built-in utilities.
+#
+TEMPLATE_BIN-KMK-BUILTIN = Template for standalone built-in utilies.
+TEMPLATE_BIN-KMK-BUILTIN_EXTENDS = BIN-KMK
+TEMPLATE_BIN-KMK-BUILTIN_EXTENDS_BY = appending
+TEMPLATE_BIN-KMK-BUILTIN_DEFS += KMK_BUILTIN_STANDALONE
+TEMPLATE_BIN-KMK-BUILTIN_SOURCES += kmkbuiltin/err.c
+
+#
+# A library containing the missing features needed by kmk and the
+# kmk_* binaries. Saves a bit of work later on.
+#
+LIBRARIES += kmkmissing
+kmkmissing_TEMPLATE = LIB-KMK
+kmkmissing_DEFS = KMK
+kmkmissing_NOINST = 1
+kmkmissing_SOURCES = \
+ kmkbuiltin/fts.c \
+ kmkbuiltin/setmode.c \
+ kmkbuiltin/strmode.c \
+ kmkbuiltin/kbuild_protection.c \
+ kmkbuiltin/common-env-and-cwd-opt.c \
+ kmkbuiltin/getopt_r.c \
+ kmkbuiltin/getopt1_r.c \
+ getopt.c \
+ getopt1.c \
+ electric.c
+ifneq ($(KBUILD_TARGET),os2)
+kmkmissing_SOURCES += \
+ glob/glob.c
+endif
+
+kmkmissing_SOURCES.darwin = \
+ kmkbuiltin/darwin.c \
+ glob/fnmatch.c
+
+kmkmissing_SOURCES.dragonfly = \
+ glob/fnmatch.c
+
+kmkmissing_SOURCES.freebsd = \
+ glob/fnmatch.c
+
+kmkmissing_SOURCES.gnuhurd += \
+ kmkbuiltin/strlcpy.c
+
+kmkmissing_SOURCES.gnukfbsd += \
+ kmkbuiltin/strlcpy.c
+
+kmkmissing_SOURCES.gnuknbsd += \
+ kmkbuiltin/strlcpy.c
+
+kmkmissing_SOURCES.haiku = \
+ kmkbuiltin/haikufakes.c \
+ glob/fnmatch.c
+
+kmkmissing_SOURCES.linux += \
+ kmkbuiltin/strlcpy.c
+
+kmkmissing_SOURCES.netbsd = \
+ glob/fnmatch.c
+
+kmkmissing_SOURCES.openbsd = \
+ kmkbuiltin/openbsd.c
+
+kmkmissing_SOURCES.solaris = \
+ kmkbuiltin/strlcpy.c \
+ kmkbuiltin/solfakes.c \
+ glob/fnmatch.c
+
+kmkmissing_SOURCES.win += \
+ kmkbuiltin/strlcpy.c \
+ kmkbuiltin/mscfakes.c \
+ glob/fnmatch.c \
+ getloadavg.c \
+ w32/subproc/misc.c \
+ w32/subproc/w32err.c \
+ w32/pathstuff.c \
+ w32/imagecache.c \
+ w32/compat/posixfcn.c
+
+#
+# kmk
+#
+PROGRAMS += kmk
+
+kmk_TEMPLATE = BIN-KMK
+
+kmk_DEFS = \
+ NO_ARCHIVES \
+ EXPERIMENTAL \
+ CONFIG_WITH_TOUPPER_TOLOWER \
+ CONFIG_WITH_DEFINED \
+ CONFIG_WITH_EXPLICIT_MULTITARGET \
+ CONFIG_WITH_DOT_MUST_MAKE \
+ CONFIG_WITH_PREPEND_ASSIGNMENT \
+ CONFIG_WITH_LOCAL_VARIABLES \
+ CONFIG_WITH_2ND_TARGET_EXPANSION \
+ CONFIG_WITH_ALLOC_CACHES \
+ CONFIG_WITH_STRCACHE2 \
+ \
+ KMK \
+ KMK_HELPERS \
+ CONFIG_NO_DEFAULT_SUFFIXES \
+ CONFIG_NO_DEFAULT_PATTERN_RULES \
+ CONFIG_NO_DEFAULT_TERMINAL_RULES \
+ CONFIG_NO_DEFAULT_SUFFIX_RULES \
+ CONFIG_NO_DEFAULT_VARIABLES \
+ \
+ CONFIG_WITH_ABSPATHEX \
+ CONFIG_WITH_COMMANDS_FUNC \
+ CONFIG_WITH_DATE \
+ CONFIG_WITH_DEFINED_FUNCTIONS \
+ CONFIG_WITH_EVALPLUS \
+ CONFIG_WITH_FILE_SIZE \
+ CONFIG_WITH_LOOP_FUNCTIONS \
+ CONFIG_WITH_MATH \
+ CONFIG_WITH_NANOTS \
+ CONFIG_WITH_ROOT_FUNC \
+ CONFIG_WITH_RSORT \
+ CONFIG_WITH_STACK \
+ CONFIG_WITH_STRING_FUNCTIONS \
+ CONFIG_WITH_WHERE_FUNCTION \
+ CONFIG_WITH_WHICH \
+ CONFIG_WITH_XARGS \
+ \
+ CONFIG_WITH_EXTENDED_NOTPARALLEL \
+ CONFIG_WITH_INCLUDEDEP \
+ CONFIG_WITH_VALUE_LENGTH \
+ CONFIG_WITH_COMPARE \
+ CONFIG_WITH_SET_CONDITIONALS \
+ CONFIG_WITH_IF_CONDITIONALS \
+ CONFIG_WITH_PRINTF \
+ CONFIG_WITH_MINIMAL_STATS \
+ \
+ CONFIG_PRETTY_COMMAND_PRINTING \
+ CONFIG_WITH_PRINT_STATS_SWITCH \
+ CONFIG_WITH_PRINT_TIME_SWITCH \
+ CONFIG_WITH_RDONLY_VARIABLE_VALUE \
+ CONFIG_WITH_LAZY_DEPS_VARS \
+ CONFIG_WITH_MEMORY_OPTIMIZATIONS \
+ \
+ KBUILD_HOST=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET)$(TMP_QUOTE_SLASH)" \
+ KBUILD_HOST_ARCH=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET_ARCH)$(TMP_QUOTE_SLASH)" \
+ KBUILD_HOST_CPU=$(TMP_QUOTE_SLASH)"$(KBUILD_TARGET_CPU)$(TMP_QUOTE_SLASH)"
+# kmk_DEFS += CONFIG_WITH_COMPILER # experimental, doesn't work 101% right it seems.
+kmk_DEFS.x86 = CONFIG_WITH_OPTIMIZATION_HACKS
+kmk_DEFS.amd64 = CONFIG_WITH_OPTIMIZATION_HACKS
+kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT CONFIG_WITH_OUTPUT_IN_MEMORY
+kmk_DEFS.debug = CONFIG_WITH_MAKE_STATS
+ifdef CONFIG_WITH_MAKE_STATS
+ kmk_DEFS += CONFIG_WITH_MAKE_STATS
+endif
+#ifdef CONFIG_WITH_KMK_BUILTIN_STATS
+ kmk_DEFS += CONFIG_WITH_KMK_BUILTIN_STATS
+#endif
+ifdef CONFIG_WITH_EVAL_COMPILER
+ kmk_DEFS += CONFIG_WITH_EVAL_COMPILER
+endif
+ifdef CONFIG_WITH_COMPILE_EVERYTHING
+ kmk_DEFS += CONFIG_WITH_COMPILE_EVERYTHING
+endif
+
+#ifeq ($(KBUILD_TYPE).$(USERNAME),debug.bird)
+# kmk_DEFS += CONFIG_WITH_COMPILER CONFIG_WITH_EVAL_COMPILER CONFIG_WITH_COMPILE_EVERYTHING
+#endif
+
+kmk_SOURCES = \
+ main.c \
+ read.c \
+ hash.c \
+ strcache.c \
+ variable.c \
+ ar.c \
+ arscan.c \
+ commands.c \
+ default.c \
+ expand.c \
+ file.c \
+ function.c \
+ implicit.c \
+ job.c \
+ misc.c \
+ output.c \
+ remake.c \
+ rule.c \
+ signame.c \
+ version.c \
+ vpath.c \
+ remote-stub.c \
+ guile.c \
+ load.c \
+ \
+ alloccache.c \
+ expreval.c \
+ incdep.c \
+ strcache2.c \
+ kmk_cc_exec.c \
+ kbuild.c \
+ kbuild-object.c
+ifeq ($(KBUILD_TARGET),win)
+ kmk_SOURCES += \
+ dir-nt-bird.c \
+ w32/w32os.c
+else
+ kmk_SOURCES += \
+ dir.c \
+ posixos.c
+endif
+
+ifndef CONFIG_NEW_WIN_CHILDREN
+kmk_SOURCES.win = \
+ w32/subproc/sub_proc.c
+else
+kmk_SOURCES.win = \
+ w32/winchildren.c
+endif
+
+kmk_DEFS.freebsd.x86 = CONFIG_WITHOUT_THREADS
+
+#kmk_LIBS.solaris = malloc
+#kmk_DEFS.solaris += HAVE_MALLINFO
+
+#
+# kmkbuiltin commands
+#
+kmk_DEFS += CONFIG_WITH_KMK_BUILTIN
+kmk_LIBS += $(LIB_KUTIL) #$(LIB_KDEP)
+kmk_SOURCES += \
+ kmkbuiltin.c \
+ kmkbuiltin/append.c \
+ kmkbuiltin/cat.c \
+ kmkbuiltin/chmod.c \
+ kmkbuiltin/cmp.c \
+ kmkbuiltin/cmp_util.c \
+ kmkbuiltin/cp.c \
+ kmkbuiltin/cp_utils.c \
+ kmkbuiltin/echo.c \
+ kmkbuiltin/expr.c \
+ kmkbuiltin/install.c \
+ kmkbuiltin/kDepIDB.c \
+ kmkbuiltin/kDepObj.c \
+ ../lib/kDep.c \
+ kmkbuiltin/md5sum.c \
+ kmkbuiltin/mkdir.c \
+ kmkbuiltin/mv.c \
+ kmkbuiltin/ln.c \
+ kmkbuiltin/printf.c \
+ kmkbuiltin/redirect.c \
+ kmkbuiltin/rm.c \
+ kmkbuiltin/rmdir.c \
+ $(if-expr $(KBUILD_TARGET) == win,kmkbuiltin/kSubmit.c) \
+ kmkbuiltin/sleep.c \
+ kmkbuiltin/test.c \
+ kmkbuiltin/touch.c \
+ \
+ kmkbuiltin/err.c
+kmk_SOURCES.win += \
+ kmkbuiltin/kill.c
+
+
+## @todo kmkbuiltin/redirect.c
+
+## Some profiling
+#kmk_SOURCES += kbuildprf.c
+#kmk_DEFS += open=prf_open read=prf_read lseek=prf_lseek close=prf_close
+##kmk_DEFS += KMK_PRF=1
+##kmkmissing_DEFS += KMK_PRF=1
+
+#
+# Standalone kmkbuiltin commands.
+#
+PROGRAMS += \
+ kmk_append \
+ kmk_cat \
+ kmk_chmod \
+ kmk_cp \
+ kmk_cmp \
+ kmk_echo \
+ kmk_expr \
+ kmk_md5sum \
+ kmk_mkdir \
+ kmk_mv \
+ kmk_install \
+ kmk_ln \
+ kmk_printf \
+ kmk_redirect \
+ kmk_rm \
+ kmk_rmdir \
+ kmk_sleep \
+ kmk_test \
+ kmk_touch \
+ kDepIDB \
+ kDepObj
+PROGRAMS.win += \
+ kmk_kill
+
+kmk_append_TEMPLATE = BIN-KMK-BUILTIN
+kmk_append_INCS = .
+kmk_append_SOURCES = \
+ kmkbuiltin/append.c
+
+kmk_cat_TEMPLATE = BIN-KMK-BUILTIN
+kmk_cat_SOURCES = \
+ kmkbuiltin/cat.c
+
+kmk_chmod_TEMPLATE = BIN-KMK-BUILTIN
+kmk_chmod_SOURCES = \
+ kmkbuiltin/chmod.c
+
+kmk_cmp_TEMPLATE = BIN-KMK-BUILTIN
+kmk_cmp_SOURCES = \
+ kmkbuiltin/cmp.c \
+ kmkbuiltin/cmp_util.c
+
+kmk_cp_TEMPLATE = BIN-KMK-BUILTIN
+kmk_cp_SOURCES = \
+ kmkbuiltin/cp.c \
+ kmkbuiltin/cp_utils.c \
+ kmkbuiltin/cmp_util.c
+
+kmk_echo_TEMPLATE = BIN-KMK-BUILTIN
+kmk_echo_SOURCES = \
+ kmkbuiltin/echo.c
+
+kmk_expr_TEMPLATE = BIN-KMK-BUILTIN
+kmk_expr_SOURCES = \
+ kmkbuiltin/expr.c
+
+kmk_install_TEMPLATE = BIN-KMK-BUILTIN
+kmk_install_SOURCES = \
+ kmkbuiltin/install.c
+
+kmk_kill_TEMPLATE = BIN-KMK-BUILTIN
+kmk_kill_SOURCES = \
+ kmkbuiltin/kill.c
+
+kmk_ln_TEMPLATE = BIN-KMK-BUILTIN
+kmk_ln_SOURCES = \
+ kmkbuiltin/ln.c
+
+kmk_mkdir_TEMPLATE = BIN-KMK-BUILTIN
+kmk_mkdir_SOURCES = \
+ kmkbuiltin/mkdir.c
+
+kmk_md5sum_TEMPLATE = BIN-KMK-BUILTIN
+kmk_md5sum_SOURCES = \
+ kmkbuiltin/md5sum.c
+kmk_md5sum_LIBS = $(LIB_KUTIL)
+
+kmk_mv_TEMPLATE = BIN-KMK-BUILTIN
+kmk_mv_SOURCES = \
+ kmkbuiltin/mv.c
+
+kmk_printf_TEMPLATE = BIN-KMK-BUILTIN
+kmk_printf_SOURCES = \
+ kmkbuiltin/printf.c
+
+kmk_rm_TEMPLATE = BIN-KMK-BUILTIN
+kmk_rm_SOURCES = \
+ kmkbuiltin/rm.c
+
+kmk_redirect_TEMPLATE = BIN-KMK-BUILTIN
+kmk_redirect_SOURCES = \
+ kmkbuiltin/redirect.c
+kmk_redirect_SOURCES.win = \
+ ../lib/startuphacks-win.c
+
+kmk_rmdir_TEMPLATE = BIN-KMK-BUILTIN
+kmk_rmdir_SOURCES = \
+ kmkbuiltin/rmdir.c
+
+kmk_sleep_TEMPLATE = BIN-KMK-BUILTIN
+kmk_sleep_SOURCES = \
+ kmkbuiltin/sleep.c
+
+kmk_test_TEMPLATE = BIN-KMK-BUILTIN
+kmk_test_SOURCES = \
+ kmkbuiltin/test.c
+
+kmk_touch_TEMPLATE = BIN-KMK-BUILTIN
+kmk_touch_SOURCES = \
+ kmkbuiltin/touch.c
+
+kDepIDB_TEMPLATE = BIN-KMK-BUILTIN
+kDepIDB_INCS = .
+kDepIDB_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
+kDepIDB_SOURCES = \
+ kmkbuiltin/kDepIDB.c
+
+kDepObj_TEMPLATE = BIN-KMK-BUILTIN
+kDepObj_INCS = .
+kDepObj_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
+kDepObj_SOURCES = \
+ kmkbuiltin/kDepObj.c
+
+
+#
+# kmk_gmake - almost plain GNU Make.
+#
+PROGRAMS += kmk_gmake
+
+kmk_gmake_TEMPLATE = BIN-KMK
+kmk_gmake_DEFS = \
+ HAVE_CONFIG_H \
+ CONFIG_WITH_TOUPPER_TOLOWER \
+ EXPERIMENTAL
+# NO_ARCHIVES
+
+kmk_gmake_SOURCES = \
+ main.c \
+ read.c \
+ hash.c \
+ strcache.c \
+ variable.c \
+ ar.c \
+ arscan.c \
+ commands.c \
+ default.c \
+ dir.c \
+ expand.c \
+ file.c \
+ function.c \
+ implicit.c \
+ job.c \
+ misc.c \
+ output.c \
+ remake.c \
+ rule.c \
+ signame.c \
+ version.c \
+ vpath.c \
+ remote-stub.c \
+ guile.c \
+ load.c
+ifeq ($(KBUILD_TARGET),win)
+ kmk_gmake_SOURCES += \
+ w32/w32os.c
+else
+ kmk_gmake_SOURCES += \
+ posixos.c
+endif
+
+ifndef CONFIG_NEW_WIN_CHILDREN
+kmk_gmake_SOURCES.win = \
+ w32/subproc/sub_proc.c
+else
+kmk_gmake_SOURCES.win = \
+ w32/winchildren.c
+endif
+
+
+#
+# kmk_fmake - Faster GNU Make.
+#
+ifeq ($(USER),bird) # for experimental purposes only.
+PROGRAMS += kmk_fgmake
+endif
+
+kmk_fgmake_TEMPLATE = BIN-KMK
+kmk_fgmake_DEFS = \
+ HAVE_CONFIG_H \
+ NO_ARCHIVES \
+ CONFIG_WITH_TOUPPER_TOLOWER \
+ EXPERIMENTAL \
+ \
+ CONFIG_WITH_ALLOC_CACHES \
+ CONFIG_WITH_LAZY_DEPS_VARS \
+ CONFIG_WITH_STRCACHE2 \
+ CONFIG_WITH_VALUE_LENGTH \
+ CONFIG_WITH_RDONLY_VARIABLE_VALUE
+# TODO ?
+# CONFIG_WITH_PRINT_STATS_SWITCH \
+# CONFIG_WITH_EXTENDED_NOTPARALLEL \
+
+kmk_fgmake_SOURCES = \
+ main.c \
+ read.c \
+ hash.c \
+ strcache.c \
+ strcache2.c \
+ variable.c \
+ ar.c \
+ arscan.c \
+ commands.c \
+ default.c \
+ dir.c \
+ expand.c \
+ file.c \
+ function.c \
+ implicit.c \
+ job.c \
+ misc.c \
+ output.c \
+ alloccache.c \
+ remake.c \
+ rule.c \
+ signame.c \
+ version.c \
+ vpath.c \
+ remote-stub.c \
+ guile.c \
+ load.c
+ifeq ($(KBUILD_TARGET),win)
+ kmk_fgmake_SOURCES += \
+ w32/w32os.c
+# @todo: dir-nt-bird.c for fgmake
+else
+ kmk_fgmake_SOURCES += \
+ posixos.c
+endif
+
+kmk_fgmake_SOURCES.win = \
+ w32/subproc/sub_proc.c
+
+
+#
+# tstFileInfo
+#
+PROGRAMS.win += tstFileInfo
+tstFileInfo_TEMPLATE = BIN
+tstFileInfo_SOURCES = w32/tstFileInfo.c
+
+#
+# tstFileInfo
+#
+PROGRAMS.win += tstFtsFake
+tstFtsFake_TEMPLATE = BIN-KMK
+tstFtsFake_NOINST = 1
+tstFtsFake_DEFS = USE_OLD_FTS
+tstFtsFake_SOURCES = ../lib/nt/tstNtFts.c
+
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
+
+#
+# Use checked in config.h instead of running ./Configure for it.
+#
+kmk_config.h.$(KBUILD_TARGET) := $(kmk_DEFPATH)/config.h.$(KBUILD_TARGET)
+$(kmk_0_OUTDIR)/config.h: $(kmk_config.h.$(KBUILD_TARGET))
+ $(MKDIR) -p $(dir $@)
+ $(CP) $^ $@
+
+#
+# Some missing headers.
+#
+if1of ($(KBUILD_TARGET), win nt)
+$(kmk_0_OUTDIR)/fts.h: $(MAKEFILE) | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(APPEND) -t "$@" "#include <nt/fts-nt.h>"
+else
+$(kmk_0_OUTDIR)/fts.h: $(kmk_DEFPATH)/kmkbuiltin/ftsfake.h | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(CP) $^ $@
+endif
+
+$(kmk_0_OUTDIR)/unistd.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(ECHO_EXT) > $@
+
+$(kmk_0_OUTDIR)/sysexits.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(ECHO_EXT) > $@
+
+$(kmk_0_OUTDIR)/inttypes.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(ECHO_EXT) > $@
+
+$(kmk_0_OUTDIR)/paths.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(ECHO_EXT) > $@
+
+$(kmk_0_OUTDIR)/pwd.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(ECHO_EXT) > $@
+
+$(kmk_0_OUTDIR)/grp.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
+ $(ECHO_EXT) > $@
+
+
+#
+# Some tests.
+#
+parallel: parallel_1 parallel_2 parallel_3 parallel_4 parallel_5
+parallel_1 parallel_2 parallel_3 parallel_4 parallel_5:
+ echo $@_start ; sleep 1; echo $@_done
+
+my_test:
+ echo "1"
+ echo "2"
+ echo "3"
+ echo "4"
+
+
+#
+# Shell execution tests.
+#
+test_shell: test_shell_quoting test_shell_double_quoting test_shell_newline
+
+# shell double and single quoting check (was busted on windows in 3.81).
+test_shell_quoting:
+ $(ECHO_EXT) "double quoted sTrInG"
+ $(ECHO_EXT) "double quoted sTrInG" | $(SED_EXT) -e "s/sTrInG/string/g"
+ $(ECHO_EXT) 'single quoted sTrInG' | $(SED_EXT) -e 's/sTrInG/string/g'
+ $(ECHO) "This string should not be printed with double quotes."
+ $(ECHO) 'This string should not be printed with single quotes.'
+ ( echo " #define PWD \"`pwd`\""; )
+
+test_shell_double_quoting:
+ $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
+ "s/foo/$@/" -e \
+ "s/foo/works/" \
+ -e "s/foo/\!/"
+
+test_shell_double_quoting2:
+ $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
+ "s/foo/$@/" -e \
+ "s/foo/works/" \
+ -e\
+ "s/foo/\!/"
+
+# when using batch mode shell, the newline got escaped twice and spoiling everything.
+test_shell_newline:
+ $(ECHO_EXT) "foo foo foo" | $(SED_EXT) -e \
+ 's/foo/$@/' -e \
+ 's/foo/works/' \
+ -e 's/foo/\!/'
+
+
+test_stack:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-stack.kmk
+
+test_math:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-math.kmk
+
+test_if1of:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-if1of.kmk
+
+test_local:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-local.kmk
+
+test_includedep:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-includedep.kmk
+
+test_root:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-root.kmk
+
+test_2ndtargetexp:
+ $(MAKE) -f $(kmk_DEFPATH)/testcase-2ndtargetexp.kmk
+
+test_30_continued_on_failure_worker:
+ this_executable_does_not_exist.exe
+ echo "We shouldn't see this..."
+
+test_30_continued_on_failure:
+ $(MAKE) -f $(MAKEFILE) test_30_continued_on_failure_worker; \
+ RC=$$?; \
+ if test $${RC} -ne 2; then \
+ echo "$@: FAILED - exit code $${RC} instead of 2."; \
+ exit 1; \
+ else \
+ echo "$@: SUCCESS"; \
+ fi
+
+test_lazy_deps_vars:
+ $(MAKE) -C $(kmk_DEFPATH) -f testcase-lazy-deps-vars.kmk
+
+
+test_all: \
+ test_math \
+ test_stack \
+ test_shell \
+ test_if1of \
+ test_local \
+ test_root \
+ test_includedep \
+ test_2ndtargetexp \
+ test_30_continued_on_failure \
+ test_lazy_deps_vars
+
+