VirtualBox

source: kBuild/trunk/src/ash/Makefile.kmk@ 2302

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

*: Updated copyright to 2009 and normalized name & email.

  • Property svn:eol-style set to native
File size: 4.4 KB
Line 
1# $Id: $
2## @file
3# Sub-makefile for kmk_ash.
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#INSTALLS = ash.man
30
31PROGRAMS += kmk_ash
32kmk_ash_TEMPLATE = BIN
33kmk_ash_DEFS = lint SHELL SMALL KMK
34if "$(USER)" == "bird"
35kmk_ash_DEFS.debug = DEBUG=2
36endif
37kmk_ash_DEFS.linux = BSD
38kmk_ash_DEFS.solaris = BSD
39kmk_ash_DEFS.win = \
40 BSD PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS PC_SLASHES
41kmk_ash_DEFS.os2 = \
42 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME \
43 EXEC_HASH_BANG_SCRIPT PC_OS2_LIBPATHS PC_PATH_SEP PC_DRIVE_LETTERS PC_EXE_EXTS PC_SLASHES
44kmk_ash_DEFS.darwin = \
45 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
46kmk_ash_DEFS.dragonfly = \
47 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
48kmk_ash_DEFS.freebsd = \
49 HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
50kmk_ash_INCS = $(PATH_kmk_ash) . # (the last is because of error.h)
51kmk_ash_CFLAGS.win = -I. ## @todo kBuild bug?
52kmk_ash_INCS.win = win
53kmk_ash_SOURCES = \
54 alias.c \
55 cd.c \
56 error.c \
57 eval.c \
58 exec.c \
59 expand.c \
60 histedit.c \
61 input.c \
62 jobs.c \
63 mail.c \
64 main.c \
65 memalloc.c \
66 miscbltin.c \
67 mystring.c \
68 options.c \
69 output.c \
70 parser.c \
71 redir.c \
72 show.c \
73 syntax.c \
74 trap.c \
75 var.c \
76 bltin/echo.c \
77 bltin/kill.c \
78 bltin/test.c \
79 $(PATH_kmk_ash)/builtins.c \
80 $(PATH_kmk_ash)/init.c \
81 $(PATH_kmk_ash)/nodes.c
82kmk_ash_SOURCES.linux = \
83 sys_signame.c \
84 strlcpy.c \
85 setmode.c
86kmk_ash_SOURCES.win = \
87 win/mscfakes.c \
88 win/err.c \
89 win/dirent.c \
90 sys_signame.c \
91 strlcpy.c \
92 setmode.c
93kmk_ash_SOURCES.solaris = \
94 sys_signame.c \
95 strlcpy.c \
96 setmode.c
97
98kmk_ash_INTERMEDIATES = \
99 $(PATH_kmk_ash)/builtins.h \
100 $(PATH_kmk_ash)/nodes.h \
101 $(PATH_kmk_ash)/token.h
102kmk_ash_CLEAN = \
103 $(kmk_ash_INTERMEDIATES) \
104 $(PATH_kmk_ash)/builtins.c \
105 $(PATH_kmk_ash)/init.c \
106 $(PATH_kmk_ash)/nodes.c
107
108kmk_ash.man_TEMPLATE = usr.bin.man
109kmk_ash.man_SOURCES = \
110 sh.1=>ash.1
111#ash.man_SYMLINKS = \
112# ash.1.gz=>sh.1
113
114if1of ($(KBUILD_TARGET), win nt)
115#
116# Use the pregenerated code.
117#
118kmk_ash_DEPS :=
119kmk_ash_SOURCES += $(PATH_kmk_ash)/arith_lex.c
120
121include $(FILE_KBUILD_SUB_FOOTER)
122
123define def_copy_generated
124$(PATH_kmk_ash)/$(src): generated/$(src)
125 $$(RM) -f $$@
126 $$(CP) -f $$^ $$@
127endef
128
129$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
130$(eval $(def_copy_generated)))
131
132
133else
134#
135# Generate the code on the fly.
136#
137
138USES += lex yacc
139kmk_ash_USES = lex yacc
140kmk_ash_LEXTOOL = FLEX
141kmk_ash_LEXFLAGS = -8
142#kmk_ash_YACCTOOL = BISON
143kmk_ash_YACCTOOL = YACC
144kmk_ash_YACCFLAGS = -ld
145kmk_ash_SOURCES += \
146 arith.y \
147 arith_lex.l
148
149
150include $(FILE_KBUILD_SUB_FOOTER)
151
152#
153# ATTENTION! ATTENTION! ATTENTION!
154#
155# Older ash versions has trouble with some of these scripts, great.
156# Kudos to the NetBSD guys for this clever move. ;)
157#
158# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
159#
160BOOTSTRAP_SHELL ?= $(SHELL)
161
162$(PATH_kmk_ash)/builtins.h + $(PATH_kmk_ash)/builtins.c: \
163 $(kmk_ash_PATH)/mkbuiltins \
164 $(kmk_ash_PATH)/shell.h \
165 $(kmk_ash_PATH)/builtins.def \
166 | $(call DIRDEP,$(PATH_kmk_ash))
167 $(BOOTSTRAP_SHELL) $+ $(dir $@)
168 [ -f $(PATH_kmk_ash)/builtins.h ]
169
170$(PATH_kmk_ash)/nodes.h + $(PATH_kmk_ash)/nodes.c: \
171 $(kmk_ash_PATH)/mknodes.sh \
172 $(kmk_ash_PATH)/nodetypes \
173 $(kmk_ash_PATH)/nodes.c.pat \
174 | $(call DIRDEP,$(PATH_kmk_ash))
175 $(BOOTSTRAP_SHELL) $+ $(dir $@)
176 [ -f $(dir $@)/nodes.h ]
177
178$(PATH_kmk_ash)/token.h: $(kmk_ash_PATH)/mktokens | $(call DIRDEP,$(PATH_kmk_ash))
179 $(BOOTSTRAP_SHELL) $+
180 $(MV) token.h $@
181
182$(PATH_kmk_ash)/init.c: \
183 $(kmk_ash_PATH)/mkinit.sh \
184 $(abspathex $(filter-out $(PATH_kmk_ash)/%,$(kmk_ash_SOURCES)), $(kmk_ash_PATH)) \
185 | $(call DIRDEP,$(PATH_kmk_ash))
186 $(BOOTSTRAP_SHELL) $+
187 $(MV) init.c $@
188
189endif # generate on the fly
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