Commit 4e5caae5 authored by Gianfranco Costamagna's avatar Gianfranco Costamagna

New upstream version 0.1.9998svn3236+dfsg

parent 59682479
# $Id: Config.kmk 3111 2017-10-22 11:38:15Z bird $
# $Id: Config.kmk 3175 2018-03-21 21:38:50Z bird $
## @file
# Build Configuration.
#
......@@ -52,6 +52,7 @@ else ifneq ($(wildcard $(PATH_ROOT)/.svn/ $(PATH_ROOT)/../.svn/),)
# Generate from svn info
KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
KBUILD_SVN_TOOL := svn
$(PATH_OBJ)/SvnInfo.ts +| $(KBUILD_SVN_INFO_KMK): $(wildcard $(addprefix $(PATH_ROOT)/.svn/ $(PATH_ROOT)/../.svn/,\
. \
......@@ -66,7 +67,7 @@ $(PATH_OBJ)/SvnInfo.ts +| $(KBUILD_SVN_INFO_KMK): $(wildcard $(addprefix $(PATH_
$(call MSG_GENERATE,,$(KBUILD_SVN_INFO_KMK))
@$(RM) -f $@ $@.tmp
@$(MKDIR) -p $(@D)
@$(REDIRECT) -o $@.tmp -E 'LC_ALL=C' -- svn info $(DEPTH)
@$(REDIRECT) -o $@.tmp -E 'LC_ALL=C' -- $(KBUILD_SVN_TOOL) info $(DEPTH)
@$(SED) \
-e 's/^URL: */KBUILD_SVN_URL := /' \
-e 's/Revision: */KBUILD_SVN_REV := /' \
......
# $Id: footer-pass2-compiling-targets.kmk 3135 2018-03-01 18:45:26Z bird $
# $Id: footer-pass2-compiling-targets.kmk 3160 2018-03-19 22:39:19Z bird $
## @file
# kBuild - Footer - Target lists - Pass 2 - Compiling Targets.
#
......@@ -49,12 +49,6 @@ else
endif
## Temporary for the compile rule below.
if "$(KBUILD_KMK_REVISION)" >= 3134
KBUILD_HAVE_OPTIMIZED_APPEND := 1
endif
## Generates the rules for building a specific object, and the aliases
# for building a source file.
# @param $(obj) The object file.
......
# $Id: header.kmk 3121 2017-10-31 10:58:59Z bird $
# $Id: header.kmk 3166 2018-03-20 12:42:52Z bird $
## @file
# kBuild - File included at top of a makefile.
#
......@@ -79,7 +79,7 @@ endif
# The revision in which this file was last modified.
# This can be useful when using development versions of kBuild.
#
KMK_REVISION := $(patsubst %:,, $Rev: 3121 $ )
KMK_REVISION := $(patsubst %:,, $Rev: 3166 $ )
#
......@@ -970,6 +970,11 @@ endif
# Somewhat simple solution for automatic command dependencies.
#
## Temporary for the compile rule below.
if "$(KBUILD_KMK_REVISION)" >= 3134
KBUILD_HAVE_OPTIMIZED_APPEND := 1
endif
##
# Advanced version of KB_FN_AUTO_CMD_DEPS_COMMANDS_EX where you set
# the dependency file name yourself.
......@@ -977,12 +982,21 @@ endif
# After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS_EX,<recipe-target>,<dep-file>).
#
# @param 1 dep file.
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
%$(QUIET2)$(APPEND) -tin "$1" \
'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
'--insert-command=$@' \
'endef'
endef
else
define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
%$(QUIET2)$(RM) -f -- "$1"
%$(QUIET2)$(APPEND) "$1" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
%$(QUIET2)$(APPEND) -c "$1" '$@'
%$(QUIET2)$(APPEND) "$1" 'endef'
%$(QUIET2)$(APPEND) "$1" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
%$(QUIET2)$(APPEND) -c "$1" '$@'
%$(QUIET2)$(APPEND) "$1" 'endef'
endef
endif
##
# Advanced version of KB_FN_AUTO_CMD_DEPS
......@@ -995,12 +1009,21 @@ KB_FN_AUTO_CMD_DEPS_EX = $(eval includedep $2)$(eval _DEPFILES_INCLUDED += $2)$1
# $(call KB_FN_AUTO_CMD_DEPS_COMMANDS) as the first command in a recipe to
# automatically generate command dependencies.
# After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS,<recipe-target>).
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
define KB_FN_AUTO_CMD_DEPS_COMMANDS
%$(QUIET2)$(APPEND) -tni "$@.auto-dep" \
'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
'--insert-command=$@' \
'endef'
endef
else
define KB_FN_AUTO_CMD_DEPS_COMMANDS
%$(QUIET2)$(RM) -f -- "$@.auto-dep"
%$(QUIET2)$(APPEND) "$@.auto-dep" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
%$(QUIET2)$(APPEND) -c "$@.auto-dep" '$@'
%$(QUIET2)$(APPEND) "$@.auto-dep" 'endef'
endef
endif
##
# Call before or after defining a recipe that you want automatic command
......
# $Id: dtrace.kmk 3121 2017-10-31 10:58:59Z bird $
# $Id: dtrace.kmk 3160 2018-03-19 22:39:19Z bird $
## @file
# DTrace unit.
#
......@@ -75,11 +75,18 @@ $(out): \
$(cmds)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
# update globals
_OUT_FILES += $(out)
......@@ -109,11 +116,18 @@ $(out): \
$(cmds)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
# update globals
_OUT_FILES += $(out)
......
# $Id: lex.kmk 3121 2017-10-31 10:58:59Z bird $
# $Id: lex.kmk 3160 2018-03-19 22:39:19Z bird $
## @file
# lex unit.
#
......@@ -71,11 +71,18 @@ $(out) + $(output_extra) +| $(output_maybe) : \
$(cmds)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
# update globals
_OUT_FILES += $(out) $(output_extra) $(output_maybe)
......
# $Id: qt5.kmk 3121 2017-10-31 10:58:59Z bird $
# $Id: qt5.kmk 3160 2018-03-19 22:39:19Z bird $
## @file
# Qt 5 unit.
#
......@@ -454,9 +454,9 @@ define TOOL_QT5_RCC_QRC_CMDS
$(flags)\
-o $(out)\
$(source)
$(QUIET2)$(APPEND) $(dep) '\'
$(QUIET2)$(APPEND) $(dep) '$(out): \'
$(QUIET2)$(APPEND) $(dep) '$(source) \'
$(QUIET2)$(APPEND) -n $(dep) '\' \
'$(out): \' \
'$(source) \'
$(QUIET2)$(SED) \
-e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
-e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
......@@ -532,11 +532,18 @@ $(out) + $(more_output) +| $(maybe_output): \
$(cmds)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
$(target)-inst-nls_SOURCES += $(out)
......@@ -620,11 +627,18 @@ $(cmds)
$(QUIET)$(CP) --changed -f $(out) $(realout)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
$(target)_INTERMEDIATES += $(realout)
$(target)_GEN_SOURCES_ += $(realout)
......@@ -707,11 +721,18 @@ $(cmds)
$(QUIET)$(CP) --changed -f $(out) $(realout)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
$(target)_INTERMEDIATES += $(realout)
$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
......@@ -793,11 +814,18 @@ $(cmds)
$(QUIET)$(CP) --changed -f $(out) $(realout)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
$(target)_INTERMEDIATES += $(realout)
$(target)_GEN_SOURCES_ += $(realout)
......@@ -886,11 +914,18 @@ $(cmds)
$(QUIET)$(CP) --changed -f $(out) $(realout)
ifndef NO_COMPILE_CMDS_DEPS
ifdef KBUILD_HAVE_OPTIMIZED_APPEND
%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_' \
'--insert-command=$(out)' \
'endef'
else
%$$(QUIET2)$$(APPEND) '$(dep)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_'
%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
endif
endif
$(target)_INTERMEDIATES += $(realout)
$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
......
/* $Id: kDepPre.c 3065 2017-09-30 12:52:35Z bird $ */
/* $Id: kDepPre.c 3167 2018-03-20 21:47:25Z bird $ */
/** @file
* kDepPre - Dependency Generator using Precompiler output.
*/
......@@ -55,9 +55,10 @@
*
* @returns 0 on success.
* @returns 1 or other approriate exit code on failure.
* @param pThis Pointer to the 'dep' instance.
* @param pInput Input stream. (probably not seekable)
*/
static int ParseCPrecompiler(FILE *pInput)
static int ParseCPrecompiler(PDEPGLOBALS pThis, FILE *pInput)
{
enum
{
......@@ -185,7 +186,7 @@ static int ParseCPrecompiler(FILE *pInput)
if ( !pDep
|| pDep->cchFilename != cchFilename
|| memcmp(pDep->szFilename, szBuf, cchFilename))
pDep = depAdd(szBuf, cchFilename);
pDep = depAdd(pThis, szBuf, cchFilename);
break;
}
}
......@@ -224,6 +225,7 @@ static int usage(FILE *pOut, const char *argv0)
int main(int argc, char *argv[])
{
int i;
DEPGLOBALS This;
/* Arguments. */
int iExec = 0;
......@@ -449,7 +451,8 @@ int main(int argc, char *argv[])
/*
* Do the parsing.
*/
i = ParseCPrecompiler(pInput);
depInit(&This);
i = ParseCPrecompiler(&This, pInput);
/*
* Reap child.
......@@ -464,11 +467,11 @@ int main(int argc, char *argv[])
*/
if (!i)
{
depOptimize(fFixCase, 0 /* fQuiet */, NULL /*pszIgnoredExt*/);
depOptimize(&This, fFixCase, 0 /* fQuiet */, NULL /*pszIgnoredExt*/);
fprintf(pOutput, "%s:", pszTarget);
depPrint(pOutput);
depPrint(&This, pOutput);
if (fStubs)
depPrintStubs(pOutput);
depPrintStubs(&This, pOutput);
}
/*
......@@ -486,6 +489,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s: warning: failed to remove output file '%s' on failure.\n", argv[0], pszOutput);
}
depCleanup(&This);
return i;
}
/* $Id: kObjCache.c 3110 2017-10-20 19:14:56Z bird $ */
/* $Id: kObjCache.c 3167 2018-03-20 21:47:25Z bird $ */
/** @file
* kObjCache - Object Cache.
*/
......@@ -806,6 +806,8 @@ typedef struct KOCDEP
char *pszFilename;
/** The current dependency file. */
PDEP pCurDep;
/** The core dependency collector state. */
DEPGLOBALS Core;
} KOCDEP;
/** Pointer to a KOCDEP. */
typedef KOCDEP *PKOCDEP;
......@@ -823,6 +825,7 @@ static void kOCDepInit(PKOCDEP pDepState)
pDepState->cbFilenameAlloced = 0;
pDepState->pszFilename = NULL;
pDepState->pCurDep = NULL;
depInit(&pDepState->Core);
}
......@@ -836,7 +839,7 @@ static void kOCDepDelete(PKOCDEP pDepState)
pDepState->enmState = kOCDepState_Invalid;
free(pDepState->pszFilename);
pDepState->pszFilename = NULL;
depCleanup();
depCleanup(&pDepState->Core);
}
......@@ -907,7 +910,7 @@ static void kOCDepEnter(PKOCDEP pDepState, const char *pszUnescFilename, size_t
if ( !pDepState->pCurDep
|| cchFilename != pDepState->pCurDep->cchFilename
|| strcmp(pDepState->pszFilename, pDepState->pCurDep->szFilename))
pDepState->pCurDep = depAdd(pDepState->pszFilename, cchFilename);
pDepState->pCurDep = depAdd(&pDepState->Core, pDepState->pszFilename, cchFilename);
}
......@@ -1069,7 +1072,7 @@ kOCDepConsumer(PKOCDEP pDepState, const char *pszInput, size_t cchInput)
if ( !pDepState->pCurDep
|| cchFilename != pDepState->pCurDep->cchFilename
|| strcmp(pDepState->pszFilename, pDepState->pCurDep->szFilename))
pDepState->pCurDep = depAdd(pDepState->pszFilename, cchFilename);
pDepState->pCurDep = depAdd(&pDepState->Core, pDepState->pszFilename, cchFilename);
pDepState->offFilename = 0;
break;
}
......@@ -1111,7 +1114,7 @@ static void kOCDepWriteToFile(PKOCDEP pDepState, const char *pszFilename, const
if (!pFile)
FatalMsg("Failed to open dependency file '%s': %s\n", pszFilename, strerror(errno));
depOptimize(fFixCase, fQuiet, NULL /*pszIgnoredExt*/);
depOptimize(&pDepState->Core, fFixCase, fQuiet, NULL /*pszIgnoredExt*/);
/* Make object file name with unix slashes. */
pszObjFileAbs = MakePathFromDirAndFile(pszObjFile, pszObjDir);
......@@ -1121,9 +1124,9 @@ static void kOCDepWriteToFile(PKOCDEP pDepState, const char *pszFilename, const
fprintf(pFile, "%s:", pszObjFileAbs);
free(pszObjFileAbs);
depPrint(pFile);
depPrint(&pDepState->Core, pFile);
if (fGenStubs)
depPrintStubs(pFile);
depPrintStubs(&pDepState->Core, pFile);
if (fclose(pFile) != 0)
FatalMsg("Failed to write dependency file '%s': %s\n", pszFilename, strerror(errno));
......@@ -5098,7 +5101,7 @@ int main(int argc, char **argv)
}
else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version"))
{
printf("kObjCache - kBuild version %d.%d.%d ($Revision: 3110 $)\n"
printf("kObjCache - kBuild version %d.%d.%d ($Revision: 3167 $)\n"
"Copyright (c) 2007-2012 knut st. osmundsen\n",
KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, KBUILD_VERSION_PATCH);
return 0;
......
# $Id: Makefile.kmk 3042 2017-05-11 10:23:12Z bird $
# $Id: Makefile.kmk 3192 2018-03-26 20:25:56Z bird $
## @file
# Sub-makefile for kWorker.
#
......@@ -35,7 +35,8 @@ kWorker_DEFS.debug = K_STRICT
kWorker_DEFS.release = NASSERT
kWorker_SOURCES = \
kWorker.c \
../kmk/kmkbuiltin/kDepObj.c
../kmk/kmkbuiltin/kDepObj.c \
../kmk/kmkbuiltin/err.c
kWorker_INCS = \
../kmk/ \
../kmk/kmkbuiltin
......@@ -77,6 +78,7 @@ kWorkerLib_SOURCES.win = \
nt/ntunlink.c \
nt/kFsCache.c \
quote_argv.c \
is_console.c \
maybe_con_write.c \
maybe_con_fwrite.c \
msc_buffered_printf.c
......
This diff is collapsed.
# $Id: Makefile.kmk 3147 2018-03-15 17:29:12Z bird $
# $Id: Makefile.kmk 3214 2018-03-30 21:03:40Z bird $
## @file
# Sub-makefile for kmk / GNU Make.
#
......@@ -26,6 +26,8 @@
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.
......@@ -53,19 +55,25 @@ TEMPLATE_BIN-KMK_DEPS.win = \
$(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-KMK_DEPS.debug) MAKE_MAINTAINER_MODE
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)
ifdef ELECTRIC_HEAP # for electric heap (see electric.c) - windows only.
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)
......@@ -74,6 +82,14 @@ ifdef GCC_SANITIZERS
TEMPLATE_BIN-KMK_LDFLAGS += -fsanitize=address -fsanitize=undefined
endif
#
# 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
......@@ -84,12 +100,13 @@ kmkmissing_TEMPLATE = BIN-KMK
kmkmissing_DEFS = KMK
kmkmissing_NOINST = 1
kmkmissing_SOURCES = \
kmkbuiltin/err.c \
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
......@@ -213,11 +230,14 @@ kmk_DEFS = \
# 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
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
......@@ -225,6 +245,10 @@ 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 \
......@@ -268,8 +292,13 @@ else
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
......@@ -307,7 +336,10 @@ kmk_SOURCES += \
$(if-expr $(KBUILD_TARGET) == win,kmkbuiltin/kSubmit.c) \
kmkbuiltin/sleep.c \
kmkbuiltin/test.c \
kmkbuiltin/touch.c
kmkbuiltin/touch.c \
\
kmkbuiltin/err.c
## @todo kmkbuiltin/redirect.c
......@@ -343,116 +375,96 @@ PROGRAMS += \
kDepIDB \
kDepObj \
kmk_append_TEMPLATE = BIN-KMK
kmk_append_DEFS = kmk_builtin_append=main
kmk_append_TEMPLATE = BIN-KMK-BUILTIN
kmk_append_INCS = .
kmk_append_SOURCES = \
kmkbuiltin/append.c
kmk_cat_TEMPLATE = BIN-KMK
kmk_cat_DEFS = kmk_builtin_cat=main
kmk_cat_TEMPLATE = BIN-KMK-BUILTIN
kmk_cat_SOURCES = \
kmkbuiltin/cat.c
kmk_chmod_TEMPLATE = BIN-KMK
kmk_chmod_DEFS = kmk_builtin_chmod=main
kmk_chmod_TEMPLATE = BIN-KMK-BUILTIN
kmk_chmod_SOURCES = \
kmkbuiltin/chmod.c
kmk_cmp_TEMPLATE = BIN-KMK
kmk_cmp_DEFS = kmk_builtin_cmp=main
kmk_cmp_TEMPLATE = BIN-KMK-BUILTIN
kmk_cmp_SOURCES = \
kmkbuiltin/cmp.c \
kmkbuiltin/cmp_util.c
kmk_cp_TEMPLATE = BIN-KMK
kmk_cp_DEFS = kmk_builtin_cp=main
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
kmk_echo_DEFS = kmk_builtin_echo=main
kmk_echo_TEMPLATE = BIN-KMK-BUILTIN
kmk_echo_SOURCES = \
kmkbuiltin/echo.c
kmk_expr_TEMPLATE = BIN-KMK
kmk_expr_DEFS = kmk_builtin_expr=main
kmk_expr_TEMPLATE = BIN-KMK-BUILTIN
kmk_expr_SOURCES = \
kmkbuiltin/expr.c
kmk_install_TEMPLATE = BIN-KMK
kmk_install_DEFS = kmk_builtin_install=main
kmk_install_TEMPLATE = BIN-KMK-BUILTIN
kmk_install_SOURCES = \
kmkbuiltin/install.c
kmk_ln_TEMPLATE = BIN-KMK
kmk_ln_DEFS = kmk_builtin_ln=main
kmk_ln_TEMPLATE = BIN-KMK-BUILTIN
kmk_ln_SOURCES = \
kmkbuiltin/ln.c
kmk_mkdir_TEMPLATE = BIN-KMK
kmk_mkdir_DEFS = kmk_builtin_mkdir=main
kmk_mkdir_TEMPLATE = BIN-KMK-BUILTIN
kmk_mkdir_SOURCES = \
kmkbuiltin/mkdir.c
kmk_md5sum_TEMPLATE = BIN-KMK
kmk_md5sum_DEFS = kmk_builtin_md5sum=main
kmk_md5sum_TEMPLATE = BIN-KMK-BUILTIN
kmk_md5sum_SOURCES = \
kmkbuiltin/md5sum.c
kmk_md5sum_LIBS = $(LIB_KUTIL)
kmk_mv_TEMPLATE = BIN-KMK
kmk_mv_DEFS = kmk_builtin_mv=main
kmk_mv_TEMPLATE = BIN-KMK-BUILTIN
kmk_mv_SOURCES = \
kmkbuiltin/mv.c
kmk_printf_TEMPLATE = BIN-KMK
kmk_printf_DEFS = kmk_builtin_printf=main
kmk_printf_TEMPLATE = BIN-KMK-BUILTIN
kmk_printf_SOURCES = \
kmkbuiltin/printf.c
kmk_rm_TEMPLATE = BIN-KMK
kmk_rm_DEFS = kmk_builtin_rm=main
kmk_rm_TEMPLATE = BIN-KMK-BUILTIN
kmk_rm_SOURCES = \
kmkbuiltin/rm.c
kmk_redirect_TEMPLATE = BIN-KMK
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
kmk_rmdir_DEFS = kmk_builtin_rmdir=main
kmk_rmdir_TEMPLATE = BIN-KMK-BUILTIN
kmk_rmdir_SOURCES = \
kmkbuiltin/rmdir.c
kmk_sleep_TEMPLATE = BIN-KMK
kmk_sleep_DEFS = kmk_builtin_sleep=main
kmk_sleep_TEMPLATE = BIN-KMK-BUILTIN
kmk_sleep_SOURCES = \
kmkbuiltin/sleep.c
kmk_test_TEMPLATE = BIN-KMK
kmk_test_DEFS = kmk_builtin_test=main
kmk_test_TEMPLATE = BIN-KMK-BUILTIN
kmk_test_SOURCES = \
kmkbuiltin/test.c
kmk_touch_TEMPLATE = BIN-KMK
kmk_touch_DEFS = kmk_builtin_touch=main
kmk_touch_TEMPLATE = BIN-KMK-BUILTIN
kmk_touch_SOURCES = \
kmkbuiltin/touch.c
kDepIDB_TEMPLATE = BIN-KMK
kDepIDB_DEFS = kmk_builtin_kDepIDB=main
kDepIDB_TEMPLATE = BIN-KMK-BUILTIN
kDepIDB_INCS = .
kDepIDB_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
kDepIDB_SOURCES = \
kmkbuiltin/kDepIDB.c
kDepObj_TEMPLATE = BIN-KMK
kDepObj_DEFS = kmk_builtin_kDepObj=main
kDepObj_TEMPLATE = BIN-KMK-BUILTIN
kDepObj_INCS = .
kDepObj_LIBS = $(LIB_KDEP) $(LIB_KUTIL)
kDepObj_SOURCES = \
......@@ -505,8 +517,13 @@ else
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
#
......
......@@ -23,6 +23,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef WINDOWS32
#include <windows.h>
#include "w32err.h"
# ifdef CONFIG_NEW_WIN_CHILDREN
<