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