VirtualBox

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

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

GPLv2 -> GPLv3. See Ticket #44 for clarifications. Fixes #44.

  • Property svn:eol-style set to native
File size: 4.9 KB
Line 
1# $Id: $
2## @file
3# Sub-makefile for kmk_ash.
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 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)/arith.c \
80 $(PATH_kmk_ash)/builtins.c \
81 $(PATH_kmk_ash)/init.c \
82 $(PATH_kmk_ash)/nodes.c
83kmk_ash_SOURCES.linux = \
84 sys_signame.c \
85 strlcpy.c \
86 setmode.c
87kmk_ash_SOURCES.win = \
88 win/mscfakes.c \
89 win/err.c \
90 win/dirent.c \
91 sys_signame.c \
92 strlcpy.c \
93 setmode.c
94kmk_ash_SOURCES.solaris = \
95 sys_signame.c \
96 strlcpy.c \
97 setmode.c
98
99kmk_ash_INTERMEDIATES = \
100 $(PATH_kmk_ash)/arith.h \
101 $(PATH_kmk_ash)/builtins.h \
102 $(PATH_kmk_ash)/nodes.h \
103 $(PATH_kmk_ash)/token.h
104kmk_ash_CLEAN = \
105 $(kmk_ash_INTERMEDIATES) \
106 $(PATH_kmk_ash)/arith.c \
107 $(PATH_kmk_ash)/arith_lex.c \
108 $(PATH_kmk_ash)/builtins.c \
109 $(PATH_kmk_ash)/init.c \
110 $(PATH_kmk_ash)/nodes.c
111
112kmk_ash.man_TEMPLATE = usr.bin.man
113kmk_ash.man_SOURCES = \
114 sh.1=>ash.1
115#ash.man_SYMLINKS = \
116# ash.1.gz=>sh.1
117
118if1of ($(KBUILD_TARGET), win nt)
119#
120# Use the pregenerated code.
121#
122kmk_ash_DEPS :=
123kmk_ash_SOURCES += $(PATH_kmk_ash)/arith_lex.c
124
125include $(FILE_KBUILD_SUB_FOOTER)
126
127define def_copy_generated
128$(PATH_kmk_ash)/$(src): generated/$(src)
129 $$(RM) -f $$@
130 $$(CP) -f $$^ $$@
131endef
132
133$(foreach src, arith.h arith.c arith_lex.c builtins.h builtins.c nodes.h nodes.c token.h init.c,\
134$(eval $(def_copy_generated)))
135
136
137else
138#
139# Generate the code on the fly.
140#
141
142ifeq (1,2) #disabled for now.
143kmk_ash_USES = lex #yacc
144kmk_ash_SOURCES += arith_lex.l
145kmk_ash_LEXTOOL = FLEX
146kmk_ash_LEXFLAGS = -8
147else
148kmk_ash_SOURCES += $(PATH_kmk_ash)/arith_lex.c
149endif
150
151include $(FILE_KBUILD_SUB_FOOTER)
152
153#
154# ATTENTION! ATTENTION! ATTENTION!
155#
156# Older ash versions has trouble with some of these scripts, great.
157# Kudos to the NetBSD guys for this clever move. ;)
158#
159# So, when building for the frist time, setting BOOSTRAP_SHELL=/bin/bash is good idea.
160#
161BOOTSTRAP_SHELL ?= $(SHELL)
162ifndef YACC
163 YACC := $(firstword $(which byacc) $(which yacc) yacc)
164endif
165
166$(PATH_kmk_ash)/arith.h + $(PATH_kmk_ash)/arith.c: $(kmk_ash_PATH)/arith.y | $(call DIRDEP,$(PATH_kmk_ash))
167 $(YACC) -ld $^
168 $(MV) -f y.tab.c $(PATH_kmk_ash)/arith.c
169 $(MV) -f y.tab.h $(PATH_kmk_ash)/arith.h
170
171ifndef kmk_ash_LEXTOOL
172$(PATH_kmk_ash)/arith_lex.c: $(kmk_ash_PATH)/arith_lex.l | $(call DIRDEP,$(PATH_kmk_ash))
173 flex -8 -o$@ $^ # 8-bit lex scanner for arithmetic
174endif
175
176$(PATH_kmk_ash)/builtins.h + $(PATH_kmk_ash)/builtins.c: \
177 $(kmk_ash_PATH)/mkbuiltins \
178 $(kmk_ash_PATH)/shell.h \
179 $(kmk_ash_PATH)/builtins.def \
180 | $(call DIRDEP,$(PATH_kmk_ash))
181 $(BOOTSTRAP_SHELL) $+ $(dir $@)
182 [ -f $(PATH_kmk_ash)/builtins.h ]
183
184$(PATH_kmk_ash)/nodes.h + $(PATH_kmk_ash)/nodes.c: \
185 $(kmk_ash_PATH)/mknodes.sh \
186 $(kmk_ash_PATH)/nodetypes \
187 $(kmk_ash_PATH)/nodes.c.pat \
188 | $(call DIRDEP,$(PATH_kmk_ash))
189 $(BOOTSTRAP_SHELL) $+ $(dir $@)
190 [ -f $(dir $@)/nodes.h ]
191
192$(PATH_kmk_ash)/token.h: $(kmk_ash_PATH)/mktokens | $(call DIRDEP,$(PATH_kmk_ash))
193 $(BOOTSTRAP_SHELL) $+
194 $(MV) token.h $@
195
196$(PATH_kmk_ash)/init.c: \
197 $(kmk_ash_PATH)/mkinit.sh \
198 $(abspathex $(filter-out $(PATH_kmk_ash)/%,$(kmk_ash_SOURCES)), $(kmk_ash_PATH)) \
199 | $(call DIRDEP,$(PATH_kmk_ash))
200 $(BOOTSTRAP_SHELL) $+
201 $(MV) init.c $@
202
203endif # generate on the fly
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