VirtualBox

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

Last change on this file since 2546 was 2546, checked in by bird, 13 years ago

Applied modified patches for Haiku support from Mike Smith.

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