1#!/bin/sh
2# Shell script to build GNU Make in the absence of any `make' program.
3# @configure_input@
4
5# Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
6# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
7# This file is part of GNU Make.
8#
9# GNU Make is free software; you can redistribute it and/or modify it under
10# the terms of the GNU General Public License as published by the Free Software
11# Foundation; either version 3 of the License, or (at your option) any later
12# version.
13#
14# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
15# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17# details.
18#
19# You should have received a copy of the GNU General Public License along with
20# this program.  If not, see <http://www.gnu.org/licenses/>.
21
22# See Makefile.in for comments describing these variables.
23
24srcdir='@srcdir@'
25CC='@CC@'
26CFLAGS='@CFLAGS@'
27CPPFLAGS='@CPPFLAGS@'
28LDFLAGS='@LDFLAGS@'
29ALLOCA='@ALLOCA@'
30LOADLIBES='@LIBS@ @LIBINTL@'
31eval extras=\'@LIBOBJS@\'
32REMOTE='@REMOTE@'
33GLOBLIB='@GLOBLIB@'
34PATH_SEPARATOR='@PATH_SEPARATOR@'
35OBJEXT='@OBJEXT@'
36EXEEXT='@EXEEXT@'
37
38# Common prefix for machine-independent installed files.
39prefix='@prefix@'
40# Common prefix for machine-dependent installed files.
41exec_prefix=`eval echo @exec_prefix@`
42# Directory to find libraries in for `-lXXX'.
43libdir=${exec_prefix}/lib
44# Directory to search by default for included makefiles.
45includedir=${prefix}/include
46
47localedir=${prefix}/share/locale
48aliaspath=${localedir}${PATH_SEPARATOR}.
49
50defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@'
51
52# Exit as soon as any command fails.
53set -e
54
55# These are all the objects we need to link together.
56objs="%objs% remote-${REMOTE}.${OBJEXT} ${extras} ${ALLOCA}"
57
58if [ x"$GLOBLIB" != x ]; then
59  objs="$objs %globobjs%"
60  globinc=-I${srcdir}/glob
61fi
62
63# Compile the source files into those objects.
64for file in `echo ${objs} | sed 's/\.'${OBJEXT}'/.c/g'`; do
65  echo compiling ${file}...
66  $CC $defines $CPPFLAGS $CFLAGS \
67      -c -I. -I${srcdir} ${globinc} ${srcdir}/$file
68done
69
70# The object files were actually all put in the current directory.
71# Remove the source directory names from the list.
72srcobjs="$objs"
73objs=
74for obj in $srcobjs; do
75  objs="$objs `basename $obj`"
76done
77
78# Link all the objects together.
79echo linking make...
80$CC $CFLAGS $LDFLAGS $objs $LOADLIBES -o makenew${EXEEXT}
81echo done
82mv -f makenew${EXEEXT} make${EXEEXT}
83