-# configure.frag for GNU CC
-# Process the Makefile fragments from language directories.
+# configure.frag for GCC
+# Process the host/target/language Makefile fragments.
# Copyright (C) 1997 Free Software Foundation, Inc.
-#This file is part of GNU CC.
+#This file is part of GCC.
-#GNU CC is free software; you can redistribute it and/or modify
-#it under the terms of the GNU General Public License as published by
-#the Free Software Foundation; either version 2, or (at your option)
-#any later version.
+#GCC is free software; you can redistribute it and/or modify it under
+#the terms of the GNU General Public License as published by the Free
+#Software Foundation; either version 2, or (at your option) any later
+#version.
-#GNU CC is distributed in the hope that it will be useful,
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-#GNU General Public License for more details.
+#GCC is distributed in the hope that it will be useful, but WITHOUT
+#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+#for more details.
#You should have received a copy of the GNU General Public License
-#along with GNU CC; see the file COPYING. If not, write to
-#the Free Software Foundation, 59 Temple Place - Suite 330,
-#Boston, MA 02111-1307, USA.
+#along with GCC; see the file COPYING. If not, write to the Free
+#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+#02111-1307, USA.
-rm -f Make-lang
-touch Make-lang
+# First parameter is the source directory, second is list of subdirectories,
+# third is list of host makefile fragments, fourth is list of target makefile
+# fragments.
+
+srcdir=$1
+subdirs=$2
+xmake_files=$3
+tmake_files=$4
+
+# Copy all the host makefile fragments into Make-host.
+
+rm -f Make-host
+touch Make-host
+for f in .. $xmake_files
+do
+ if [ -f $f ]
+ then
+ cat $f >> Make-host
+ fi
+done
+
+# Copy all the target makefile fragments into Make-target.
-# We can either be invoked with . from configure or from Makefile.
-# Some shells can't pass arguments to source'd scripts.
-# ??? This needs some rethinking.
+rm -f Make-target
+touch Make-target
+for f in .. $tmake_files
+do
+ if [ -f $f ]
+ then
+ cat $f >> Make-target
+ fi
+done
-if [ x"$1" != x ] ; then
- savesrcdir=$1
- savesubdirs=$2
-else
- savesrcdir=$srcdir
- savesubdirs=$subdirs
-fi
+# Ensure the language build subdirectories exist.
-for subdir in . $savesubdirs
+for subdir in . $subdirs
do
- oldsrcdir=$savesrcdir
-
- # Re-adjust the path
- case $oldsrcdir in
- /*)
- case $subdir in
- .)
- srcdir=$oldsrcdir
- ;;
- *)
- srcdir=$oldsrcdir/$subdir
- ;;
- esac
- ;;
- *)
- case $subdir in
- .)
- ;;
- *)
- oldsrcdir=../${oldsrcdir}
- srcdir=$oldsrcdir/$subdir
- ;;
- esac
- ;;
- esac
- mainsrcdir=$oldsrcdir
- STARTDIR=`pwd`
- test -d $subdir || mkdir $subdir
- cd $subdir
-
- # If this is the top level Makefile, add the language fragments.
- if [ $subdir = . ]
+ if [ $subdir != . ]
then
- for s in .. $savesubdirs
- do
- if [ $s != ".." ]
- then
- cat ${mainsrcdir}/$s/Make-lang.in >> Make-lang
- fi
- done
+ test -d $subdir || mkdir $subdir
fi
+done
- cd $STARTDIR
-done # end of current-dir SUBDIRS loop
+# Now copy each language's Make-lang.in file to Make-lang.
-srcdir=$savesrcdir
+rm -f Make-lang
+touch Make-lang
+
+for subdir in . $subdirs
+do
+ if [ $subdir != . ]
+ then
+ cat $srcdir/$subdir/Make-lang.in >> Make-lang
+ fi
+done