VirtualBox

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

最後變更 在這個檔案從3409是 3409,由 bird 提交於 5 年 前

kash: Generate the signal names at compile time rather than lazily at runtime. This should be more efficient, though may cause trouble if cross building.

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:keywords 設為 Id
檔案大小: 5.8 KB
 
1# $Id: Makefile.kmk 3409 2020-08-13 09:49:06Z 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.gnukfbsd = HAVE_SYSCTL_H
56kash_DEFS.netbsd = \
57 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
58kash_DEFS.openbsd = \
59 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
60kash_INCS = $(kash_0_OUTDIR) . # (the last is because of error.h)
61kash_ASFLAGS.win = -g cv8
62kash_ASFLAGS.win.x86 = -f win32
63kash_ASFLAGS.win.amd64 = -f win64
64if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
65kash_CFLAGS += -std=gnu99
66endif
67kash_CFLAGS.win.amd64 = -GS-
68kash_LDFLAGS.win = -DYNAMICBASE:NO
69kash_SOURCES = \
70 main.c \
71 alias.c \
72 cd.c \
73 error.c \
74 eval.c \
75 exec.c \
76 expand.c \
77 histedit.c \
78 input.c \
79 jobs.c \
80 mail.c \
81 memalloc.c \
82 mystring.c \
83 options.c \
84 output.c \
85 parser.c \
86 redir.c \
87 show.c \
88 syntax.c \
89 trap.c \
90 var.c \
91 miscbltin.c \
92 bltin/echo.c \
93 bltin/kill.c \
94 bltin/test.c \
95 \
96 $(kash_0_OUTDIR)/builtins.c \
97 $(kash_0_OUTDIR)/init.c \
98 $(kash_0_OUTDIR)/nodes.c \
99 \
100 setmode.c \
101 shinstance.c \
102 shheap.c \
103 shthread.c \
104 shfile.c
105kash_SOURCES.gnuhurd = \
106 $(kash_0_OUTDIR)/sys_signame.c \
107 strlcpy.c
108kash_SOURCES.gnukfbsd = \
109 $(kash_0_OUTDIR)/sys_signame.c \
110 strlcpy.c
111kash_SOURCES.gnuknbsd = \
112 $(kash_0_OUTDIR)/sys_signame.c \
113 strlcpy.c
114kash_SOURCES.haiku = \
115 $(kash_0_OUTDIR)/sys_signame.c \
116 strlcpy.c
117kash_SOURCES.linux = \
118 $(kash_0_OUTDIR)/sys_signame.c \
119 strlcpy.c
120kash_SOURCES.solaris = \
121 $(kash_0_OUTDIR)/sys_signame.c \
122 strlcpy.c
123kash_SOURCES.win = \
124 $(kash_0_OUTDIR)/sys_signame.c \
125 strsignal.c \
126 strlcpy.c \
127 shfork-win.c \
128 shforkA-win.asm
129
130kash_INTERMEDIATES = \
131 $(kash_0_OUTDIR)/builtins.h \
132 $(kash_0_OUTDIR)/nodes.h \
133 $(kash_0_OUTDIR)/token.h
134kash_CLEAN = \
135 $(kash_INTERMEDIATES) \
136 $(kash_0_OUTDIR)/builtins.c \
137 $(kash_0_OUTDIR)/init.c \
138 $(kash_0_OUTDIR)/nodes.c
139
140kash_main.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV)
141
142##
143## The manual page.
144##
145#INSTALLS += kash.man
146#kash.man_TEMPLATE = usr.bin.man
147#kash.man_SOURCES = sh.1=>kash.1
148
149
150#
151# The signal name list:
152#
153$$(kash_0_OUTDIR)/sys_signame.c: $$(bld_signames_1_TARGET) | $$(dir $$@)
154 $< $@
155
156BLDPROGS += bld_signames
157bld_signames_TEMPLATE := BLD
158bld_signames_DEFS := SHELL SMALL
159bld_signames_SOURCES := bld_signames.c
160
161
162if1of ($(KBUILD_TARGET), win os2)
163 KASH_USE_PREGENERATED_CODE = 1
164endif
165
166ifdef KASH_USE_PREGENERATED_CODE
167
168#
169# Use the pregenerated code.
170#
171kash_SOURCES += \
172 $(kash_0_OUTDIR)/arith.c \
173 $(kash_0_OUTDIR)/arith_lex.c
174kash_INTERMEDIATES += \
175 $(kash_0_OUTDIR)/arith.h
176
177define def_copy_generated
178$$$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src)
179 $$(RM) -f $$@
180 $$(CP) -f $$^ $$@
181endef
182
183$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
184$(eval $(def_copy_generated)))
185
186else # !KASH_USE_PREGENERATED_CODE
187
188#
189# Generate the code on the fly.
190#
191
192USES += lex yacc
193kash_USES = lex yacc
194kash_LEXTOOL = FLEX
195kash_LEXFLAGS = -8
196#kash_YACCTOOL = BISON
197kash_YACCTOOL = YACC
198kash_YACCFLAGS = -ld
199kash_SOURCES += \
200 arith.y \
201 arith_lex.l
202
203#
204# ATTENTION! ATTENTION! ATTENTION!
205#
206# Older ash versions has trouble with some of these scripts, great.
207# Kudos to the NetBSD guys for this clever move. ;)
208#
209# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
210#
211BOOTSTRAP_SHELL ?= $(SHELL)
212
213$$(kash_0_OUTDIR)/builtins.h + $$(kash_0_OUTDIR)/builtins.c: \
214 $$(kash_DEFPATH)/mkbuiltins \
215 $$(kash_DEFPATH)/shell.h \
216 $$(kash_DEFPATH)/builtins.def \
217 | $$(dir $$@)
218 $(BOOTSTRAP_SHELL) $+ $(dir $@)
219 [ -f $(kash_0_OUTDIR)/builtins.h ]
220
221$$(kash_0_OUTDIR)/nodes.h + $$(kash_0_OUTDIR)/nodes.c: \
222 $$(kash_DEFPATH)/mknodes.sh \
223 $$(kash_DEFPATH)/nodetypes \
224 $$(kash_DEFPATH)/nodes.c.pat \
225 | $$(dir $$@)
226 $(BOOTSTRAP_SHELL) $+ $(dir $@)
227 [ -f $(dir $@)/nodes.h ]
228
229$$(kash_0_OUTDIR)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
230 $(BOOTSTRAP_SHELL) $+
231 $(MV) token.h $@
232
233$$(kash_0_OUTDIR)/init.c: \
234 $$(kash_DEFPATH)/mkinit.sh \
235 $$(abspathex $$(filter-out $$(kash_0_OUTDIR)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
236 | $$(dir $$@)
237 $(BOOTSTRAP_SHELL) $+
238 $(MV) init.c $@
239
240endif # !KASH_USE_PREGENERATED_CODE
241
242#
243# For debugging file handle inheritance on Windows.
244#
245if "$(KBUILD_TARGET)" == win && 0
246PROGRAMS += tstDump
247tstDump_TEMPLATE = BIN
248tstDump_SOURCES = tstDump.c
249endif
250
251# Include the sub-makefile.
252include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
253
254include $(FILE_KBUILD_SUB_FOOTER)
255
256
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette