VirtualBox

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

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

hash: cooked our own heap on windows (for forking).

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