source: trunk/src/ash/Makefile.kmk@ 2017

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

ash: bird wants DEBUG=2 in debug builds.

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