diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:21:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:21:29 +0000 |
commit | 29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc (patch) | |
tree | 63ef546b10a81d461e5cf5ed9e98a68cd7dee1aa /src/kash/Makefile.kmk | |
parent | Initial commit. (diff) | |
download | kbuild-e48fe8ce9d7780c2e25428a70815d2c87c580412.tar.xz kbuild-e48fe8ce9d7780c2e25428a70815d2c87c580412.zip |
Adding upstream version 1:0.1.9998svn3589+dfsg.upstream/1%0.1.9998svn3589+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/kash/Makefile.kmk')
-rw-r--r-- | src/kash/Makefile.kmk | 272 |
1 files changed, 272 insertions, 0 deletions
diff --git a/src/kash/Makefile.kmk b/src/kash/Makefile.kmk new file mode 100644 index 0000000..f0e6e66 --- /dev/null +++ b/src/kash/Makefile.kmk @@ -0,0 +1,272 @@ +# $Id: Makefile.kmk 3477 2020-09-17 21:52:16Z bird $ +## @file +# Sub-makefile for kash. +# + +# +# Copyright (c) 2005-2020 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 + +KASH_WIN_FORKED_MODE = + +# +# The program. +# +PROGRAMS += kash +kash_TEMPLATE = BIN-THREADED +kash_NAME = kmk_ash +kash_ASTOOL = YASM +kash_DEFS = lint SHELL SMALL KASH_SEPARATE_PARSER_ALLOCATOR +if "$(KBUILD_TARGET)" != "win" || defined(KASH_WIN_FORKED_MODE) +kash_DEFS += SH_FORKED_MODE +else +kash_DEFS += KASH_SEPARATE_PARSER_ALLOCATOR KASH_ASYNC_CLOSE_HANDLE +endif +kash_DEFS.debug = DEBUG=2 K_STRICT +kash_DEFS.haiku = BSD +kash_DEFS.linux = BSD +kash_DEFS.solaris = BSD +## @todo bring over PC_SLASHES? +kash_DEFS.win = \ + BSD YY_NO_UNISTD_H \ + SH_DEAL_WITH_CRLF PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS EXEC_HASH_BANG_SCRIPT \ + KASH_USE_FORKSHELL2 +kash_DEFS.os2 = \ + HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME PC_OS2_LIBPATHS \ + SH_DEAL_WITH_CRLF PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS EXEC_HASH_BANG_SCRIPT +kash_DEFS.darwin = \ + HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME +kash_DEFS.dragonfly = \ + HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME +kash_DEFS.freebsd = \ + HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME +kash_DEFS.gnukfbsd = HAVE_SYSCTL_H +kash_DEFS.netbsd = \ + HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME +kash_DEFS.openbsd = \ + HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME +kash_INCS = $(kash_0_OUTDIR) . # (the last is because of error.h) +kash_ASFLAGS.win = -g cv8 +kash_ASFLAGS.win.x86 = -f win32 +kash_ASFLAGS.win.amd64 = -f win64 +if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win" +kash_CFLAGS += -std=gnu99 +endif +kash_CFLAGS.win.amd64 = -GS- +ifdef KASH_WIN_FORKED_MODE +kash_LDFLAGS.win = -DYNAMICBASE:NO +endif +kash_SOURCES = \ + main.c \ + alias.c \ + cd.c \ + error.c \ + eval.c \ + exec.c \ + expand.c \ + histedit.c \ + input.c \ + jobs.c \ + mail.c \ + memalloc.c \ + mystring.c \ + options.c \ + output.c \ + parser.c \ + redir.c \ + show.c \ + syntax.c \ + trap.c \ + var.c \ + miscbltin.c \ + bltin/echo.c \ + bltin/kill.c \ + bltin/test.c \ + \ + $(kash_0_OUTDIR)/builtins.c \ + $(kash_0_OUTDIR)/init.c \ + $(kash_0_OUTDIR)/nodes.c \ + \ + setmode.c \ + shinstance.c \ + shheap.c \ + shthread.c \ + shfile.c +kash_SOURCES.gnuhurd = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strlcpy.c +kash_SOURCES.gnukfbsd = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strlcpy.c +kash_SOURCES.gnuknbsd = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strlcpy.c +kash_SOURCES.haiku = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strlcpy.c +kash_SOURCES.linux = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strlcpy.c +kash_SOURCES.solaris = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strlcpy.c +kash_SOURCES.win = \ + $(kash_0_OUTDIR)/sys_signame.c \ + strsignal.c \ + strlcpy.c \ + ../lib/nt/ntstat.c \ + ../lib/nt/nthlpcore.c \ + ../lib/nt/nthlpfs.c \ + ../lib/nt/nt_child_inject_standard_handles.c +ifdef KASH_WIN_FORKED_MODE +kash_SOURCES.win += \ + shfork-win.c \ + shforkA-win.asm +endif + +kash_INTERMEDIATES = \ + $(kash_0_OUTDIR)/builtins.h \ + $(kash_0_OUTDIR)/nodes.h \ + $(kash_0_OUTDIR)/token.h +kash_CLEAN = \ + $(kash_INTERMEDIATES) \ + $(kash_0_OUTDIR)/builtins.c \ + $(kash_0_OUTDIR)/init.c \ + $(kash_0_OUTDIR)/nodes.c + +kash_main.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV) + +## +## The manual page. +## +#INSTALLS += kash.man +#kash.man_TEMPLATE = usr.bin.man +#kash.man_SOURCES = sh.1=>kash.1 + + +# +# The signal name list: +# +$$(kash_0_OUTDIR)/sys_signame.c: $$(bld_signames_1_TARGET) | $$(dir $$@) + $< $@ + +BLDPROGS += bld_signames +bld_signames_TEMPLATE := BLD +bld_signames_DEFS := SHELL SMALL +bld_signames_SOURCES := bld_signames.c + + +if1of ($(KBUILD_TARGET), win os2) + KASH_USE_PREGENERATED_CODE = 1 +endif + +ifdef KASH_USE_PREGENERATED_CODE + +# +# Use the pregenerated code. +# +kash_SOURCES += \ + $(kash_0_OUTDIR)/arith.c \ + $(kash_0_OUTDIR)/arith_lex.c +kash_INTERMEDIATES += \ + $(kash_0_OUTDIR)/arith.h + +define def_copy_generated +$$$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src) + $$(RM) -f $$@ + $$(CP) -f $$^ $$@ +endef + +$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\ +$(eval $(def_copy_generated))) + +else # !KASH_USE_PREGENERATED_CODE + +# +# Generate the code on the fly. +# + +USES += lex yacc +kash_USES = lex yacc +kash_LEXTOOL = FLEX +kash_LEXFLAGS = -8 +#kash_YACCTOOL = BISON +kash_YACCTOOL = YACC +kash_YACCFLAGS = -ld +kash_SOURCES += \ + arith.y \ + arith_lex.l + +# +# ATTENTION! ATTENTION! ATTENTION! +# +# Older ash versions has trouble with some of these scripts, great. +# Kudos to the NetBSD guys for this clever move. ;) +# +# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea. +# +BOOTSTRAP_SHELL ?= $(SHELL) + +$$(kash_0_OUTDIR)/builtins.h + $$(kash_0_OUTDIR)/builtins.c: \ + $$(kash_DEFPATH)/mkbuiltins \ + $$(kash_DEFPATH)/shell.h \ + $$(kash_DEFPATH)/builtins.def \ + | $$(dir $$@) + $(BOOTSTRAP_SHELL) $+ $(dir $@) + [ -f $(kash_0_OUTDIR)/builtins.h ] + +$$(kash_0_OUTDIR)/nodes.h + $$(kash_0_OUTDIR)/nodes.c: \ + $$(kash_DEFPATH)/mknodes.sh \ + $$(kash_DEFPATH)/nodetypes \ + $$(kash_DEFPATH)/nodes.c.pat \ + | $$(dir $$@) + $(BOOTSTRAP_SHELL) $+ $(dir $@) + [ -f $(dir $@)/nodes.h ] + +$$(kash_0_OUTDIR)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@) + $(BOOTSTRAP_SHELL) $+ + $(MV) token.h $@ + +$$(kash_0_OUTDIR)/init.c: \ + $$(kash_DEFPATH)/mkinit.sh \ + $$(abspathex $$(filter-out $$(kash_0_OUTDIR)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \ + | $$(dir $$@) + $(BOOTSTRAP_SHELL) $+ + $(MV) init.c $@ + +endif # !KASH_USE_PREGENERATED_CODE + +# +# For debugging file handle inheritance on Windows. +# +if "$(KBUILD_TARGET)" == win && 0 +PROGRAMS += tstDump +tstDump_TEMPLATE = BIN +tstDump_SOURCES = tstDump.c +endif + +# Include the sub-makefile. +include $(PATH_SUB_CURRENT)/tests/Makefile.kmk + +include $(FILE_KBUILD_SUB_FOOTER) + + |