VirtualBox

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

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

kash: Added KASH_USE_PREGENERATED_CODE trick to the makefile.

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:keywords 設為 Id
檔案大小: 5.4 KB
 
1# $Id: Makefile.kmk 3073 2017-10-02 08:45:19Z 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.gnukfbsd = \
106 sys_signame.c \
107 strlcpy.c
108kash_SOURCES.gnuknbsd = \
109 sys_signame.c \
110 strlcpy.c
111kash_SOURCES.haiku = \
112 sys_signame.c \
113 strlcpy.c
114kash_SOURCES.linux = \
115 sys_signame.c \
116 strlcpy.c
117kash_SOURCES.solaris = \
118 sys_signame.c \
119 strlcpy.c
120kash_SOURCES.win = \
121 sys_signame.c \
122 strlcpy.c \
123 shfork-win.c \
124 shforkA-win.asm
125
126kash_INTERMEDIATES = \
127 $(kash_0_OUTDIR)/builtins.h \
128 $(kash_0_OUTDIR)/nodes.h \
129 $(kash_0_OUTDIR)/token.h
130kash_CLEAN = \
131 $(kash_INTERMEDIATES) \
132 $(kash_0_OUTDIR)/builtins.c \
133 $(kash_0_OUTDIR)/init.c \
134 $(kash_0_OUTDIR)/nodes.c
135
136kash_main.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV)
137
138##
139## The manual page.
140##
141#INSTALLS += kash.man
142#kash.man_TEMPLATE = usr.bin.man
143#kash.man_SOURCES = sh.1=>kash.1
144
145
146if1of ($(KBUILD_TARGET), win os2)
147 KASH_USE_PREGENERATED_CODE = 1
148endif
149
150ifdef KASH_USE_PREGENERATED_CODE
151
152#
153# Use the pregenerated code.
154#
155kash_SOURCES += \
156 $(kash_0_OUTDIR)/arith.c \
157 $(kash_0_OUTDIR)/arith_lex.c
158kash_INTERMEDIATES += \
159 $(kash_0_OUTDIR)/arith.h
160
161define def_copy_generated
162$$$$(kash_0_OUTDIR)/$(src): $(PATH_SUB_CURRENT)/generated/$(src)
163 $$(RM) -f $$@
164 $$(CP) -f $$^ $$@
165endef
166
167$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
168$(eval $(def_copy_generated)))
169
170else # !KASH_USE_PREGENERATED_CODE
171
172#
173# Generate the code on the fly.
174#
175
176USES += lex yacc
177kash_USES = lex yacc
178kash_LEXTOOL = FLEX
179kash_LEXFLAGS = -8
180#kash_YACCTOOL = BISON
181kash_YACCTOOL = YACC
182kash_YACCFLAGS = -ld
183kash_SOURCES += \
184 arith.y \
185 arith_lex.l
186
187#
188# ATTENTION! ATTENTION! ATTENTION!
189#
190# Older ash versions has trouble with some of these scripts, great.
191# Kudos to the NetBSD guys for this clever move. ;)
192#
193# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
194#
195BOOTSTRAP_SHELL ?= $(SHELL)
196
197$$(kash_0_OUTDIR)/builtins.h + $$(kash_0_OUTDIR)/builtins.c: \
198 $$(kash_DEFPATH)/mkbuiltins \
199 $$(kash_DEFPATH)/shell.h \
200 $$(kash_DEFPATH)/builtins.def \
201 | $$(dir $$@)
202 $(BOOTSTRAP_SHELL) $+ $(dir $@)
203 [ -f $(kash_0_OUTDIR)/builtins.h ]
204
205$$(kash_0_OUTDIR)/nodes.h + $$(kash_0_OUTDIR)/nodes.c: \
206 $$(kash_DEFPATH)/mknodes.sh \
207 $$(kash_DEFPATH)/nodetypes \
208 $$(kash_DEFPATH)/nodes.c.pat \
209 | $$(dir $$@)
210 $(BOOTSTRAP_SHELL) $+ $(dir $@)
211 [ -f $(dir $@)/nodes.h ]
212
213$$(kash_0_OUTDIR)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
214 $(BOOTSTRAP_SHELL) $+
215 $(MV) token.h $@
216
217$$(kash_0_OUTDIR)/init.c: \
218 $$(kash_DEFPATH)/mkinit.sh \
219 $$(abspathex $$(filter-out $$(kash_0_OUTDIR)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
220 | $$(dir $$@)
221 $(BOOTSTRAP_SHELL) $+
222 $(MV) init.c $@
223
224endif # !KASH_USE_PREGENERATED_CODE
225
226#
227# For debugging file handle inheritance on Windows.
228#
229if "$(KBUILD_TARGET)" == win && 0
230PROGRAMS += tstDump
231tstDump_TEMPLATE = BIN
232tstDump_SOURCES = tstDump.c
233endif
234
235# Include the sub-makefile.
236include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
237
238include $(FILE_KBUILD_SUB_FOOTER)
239
240
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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