VirtualBox

source: kBuild/trunk/src/kash/Makefile.kmk@ 2423

Last change on this file since 2423 was 2423, checked in by bird, 14 years ago

kash: made the SHFILE_IN_USE mode work on unix (because openbsd has a very hackish pthread library).

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1# $Id: Makefile.kmk 2423 2010-10-17 23:43:35Z bird $
2## @file
3# Sub-makefile for kash.
4#
5
6#
7# Copyright (c) 2005-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
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#
30# The program.
31#
32PROGRAMS += kash
33kash_TEMPLATE = BIN-THREADED
34kash_NAME = kmk_ash
35kash_ASTOOL = YASM
36kash_DEFS = lint SHELL SMALL
37kash_DEFS += SH_FORKED_MODE
38kash_DEFS.debug = DEBUG=2
39kash_DEFS.linux = BSD
40kash_DEFS.solaris = BSD
41## @todo bring over PC_SLASHES?
42kash_DEFS.win = \
43 BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS YY_NO_UNISTD_H SH_DEAL_WITH_CRLF
44kash_DEFS.os2 = \
45 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
46 EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
47kash_DEFS.darwin = \
48 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
49kash_DEFS.dragonfly = \
50 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
51kash_DEFS.freebsd = \
52 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
53kash_DEFS.openbsd = \
54 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
55kash_INCS = $(kash_0_OUTDIR) . # (the last is because of error.h)
56kash_ASFLAGS.win = -g cv8
57kash_ASFLAGS.win.x86 = -f win32
58kash_ASFLAGS.win.amd64 = -f win64
59if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
60kash_CFLAGS += -std=gnu99
61endif
62kash_CFLAGS.win.amd64 = -GS-
63kash_SOURCES = \
64 main.c \
65 alias.c \
66 cd.c \
67 error.c \
68 eval.c \
69 exec.c \
70 expand.c \
71 histedit.c \
72 input.c \
73 jobs.c \
74 mail.c \
75 memalloc.c \
76 mystring.c \
77 options.c \
78 output.c \
79 parser.c \
80 redir.c \
81 show.c \
82 syntax.c \
83 trap.c \
84 var.c \
85 miscbltin.c \
86 bltin/echo.c \
87 bltin/kill.c \
88 bltin/test.c \
89 \
90 $(kash_0_OUTDIR)/builtins.c \
91 $(kash_0_OUTDIR)/init.c \
92 $(kash_0_OUTDIR)/nodes.c \
93 \
94 setmode.c \
95 shinstance.c \
96 shheap.c \
97 shthread.c \
98 shfile.c
99kash_SOURCES.linux = \
100 sys_signame.c \
101 strlcpy.c
102kash_SOURCES.win = \
103 sys_signame.c \
104 strlcpy.c \
105 shfork-win.c \
106 shforkA-win.asm
107kash_SOURCES.solaris = \
108 sys_signame.c \
109 strlcpy.c
110
111kash_INTERMEDIATES = \
112 $(kash_0_OUTDIR)/builtins.h \
113 $(kash_0_OUTDIR)/nodes.h \
114 $(kash_0_OUTDIR)/token.h
115kash_CLEAN = \
116 $(kash_INTERMEDIATES) \
117 $(kash_0_OUTDIR)/builtins.c \
118 $(kash_0_OUTDIR)/init.c \
119 $(kash_0_OUTDIR)/nodes.c
120
121##
122## The manual page.
123##
124#INSTALLS += kash.man
125#kash.man_TEMPLATE = usr.bin.man
126#kash.man_SOURCES = sh.1=>kash.1
127
128
129if1of ($(KBUILD_TARGET), win)
130
131#
132# Use the pregenerated code.
133#
134kash_SOURCES += \
135 $(kash_0_OUTDIR)/arith.c \
136 $(kash_0_OUTDIR)/arith_lex.c
137kash_INTERMEDIATES += \
138 $(kash_0_OUTDIR)/arith.h
139
140define def_copy_generated
141$$$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src)
142 $$(RM) -f $$@
143 $$(CP) -f $$^ $$@
144endef
145
146$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
147$(eval $(def_copy_generated)))
148
149else
150
151#
152# Generate the code on the fly.
153#
154
155USES += lex yacc
156kash_USES = lex yacc
157kash_LEXTOOL = FLEX
158kash_LEXFLAGS = -8
159#kash_YACCTOOL = BISON
160kash_YACCTOOL = YACC
161kash_YACCFLAGS = -ld
162kash_SOURCES += \
163 arith.y \
164 arith_lex.l
165
166#
167# ATTENTION! ATTENTION! ATTENTION!
168#
169# Older ash versions has trouble with some of these scripts, great.
170# Kudos to the NetBSD guys for this clever move. ;)
171#
172# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
173#
174BOOTSTRAP_SHELL ?= $(SHELL)
175
176$$(kash_0_OUTDIR)/builtins.h + $$(kash_0_OUTDIR)/builtins.c: \
177 $$(kash_DEFPATH)/mkbuiltins \
178 $$(kash_DEFPATH)/shell.h \
179 $$(kash_DEFPATH)/builtins.def \
180 | $$(dir $$@)
181 $(BOOTSTRAP_SHELL) $+ $(dir $@)
182 [ -f $(kash_0_OUTDIR)/builtins.h ]
183
184$$(kash_0_OUTDIR)/nodes.h + $$(kash_0_OUTDIR)/nodes.c: \
185 $$(kash_DEFPATH)/mknodes.sh \
186 $$(kash_DEFPATH)/nodetypes \
187 $$(kash_DEFPATH)/nodes.c.pat \
188 | $$(dir $$@)
189 $(BOOTSTRAP_SHELL) $+ $(dir $@)
190 [ -f $(dir $@)/nodes.h ]
191
192$$(kash_0_OUTDIR)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
193 $(BOOTSTRAP_SHELL) $+
194 $(MV) token.h $@
195
196$$(kash_0_OUTDIR)/init.c: \
197 $$(kash_DEFPATH)/mkinit.sh \
198 $$(abspathex $$(filter-out $$(kash_0_OUTDIR)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
199 | $$(dir $$@)
200 $(BOOTSTRAP_SHELL) $+
201 $(MV) init.c $@
202
203endif
204
205#
206# For debugging file handle inheritance on Windows.
207#
208if "$(KBUILD_TARGET)" == win && 0
209PROGRAMS += tstDump
210tstDump_TEMPLATE = BIN
211tstDump_SOURCES = tstDump.c
212endif
213
214# Include the sub-makefile.
215include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
216
217include $(FILE_KBUILD_SUB_FOOTER)
218
219
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