source: trunk/essentials/app-shells/bash/kNIX-bootstrap.kmk@ 3845

Last change on this file since 3845 was 3845, checked in by bird, 11 years ago

svn:eol-style: native

  • Property svn:eol-style set to native
File size: 8.1 KB
Line 
1# $Id: kNIX-bootstrap.kmk 3180 2007-04-22 07:13:02Z bird $
2## @file
3#
4# kNIX Boostrap Makefile for bash
5#
6# Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
7#
8#
9# This file is part of kNIX.
10#
11# kNIX 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# kNIX 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 kNIX; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26
27DEPTH = ../../..
28include $(PATH_KBUILD)/header.kmk
29
30# version sans patchlevel.
31VER = 3.1
32
33#
34# The bash template.
35#
36TEMPLATE_bash = bash template
37TEMPLATE_bash_EXTENDS = bin
38TEMPLATE_bash_DEFS = $(TEMPLATE_usr.bin_DEFS) \
39 LOCALEDIR=\"/@unixroot/usr/share/locale\" \
40 PROGRAM=\"bash.exe\" \
41 CONF_HOSTTYPE=\"i386\" \
42 CONF_OSTYPE=\"os2-emx\" \
43 CONF_MACHTYPE=\"i386-pc-os2-emx\" \
44 CONF_VENDOR=\"pc\" \
45 PACKAGE=\"bash\" \
46 SHELL \
47 HAVE_CONFIG_H
48TEMPLATE_bash_INCS = $(TEMPLATE_usr.bin_INCS) \
49 $(PATH_TARGET) \
50 $(PATH_SUB_CURRENT) \
51 $(PATH_SUB_ROOT)/include \
52 $(PATH_SUB_ROOT)/lib
53TEMPLATE_bash_ORDERDEPS = $(TEMPLATE_usr.bin_ORDERDEPS) \
54 $(PATH_TARGET)/config.h \
55 $(PATH_TARGET)/version.h \
56 $(PATH_TARGET)/pathnames.h
57
58OTHER_CLEAN += $(TEMPLATE_bash_ORDERDEPS)
59
60#
61# bash
62#
63PROGRAMS += bash
64bash_TEMPLATE = bash
65bash_INCS = $(PATH_SUB_ROOT)/builtins $(PATH_TARGET)/builtins
66BUILTINS = \
67 alias.def \
68 bind.def \
69 break.def \
70 builtin.def \
71 caller.def \
72 cd.def \
73 colon.def \
74 command.def \
75 declare.def \
76 echo.def \
77 enable.def \
78 eval.def \
79 exec.def \
80 exit.def \
81 fc.def \
82 fg_bg.def \
83 hash.def \
84 help.def \
85 history.def \
86 jobs.def \
87 kill.def \
88 let.def \
89 pushd.def \
90 read.def \
91 return.def \
92 set.def \
93 setattr.def \
94 shift.def \
95 source.def \
96 suspend.def \
97 test.def \
98 times.def \
99 trap.def \
100 type.def \
101 ulimit.def \
102 umask.def \
103 wait.def \
104 getopts.def \
105 shopt.def \
106 printf.def \
107 complete.def
108bash_SOURCES = \
109 shell.c \
110 eval.c \
111 y.tab.c \
112 general.c \
113 make_cmd.c \
114 print_cmd.c \
115 dispose_cmd.c \
116 execute_cmd.c \
117 variables.c \
118 copy_cmd.c \
119 error.c \
120 expr.c \
121 flags.c \
122 jobs.c \
123 subst.c \
124 hashcmd.c \
125 hashlib.c \
126 mailcheck.c \
127 trap.c \
128 input.c \
129 unwind_prot.c \
130 pathexp.c \
131 sig.c \
132 test.c \
133 version.c \
134 alias.c \
135 array.c \
136 arrayfunc.c \
137 braces.c \
138 bracecomp.c \
139 bashhist.c \
140 bashline.c \
141 list.c \
142 stringlib.c \
143 locale.c \
144 findcmd.c \
145 redir.c \
146 pcomplete.c \
147 pcomplib.c \
148 xmalloc.c \
149 $(PATH_TARGET)/syntax.c \
150 \
151 $(PATH_TARGET)/builtins/builtins.c \
152 builtins/common.c \
153 builtins/evalfile.c \
154 builtins/evalstring.c \
155 builtins/getopt.c \
156 builtins/bashgetopt.c \
157 $(addprefix $(PATH_TARGET)/builtins/, $(BUILTINS:.def=.c)) \
158 \
159 lib/glob/glob.c \
160 lib/glob/strmatch.c \
161 lib/glob/smatch.c \
162 lib/glob/xmbsrtowcs.c \
163 \
164 lib/tilde/tilde.c
165
166trap.c_DEPS = $(PATH_TARGET)/signames.h
167$(PATH_TARGET)/builtins/ulimit.c_DEPS = $(PATH_TARGET)/pipesize.h
168
169bash_LIBS = \
170 $(TARGET_libsh) \
171 $(TARGET_libreadline) \
172 $(TARGET_libhistory) \
173 ncurses
174
175bash_ORDERDEPS = \
176 $(PATH_TARGET)/builtins/builtext.h \
177 $(PATH_TARGET)/builtins/builtins.c
178
179bash_CLEAN = \
180 $(bash_ORDERDEPS) \
181 $(PATH_TARGET)/syntax.c \
182 $(PATH_TARGET)/builtins/builtins.c \
183 $(addprefix $(PATH_TARGET)/builtins/, $(BUILTINS:.def=.c))
184
185
186# generate syntax.c.
187$(PATH_TARGET)/syntax.c: $$(TARGET_mksyntax)
188 $(TARGET_mksyntax) -o $@
189
190# generate signames.h for trap.c
191$(PATH_TARGET)/signames.h: $$(TARGET_mksignames)
192 $(TARGET_mksignames) $@
193
194# generate pipesize.h for ulimit.def
195$(PATH_TARGET)/pipesize.h:
196 $(RM) -f $@
197 $(APPEND) $@ '#define PIPESIZE 8192'
198
199# generate builtext.h and builtins.c from the builtins/*.def files.
200$(PATH_TARGET)/builtins/builtext.h $(PATH_TARGET)/builtins/builtins.c: \
201 $$(TARGET_mkbuiltins) \
202 $(addprefix $(PATH_SUB_ROOT)/builtins/, $(BUILTINS))
203 $(MKDIR) -p $(PATH_TARGET)/builtins
204 $(TARGET_mkbuiltins) \
205 -externfile $(PATH_TARGET)/builtins/builtext.h \
206 -structfile $(PATH_TARGET)/builtins/builtins.c \
207 -noproduction \
208 -D $(PATH_SUB_ROOT)/builtins \
209 $(addprefix $(PATH_SUB_ROOT)/builtins/, $(BUILTINS))
210
211.NOTPARALLEL: $(PATH_TARGET)/builtins/builtext.h $(PATH_TARGET)/builtins/builtins.c
212
213# generate C source files from the builtins/*.def files.
214define def_mkbuiltin
215$(PATH_TARGET)/builtins/$(name:.def=.c): $(PATH_SUB_ROOT)/builtins/$(name) $$$$(TARGET_mkbuiltins)
216 $(MKDIR) -p $(PATH_TARGET)/builtins
217 cd $$(@D) && $$(TARGET_mkbuiltins) -D $(PATH_SUB_ROOT)/builtins $$<
218endef
219$(foreach name,$(BUILTINS),$(eval $(def_mkbuiltin)))
220
221
222#
223# mkbuiltins.
224#
225BLDPROGS += mkbuiltins
226mkbuiltins_TEMPLATE = bash
227mkbuiltins_INCS = \
228 $(PATH_SUB_ROOT)/builtins
229mkbuiltins_SOURCES = \
230 builtins/mkbuiltins.c
231
232#
233# mksignames
234#
235BLDPROGS += mksignames
236mksignames_TEMPLATE = bash
237mksignames_SOURCES = \
238 support/mksignames.c
239
240#
241# basheversion
242#
243BLDPROGS += bashversion
244bashversion_TEMPLATE = bash
245bashversion_DEFS += BUILDTOOL
246bashversion_SOURCES = \
247 support/bashversion.c \
248 version.c
249
250#
251# mksyntax
252#
253BLDPROGS += mksyntax
254mksyntax_TEMPLATE = bash
255mksyntax_SOURCES = \
256 mksyntax.c
257
258
259#
260# libsh
261#
262LIBRARIES += libsh
263libsh_TEMPLATE = bash
264libsh_NOINST = yes
265libsh_DEFS = SHELL
266libsh_INCS = \
267 $(PATH_SUB_ROOT)/lib/sh
268libsh_SOURCES = \
269 lib/sh/clktck.c \
270 lib/sh/clock.c \
271 lib/sh/getenv.c \
272 lib/sh/oslib.c \
273 lib/sh/setlinebuf.c \
274 lib/sh/strnlen.c \
275 lib/sh/itos.c \
276 lib/sh/zread.c \
277 lib/sh/zwrite.c \
278 lib/sh/shtty.c \
279 lib/sh/shmatch.c \
280 lib/sh/netconn.c \
281 lib/sh/netopen.c \
282 lib/sh/timeval.c \
283 lib/sh/makepath.c \
284 lib/sh/pathcanon.c \
285 lib/sh/pathphys.c \
286 lib/sh/tmpfile.c \
287 lib/sh/stringlist.c \
288 lib/sh/stringvec.c \
289 lib/sh/spell.c \
290 lib/sh/shquote.c \
291 lib/sh/strtrans.c \
292 lib/sh/strindex.c \
293 lib/sh/snprintf.c \
294 lib/sh/mailstat.c \
295 lib/sh/fmtulong.c \
296 lib/sh/fmtullong.c \
297 lib/sh/fmtumax.c \
298 lib/sh/xstrchr.c \
299 lib/sh/zcatfd.c \
300 lib/sh/winsize.c
301
302
303#
304# libreadline
305#
306LIBRARIES += libreadline
307libreadline_TEMPLATE = bash
308libreadline_NOINST = yes
309libreadline_SOURCES = \
310 lib/readline/readline.c \
311 lib/readline/vi_mode.c \
312 lib/readline/funmap.c \
313 lib/readline/keymaps.c \
314 lib/readline/parens.c \
315 lib/readline/search.c \
316 lib/readline/rltty.c \
317 lib/readline/complete.c \
318 lib/readline/bind.c \
319 lib/readline/isearch.c \
320 lib/readline/display.c \
321 lib/readline/signals.c \
322 lib/readline/util.c \
323 lib/readline/kill.c \
324 lib/readline/undo.c \
325 lib/readline/macro.c \
326 lib/readline/input.c \
327 lib/readline/callback.c \
328 lib/readline/terminal.c \
329 lib/readline/text.c \
330 lib/readline/nls.c \
331 lib/readline/misc.c \
332 lib/readline/compat.c \
333 lib/readline/tilde.c \
334 lib/readline/xmalloc.c
335
336lib/readline/tilde.c_DEFS = READLINE_LIBRARY
337
338#
339# libhistory
340#
341LIBRARIES += libhistory
342libhistory_TEMPLATE = bash
343libhistory_NOINST = yes
344libhistory_SOURCES = \
345 lib/readline/history.c \
346 lib/readline/histexpand.c \
347 lib/readline/histfile.c \
348 lib/readline/histsearch.c \
349 lib/readline/shell.c \
350 lib/readline/savestring.c \
351 lib/readline/mbutil.c \
352 lib/readline/xmalloc.c
353
354#
355# Install docs
356#
357INSTALLS += bashman
358bashman_TEMPLATE = usr.bin.man
359bashman_SOURCES = \
360 doc/bash.1 \
361 doc/bashbug.1
362
363#INSTALLS += bashinfo - later
364bashinfo_TEMPLATE = usr.bin.info
365bashinfo_SOURCES = \
366 $(PATH_TARGET)/bash.info
367
368$(PATH_TARGET)/bash.info: | $(call DIRDEP,$(PATH_TARGET))
369 $(PATH_SUB_ROOT)/doc/infopost.sh < $(PATH_SUB_ROOT)/doc/bashref.info > $@
370
371
372#
373# config.h, fnmatch.h and version.h (force shell for on the latter).
374#
375$(PATH_TARGET)/config.h: kNIX-bootstrap-$(BUILD_TARGET).$(BUILD_TARGET_ARCH)-config.h
376 $(INSTALL) $< $@
377
378$(PATH_TARGET)/pathnames.h: kNIX-bootstrap-$(BUILD_TARGET).$(BUILD_TARGET_ARCH)-pathnames.h
379 $(INSTALL) $< $@
380
381$(PATH_TARGET)/version.h:
382 $(PATH_SUB_ROOT)/support/mkversion.sh -b -S $(PATH_SUB_ROOT) -s release -d $(VER) -o $(PATH_TARGET)/newversion.h && \
383 $(MV_EXT) -f $(PATH_TARGET)/newversion.h $(PATH_TARGET)/version.h
384
385
386include $(PATH_KBUILD)/footer.kmk
387
Note: See TracBrowser for help on using the repository browser.