VirtualBox

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

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

kash: hacking.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1# $Id: Makefile.kmk 1784 2008-09-13 03:27:59Z bird $
2## @file
3# Sub-makefile for kash.
4#
5
6#
7# Copyright (c) 2005-2008 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 2 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, write to the Free Software
23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24#
25#
26
27SUB_DEPTH = ../..
28include $(KBUILD_PATH)/subheader.kmk
29
30#
31# The program.
32#
33PROGRAMS += kash
34kash_TEMPLATE = BIN
35kash_DEFS = lint SHELL SMALL
36kash_DEFS += SH_STUB_MODE # for the time being.
37kash_DEFS.debug = DEBUG
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)
53if "$(USER)" == "bird" && "$(KBUILD_TARGET)" != "win"
54kash_CFLAGS += -std=gnu99
55endif
56kash_SOURCES = \
57 main.c \
58 alias.c \
59 cd.c \
60 error.c \
61 eval.c \
62 exec.c \
63 expand.c \
64 histedit.c \
65 input.c \
66 jobs.c \
67 mail.c \
68 memalloc.c \
69 mystring.c \
70 options.c \
71 output.c \
72 parser.c \
73 redir.c \
74 show.c \
75 syntax.c \
76 trap.c \
77 var.c \
78 miscbltin.c \
79 bltin/echo.c \
80 bltin/kill.c \
81 bltin/test.c \
82 \
83 $(PATH_kash)/arith.c \
84 $(PATH_kash)/arith_lex.c \
85 $(PATH_kash)/builtins.c \
86 $(PATH_kash)/init.c \
87 $(PATH_kash)/nodes.c \
88 \
89 setmode.c \
90 shinstance.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_ORDERDEPS :=
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
185include $(FILE_KBUILD_SUB_FOOTER)
186
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