VirtualBox

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

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

Forgot to remove debug fprintfs.

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