(selective_vpath_search): Reset EXISTS when stat fails.
[make.git] / build.template
blob6bae5b29fa197b00c9c4cdf53742ec97a5d462c6
1 #!/bin/sh
3 # Shell script to build GNU Make in the absence of any `make' program.
5 # Copyright (C) 1993 Free Software Foundation, Inc.
6 # This file is part of GNU Make.
7 #
8 # GNU Make is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
13 # GNU Make is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Make; see the file COPYING. If not, write to
20 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 # See Makefile.in for comments describing these variables.
24 srcdir='@srcdir@'
25 CC='@CC@'
26 CFLAGS='@CFLAGS@'
27 LDFLAGS='@LDFLAGS@'
28 defines='@DEFS@ -DLIBDIR="${libdir}" -DINCLUDEDIR="${includedir}"'
29 ALLOCA='@ALLOCA@'
30 LOADLIBES='@LIBS@'
31 extras='@LIBOBJS@'
32 REMOTE='@REMOTE@'
34 # Common prefix for machine-independent installed files.
35 prefix=/usr/local
36 # Common prefix for machine-dependent installed files.
37 exec_prefix=/usr/local
38 # Directory to find libraries in for `-lXXX'.
39 libdir=${exec_prefix}/lib
40 # Directory to search by default for included makefiles.
41 includedir=${prefix}/include
43 # Exit as soon as any command fails.
44 set -e
46 # These are all the objects we need to link together.
47 objs="%objs% remote-${REMOTE}.o ${extras} ${ALLOCA}"
49 # Compile the source files into those objects.
50 for file in `echo ${objs} | sed 's/\.o/.c/g'`; do
51 echo compiling ${file}...
52 $CC $CFLAGS $defines -c -I. -I${srcdir} -I${srcdir}/glob ${srcdir}/$file
53 done
55 # The object files were actually all put in the current directory.
56 # Remove the source directory names from the list.
57 srcobjs="$objs"
58 objs=
59 for obj in $srcobjs; do
60 objs="$objs `basename $obj`"
61 done
63 # Link all the objects together.
64 echo linking make...
65 $CC $LDFLAGS $objs $LOADLIBES -o make.new
66 echo done
67 mv -f make.new make