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, 1997 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. |
---|
12 | # |
---|
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. |
---|
17 | # |
---|
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, Inc., 59 Temple Place - Suite 330, |
---|
21 | # Boston, MA 02111-1307, USA. |
---|
22 | |
---|
23 | # See Makefile.in for comments describing these variables. |
---|
24 | |
---|
25 | srcdir='@srcdir@' |
---|
26 | CC='@CC@' |
---|
27 | CFLAGS='@CFLAGS@' |
---|
28 | CPPFLAGS='@CPPFLAGS@' |
---|
29 | LDFLAGS='@LDFLAGS@' |
---|
30 | ALLOCA='@ALLOCA@' |
---|
31 | LOADLIBES='@LIBS@' |
---|
32 | extras='@LIBOBJS@' |
---|
33 | REMOTE='@REMOTE@' |
---|
34 | GLOBLIB='@GLOBLIB@' |
---|
35 | |
---|
36 | # Common prefix for machine-independent installed files. |
---|
37 | prefix='@prefix@' |
---|
38 | # Common prefix for machine-dependent installed files. |
---|
39 | exec_prefix=`eval echo @exec_prefix@` |
---|
40 | # Directory to find libraries in for `-lXXX'. |
---|
41 | libdir=${exec_prefix}/lib |
---|
42 | # Directory to search by default for included makefiles. |
---|
43 | includedir=${prefix}/include |
---|
44 | |
---|
45 | localedir=${prefix}/share/locale |
---|
46 | aliaspath=${localedir}:. |
---|
47 | |
---|
48 | defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@' |
---|
49 | |
---|
50 | # Exit as soon as any command fails. |
---|
51 | set -e |
---|
52 | |
---|
53 | # These are all the objects we need to link together. |
---|
54 | objs="ar.o arscan.o commands.o dir.o expand.o file.o function.o getopt.o implicit.o job.o main.o misc.o read.o remake.o rule.o signame.o variable.o vpath.o default.o version.o getopt1.o remote-${REMOTE}.o ${extras} ${ALLOCA}" |
---|
55 | |
---|
56 | if [ x"$GLOBLIB" != x ]; then |
---|
57 | objs="$objs glob/fnmatch.o glob/glob.o" |
---|
58 | globinc=-I${srcdir}/glob |
---|
59 | fi |
---|
60 | |
---|
61 | # Compile the source files into those objects. |
---|
62 | for file in `echo ${objs} | sed 's/\.o/.c/g'`; do |
---|
63 | echo compiling ${file}... |
---|
64 | $CC $defines $CPPFLAGS $CFLAGS \ |
---|
65 | -c -I. -I${srcdir} ${globinc} ${srcdir}/$file |
---|
66 | done |
---|
67 | |
---|
68 | # The object files were actually all put in the current directory. |
---|
69 | # Remove the source directory names from the list. |
---|
70 | srcobjs="$objs" |
---|
71 | objs= |
---|
72 | for obj in $srcobjs; do |
---|
73 | objs="$objs `basename $obj`" |
---|
74 | done |
---|
75 | |
---|
76 | # Link all the objects together. |
---|
77 | echo linking make... |
---|
78 | $CC $LDFLAGS $objs $LOADLIBES -o make.new |
---|
79 | echo done |
---|
80 | mv -f make.new make |
---|