Home | History | Annotate | Download | only in make-3.81
      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 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 the
     10 # terms of the GNU General Public License as published by the Free Software
     11 # Foundation; either version 2, or (at your option) any later version.
     12 #
     13 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License along with
     18 # GNU Make; see the file COPYING.  If not, write to the Free Software
     19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     20 
     21 # See Makefile.in for comments describing these variables.
     22 
     23 srcdir='@srcdir@'
     24 CC='@CC@'
     25 CFLAGS='@CFLAGS@'
     26 CPPFLAGS='@CPPFLAGS@'
     27 LDFLAGS='@LDFLAGS@'
     28 ALLOCA='@ALLOCA@'
     29 LOADLIBES='@LIBS@ @LIBINTL@'
     30 eval extras=\'@LIBOBJS@\'
     31 REMOTE='@REMOTE@'
     32 GLOBLIB='@GLOBLIB@'
     33 PATH_SEPARATOR='@PATH_SEPARATOR@'
     34 OBJEXT='@OBJEXT@'
     35 EXEEXT='@EXEEXT@'
     36 
     37 # Common prefix for machine-independent installed files.
     38 prefix='@prefix@'
     39 # Common prefix for machine-dependent installed files.
     40 exec_prefix=`eval echo @exec_prefix@`
     41 # Directory to find libraries in for `-lXXX'.
     42 libdir=${exec_prefix}/lib
     43 # Directory to search by default for included makefiles.
     44 includedir=${prefix}/include
     45 
     46 localedir=${prefix}/share/locale
     47 aliaspath=${localedir}${PATH_SEPARATOR}.
     48 
     49 defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@'
     50 
     51 # Exit as soon as any command fails.
     52 set -e
     53 
     54 # These are all the objects we need to link together.
     55 objs="ar.${OBJEXT} arscan.${OBJEXT} commands.${OBJEXT} default.${OBJEXT} dir.${OBJEXT} expand.${OBJEXT} file.${OBJEXT} function.${OBJEXT} getopt.${OBJEXT} getopt1.${OBJEXT} implicit.${OBJEXT} job.${OBJEXT} main.${OBJEXT} misc.${OBJEXT} read.${OBJEXT} remake.${OBJEXT} rule.${OBJEXT} signame.${OBJEXT} strcache.${OBJEXT} variable.${OBJEXT} version.${OBJEXT} vpath.${OBJEXT} hash.${OBJEXT} remote-${REMOTE}.${OBJEXT} ${extras} ${ALLOCA}"
     56 
     57 if [ x"$GLOBLIB" != x ]; then
     58   objs="$objs glob/fnmatch.${OBJEXT} glob/glob.${OBJEXT}"
     59   globinc=-I${srcdir}/glob
     60 fi
     61 
     62 # Compile the source files into those objects.
     63 for file in `echo ${objs} | sed 's/\.'${OBJEXT}'/.c/g'`; do
     64   echo compiling ${file}...
     65   $CC $defines $CPPFLAGS $CFLAGS \
     66       -c -I. -I${srcdir} ${globinc} ${srcdir}/$file
     67 done
     68 
     69 # The object files were actually all put in the current directory.
     70 # Remove the source directory names from the list.
     71 srcobjs="$objs"
     72 objs=
     73 for obj in $srcobjs; do
     74   objs="$objs `basename $obj`"
     75 done
     76 
     77 # Link all the objects together.
     78 echo linking make...
     79 $CC $CFLAGS $LDFLAGS $objs $LOADLIBES -o makenew${EXEEXT}
     80 echo done
     81 mv -f makenew${EXEEXT} make${EXEEXT}
     82