VirtualBox

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

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

kash: start using it on windows.

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