VirtualBox

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

Last change on this file since 2292 was 2292, checked in by bird, 16 years ago

kash: forking on widnows.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1# $Id: Makefile.kmk 2292 2009-02-28 04:46:25Z bird $
2## @file
3# Sub-makefile for kash.
4#
5
6#
7# Copyright (c) 2005-2009 knut st. osmundsen <bird-kBuild-spamix@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
34kash_ASTOOL = YASM
35kash_DEFS = lint SHELL SMALL
36kash_DEFS += SH_STUB_MODE # for the time being.
37kash_DEFS.debug = DEBUG=2
38kash_DEFS.linux = BSD
39kash_DEFS.solaris = BSD
40## @todo bring over PC_SLASHES?
41kash_DEFS.win = \
42 BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS YY_NO_UNISTD_H
43kash_DEFS.os2 = \
44 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
45 EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS
46kash_DEFS.darwin = \
47 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
48kash_DEFS.dragonfly = \
49 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
50kash_DEFS.freebsd = \
51 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
52kash_INCS = $(PATH_kash) . # (the last is because of error.h)
53kash_ASFLAGS.win = -g cv8
54kash_ASFLAGS.win.x86 = -f win32
55kash_ASFLAGS.win.amd64 = -f win64
56if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
57kash_CFLAGS += -std=gnu99
58endif
59kash_SOURCES = \
60 main.c \
61 alias.c \
62 cd.c \
63 error.c \
64 eval.c \
65 exec.c \
66 expand.c \
67 histedit.c \
68 input.c \
69 jobs.c \
70 mail.c \
71 memalloc.c \
72 mystring.c \
73 options.c \
74 output.c \
75 parser.c \
76 redir.c \
77 show.c \
78 syntax.c \
79 trap.c \
80 var.c \
81 miscbltin.c \
82 bltin/echo.c \
83 bltin/kill.c \
84 bltin/test.c \
85 \
86 $(PATH_kash)/arith.c \
87 $(PATH_kash)/arith_lex.c \
88 $(PATH_kash)/builtins.c \
89 $(PATH_kash)/init.c \
90 $(PATH_kash)/nodes.c \
91 \
92 setmode.c \
93 shinstance.c \
94 shheap.c \
95 shthread.c \
96 shfile.c
97kash_SOURCES.linux = \
98 sys_signame.c \
99 strlcpy.c
100kash_SOURCES.win = \
101 sys_signame.c \
102 strlcpy.c \
103 shfork-win.c \
104 shforkA-win.asm
105kash_SOURCES.solaris = \
106 sys_signame.c \
107 strlcpy.c
108
109kash_INTERMEDIATES = \
110 $(PATH_kash)/arith.h \
111 $(PATH_kash)/builtins.h \
112 $(PATH_kash)/nodes.h \
113 $(PATH_kash)/token.h
114kash_CLEAN = \
115 $(kash_INTERMEDIATES) \
116 $(PATH_kash)/arith.c \
117 $(PATH_kash)/arith_lex.c \
118 $(PATH_kash)/builtins.c \
119 $(PATH_kash)/init.c \
120 $(PATH_kash)/nodes.c
121
122##
123## The manual page.
124##
125#INSTALLS += kash.man
126#kash.man_TEMPLATE = usr.bin.man
127#kash.man_SOURCES = sh.1=>kash.1
128
129
130if1of ($(KBUILD_TARGET), win)
131
132#
133# Use the pregenerated code.
134#
135kash_INTERMEDIATES :=
136kash_INCS += generated
137kash_SOURCES := $(patsubst $(PATH_kash)/%,generated/%,$(kash_SOURCES))
138
139else
140
141#
142# ATTENTION! ATTENTION! ATTENTION!
143#
144# Older ash versions has trouble with some of these scripts, great.
145# Kudos to the NetBSD guys for this clever move. ;)
146#
147# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
148#
149BOOTSTRAP_SHELL ?= $(SHELL)
150ifndef YACC
151 YACC := $(firstword $(which byacc) $(which yacc) yacc)
152endif
153
154$$(PATH_kash)/arith.h + $$(PATH_kash)/arith.c: arith.y | $$(dir $$@)
155 $(YACC) -ld $^
156 $(MV) -f y.tab.c $(PATH_kash)/arith.c
157 $(MV) -f y.tab.h $(PATH_kash)/arith.h
158
159$$(PATH_kash)/arith_lex.c: $$(kash_DEFPATH)/arith_lex.l | $$(dir $$@)
160 flex -8 -o$@ $^ # 8-bit lex scanner for arithmetic
161
162$$(PATH_kash)/builtins.h + $$(PATH_kash)/builtins.c: \
163 $$(kash_DEFPATH)/mkbuiltins \
164 $$(kash_DEFPATH)/shell.h \
165 $$(kash_DEFPATH)/builtins.def \
166 | $$(dir $$@)
167 $(BOOTSTRAP_SHELL) $+ $(dir $@)
168 [ -f $(PATH_kash)/builtins.h ]
169
170$$(PATH_kash)/nodes.h + $$(PATH_kash)/nodes.c: \
171 $$(kash_DEFPATH)/mknodes.sh \
172 $$(kash_DEFPATH)/nodetypes \
173 $$(kash_DEFPATH)/nodes.c.pat \
174 | $$(dir $$@)
175 $(BOOTSTRAP_SHELL) $+ $(dir $@)
176 [ -f $(dir $@)/nodes.h ]
177
178$$(PATH_kash)/token.h: $$(kash_DEFPATH)/mktokens | $$(dir $$@)
179 $(BOOTSTRAP_SHELL) $+
180 $(MV) token.h $@
181
182$$(PATH_kash)/init.c: \
183 $$(kash_DEFPATH)/mkinit.sh \
184 $$(abspathex $$(filter-out $$(PATH_kash)/%,$$(kash_SOURCES)), $$(kash_DEFPATH)) \
185 | $$(dir $$@)
186 $(BOOTSTRAP_SHELL) $+
187 $(MV) init.c $@
188
189endif
190
191# Include the sub-makefile.
192include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
193
194include $(FILE_KBUILD_SUB_FOOTER)
195
196
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