2 # $Id: makeme,v 1.2 2005/04/06 15:48:17 epg Exp $
3 # This hack won't work for every trick you can play with /usr/msrc.
4 # If the Distfile sends different files to the various platforms, or
5 # builds a file on the meta source machine with a special tool or
6 # database you are toast. {N.B. mk's lib, rdist, mkcmd have issues.}
8 # if we have a local.defs read it for umask, PATH, and such.
9 [ -f /usr/local/lib/distrib/local.defs ] && . /usr/local/lib/distrib/local.defs
11 # It does work for the tools that build the meta source system itself,
12 # of course (mkcmd, distrib, rcsvg, and the like). You can use it to
13 # process the Make.host file through m4 for localhost.
15 # Check for the mandatory Make.host file...
16 if [ ! -f Make.host ] ; then
17 echo 1>&2 "$0: not in a meta source directory, no Make.host"
21 # distrib: default column headers: %HOST SHORTHOST HOSTTYPE HOSTOS HASSRC
22 if [ -z "$HOST" ] ; then
23 HOST=`uname -n || hostname`
25 if [ -z "$SHORTHOST" ] ; then
26 SHORTHOST=`expr $HOST : '\([^.]*\)\..*' \| $HOST`
28 if [ -z "$HOSTTYPE" ] ; then
29 case `uname -sr || uname -a` in
40 *Solaris*|*[Ss]un[Oo][Ss]*)
42 Darwin*|*BSD*|DragonFly*)
49 echo 1>&2 "$0: set HOSTTYPE and export it by hand."
53 if [ -z "$HOSTOS" ] ; then
54 HOSTOS=`uname -r | sed -e 's/^[A-Za-z .]*//' -e 's/-[A-Za-z]*//' -e 's/\.\([0-9][0-9]\)/\1/g' -e 'y/./0/' -e 's/^0*//'`
57 # Now fake the Distrib @file@ expansion and hope the rest works out.
58 # Some make's mistakenly think you must call fork() to get a SIG-child...
59 # so they barf out errors for this -- they should learn UNIX.
60 m4 - Make.host <<! |make -f - ${1:+"$@"}
61 define(\`HOST',\`$HOST')dnl
62 define(\`SHORTHOST',\`$SHORTHOST')dnl
63 define(\`HOSTTYPE',\`$HOSTTYPE')dnl
64 define(\`MYTYPE',\`$HOSTTYPE')dnl
65 define(\`HOSTOS',\`$HOSTOS')dnl
66 define(\`MYOS',\`$HOSTOS')dnl
67 define(\`HASSRC',\`yes')dnl
68 define(\`MSRC_BOOT',\`${MSRC_BOOT-yes}')dnl