VirtualBox

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

Last change on this file since 1881 was 1665, checked in by bird, 17 years ago

Converted to a sub-makefile setup ('single' makefile).

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