VirtualBox

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

Last change on this file since 2657 was 2652, checked in by bird, 12 years ago

kash: Fixes for hash-bang-scripts on windows. Related debug tracing fix. Another CWD slash fix. Fixed a couple of assertions.

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