This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Death to configure.frag (revised)
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Aug 2003 13:21:04 -0700
- Subject: Death to configure.frag (revised)
This is a revised patch incorporating everyone's suggestions, with one
exception: I left the "for x in .. $list" idiom alone to be consistent
with the rest of the file. I may go back and purge it in a separate
patch.
OK mainline?
zw
* configure.frag: Delete file.
* configure.in: Rename the substitution variables
dep_host_xmake_file and dep_tmake_file to xmake_file and
tmake_file respectively. Do not expand $srcdir in the
value of these; leave that for Make. Introduce a new
substitution varaible, all_lang_makefrags, which lists
subdirectory Make-lang.in files; exclude these from
all_lang_makefiles, which is now only for subdirectory
outputs. Do not invoke configure.frag. Do not set nor
AC_SUBST_FILE target_overrides, host_overrides, or
language_fragments. Create build subdirectories in
config.status extra commands.
* configure: Regenerate.
* Makefile.in: Update substitutions to match changes to
configure. Use include directives instead of @-insertions
to read in host, target, and language fragments.
(Makefile rule): Do not invoke configure.frag. Do not copy
config.status to config.run before executing it. Set
CONFIG_HEADERS and CONFIG_FILES so that only Makefile gets
regenerated.
(cstamp-h rule): Set CONFIG_FILES as well as CONFIG_HEADERS.
ada:
* Makefile.in: Update substitutions to match changes to
configure. Use include directives instead of @-insertions
to read in host and target fragments. Add a rule to
regenerate ada/Makefile.
===================================================================
Index: configure.in
--- configure.in 21 Aug 2003 02:19:32 -0000 1.718
+++ configure.in 30 Aug 2003 20:12:43 -0000
@@ -1264,30 +1264,25 @@ topdir=`${PWDCMD-pwd}`
cd $holddir
# Conditionalize the makefile for this host machine.
-# Make-host contains the concatenation of all host makefile fragments
-# [there can be more than one]. This file is built by configure.frag.
-host_overrides=Make-host
-dep_host_xmake_file=
+xmake_file=
for f in .. ${host_xmake_file}
do
if test -f ${srcdir}/config/$f
then
- dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f"
+ xmake_file="${xmake_file} \$(srcdir)/config/$f"
fi
done
# Conditionalize the makefile for this target machine.
-# Make-target contains the concatenation of all host makefile fragments
-# [there can be more than one]. This file is built by configure.frag.
-target_overrides=Make-target
-dep_tmake_file=
+tmake_file_=
for f in .. ${tmake_file}
do
if test -f ${srcdir}/config/$f
then
- dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f"
+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
fi
done
+tmake_file="${tmake_file_}"
symbolic_link='ln -s'
@@ -2726,6 +2721,8 @@ all_compilers=
all_stagestuff=
all_outputs='Makefile fixinc/Makefile gccbug mklibgcc mkheaders'
# List of language makefile fragments.
+all_lang_makefrags=
+# List of language subdirectory makefiles. Deprecated.
all_lang_makefiles=
# Files for gengtype
all_gtfiles="$target_gtfiles"
@@ -2740,7 +2737,6 @@ all_gtfiles_files_files=
# The other mechanism is a set of hooks for each of the main targets
# like `clean', `install', etc.
-language_fragments="Make-lang"
language_hooks="Make-hooks"
for s in .. $subdirs
@@ -2759,9 +2755,9 @@ do
echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2
exit 1
fi
- all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in"
+ all_lang_makefrags="$all_lang_makefrags \$(srcdir)/$s/Make-lang.in"
if test -f ${srcdir}/$s/Makefile.in
- then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in"
+ then all_lang_makefiles="$s/Makefile"
fi
all_languages="$all_languages $language"
if test "x$boot_language" = xyes
@@ -2906,9 +2902,6 @@ AC_SUBST(slibdir)
objdir=`${PWDCMD-pwd}`
AC_SUBST(objdir)
-# Process the language and host/target makefile fragments.
-${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file"
-
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
@@ -2917,6 +2910,7 @@ AC_SUBST(all_compilers)
AC_SUBST(all_gtfiles)
AC_SUBST(all_gtfiles_files_langs)
AC_SUBST(all_gtfiles_files_files)
+AC_SUBST(all_lang_makefrags)
AC_SUBST(all_lang_makefiles)
AC_SUBST(all_languages)
AC_SUBST(all_stagestuff)
@@ -2929,8 +2923,8 @@ AC_SUBST(check_languages)
AC_SUBST(cc_set_by_configure)
AC_SUBST(quoted_cc_set_by_configure)
AC_SUBST(cpp_install_dir)
-AC_SUBST(dep_host_xmake_file)
-AC_SUBST(dep_tmake_file)
+AC_SUBST(xmake_file)
+AC_SUBST(tmake_file)
AC_SUBST(extra_headers_list)
AC_SUBST(extra_objs)
AC_SUBST(extra_parts)
@@ -2975,9 +2969,6 @@ AC_SUBST(c_target_objs)
AC_SUBST(cxx_target_objs)
AC_SUBST(target_cpu_default)
-AC_SUBST_FILE(target_overrides)
-AC_SUBST_FILE(host_overrides)
-AC_SUBST_FILE(language_fragments)
AC_SUBST_FILE(language_hooks)
# Echo that links are built
@@ -3017,6 +3008,13 @@ case x$CONFIG_HEADERS in
xauto-host.h:config.in)
echo > cstamp-h ;;
esac
+# Make sure all the subdirs exist.
+for d in .. $subdirs
+do
+ if test $d != ..; then
+ test -d $d || mkdir $d
+ fi
+done
# If the host supports symlinks, point stage[1234] at ../stage[1234] so
# bootstrapping and the installation procedure can still use
# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks,
===================================================================
Index: Makefile.in
--- Makefile.in 29 Aug 2003 23:21:11 -0000 1.1145
+++ Makefile.in 30 Aug 2003 20:12:44 -0000
@@ -336,8 +336,8 @@ LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR
# each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
-xmake_file=@dep_host_xmake_file@
-tmake_file=@dep_tmake_file@
+xmake_file=@xmake_file@
+tmake_file=@tmake_file@
out_file=$(srcdir)/config/@out_file@
out_object_file=@out_object_file@
md_file=$(srcdir)/config/@md_file@
@@ -661,12 +661,16 @@ PRETTY_PRINT_H = pretty-print.h input.h
DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
-# sed inserts variable overrides after the following line.
-####target overrides
-@target_overrides@
+# target overrides
+ifneq ($(tmake_file),)
+include $(tmake_file)
+endif
+
+# host overrides
+ifneq ($(xmake_file),)
+include $(xmake_file)
+endif
-####host overrides
-@host_overrides@
#
# Now figure out from those variables how to compile and link.
@@ -735,6 +739,7 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(s
# Support for additional languages (other than C).
# C can be supported this way too (leave for later).
+LANG_MAKEFRAGS = @all_lang_makefrags@
LANG_MAKEFILES = @all_lang_makefiles@
LANG_STAGESTUFF = @all_stagestuff@
@@ -917,27 +922,24 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udi
# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info).
# Configure computes and adds these here.
-####language hooks
+# language hooks, generated by configure
@language_hooks@
-# sed inserts language fragments after the following line.
-####language fragments
-@language_fragments@
+# per-language makefile fragments
+ifneq ($(LANG_MAKEFRAGS),)
+include $(LANG_MAKEFRAGS)
+endif
-# End of language makefile fragments.
#
# -----------------------------
# Rebuilding this configuration
# -----------------------------
-Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \
- $(xmake_file) $(tmake_file) $(LANG_MAKEFILES)
- $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \
- "$(xmake_file)" "$(tmake_file)"
- cp config.status config.run
- LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run
- rm -f config.run
+Makefile: config.status $(srcdir)/Makefile.in $(srcdir)/version.c
+ LANGUAGES="$(CONFIG_LANGUAGES)" \
+ CONFIG_HEADERS= \
+ CONFIG_FILES=$@ $(SHELL) config.status
config.h: cs-config.h ; @true
bconfig.h: cs-bconfig.h ; @true
@@ -1006,7 +1008,9 @@ mkheaders: $(srcdir)/mkheaders.in
@MAINT@ echo timestamp > $(srcdir)/cstamp-h.in
auto-host.h: cstamp-h ; @true
cstamp-h: config.in config.status
- CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
+ CONFIG_HEADERS=auto-host.h:config.in \
+ CONFIG_FILES= \
+ LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
# Really, really stupid make features, such as SUN's KEEP_STATE, may force
# a target to build even if it is up-to-date. So we must verify that
===================================================================
Index: configure.frag
--- configure.frag 22 Aug 2001 14:34:48 -0000 1.4
+++ configure.frag 1 Jan 1970 00:00:00 -0000
@@ -1,77 +0,0 @@
-# configure.frag for GCC
-# Process the host/target/language Makefile fragments.
-
-# Copyright (C) 1997 Free Software Foundation, Inc.
-
-#This file is part of GCC.
-
-#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.
-
-#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 GCC; see the file COPYING. If not, write to the Free
-#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-#02111-1307, USA.
-
-# 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.
-
-rm -f Make-target
-touch Make-target
-for f in .. $tmake_files
-do
- if [ -f $f ]
- then
- cat $f >> Make-target
- fi
-done
-
-# Ensure the language build subdirectories exist.
-
-for subdir in . $subdirs
-do
- if [ $subdir != . ]
- then
- test -d $subdir || mkdir $subdir
- fi
-done
-
-# Now copy each language's Make-lang.in file to Make-lang.
-
-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
===================================================================
Index: ada/Makefile.in
--- ada/Makefile.in 4 Jul 2003 19:45:50 -0000 1.44
+++ ada/Makefile.in 30 Aug 2003 20:12:44 -0000
@@ -177,8 +177,8 @@ objdir = .
target=@target@
target_alias=@target_alias@
-xmake_file=@dep_host_xmake_file@
-tmake_file=@dep_tmake_file@
+xmake_file = @xmake_file@
+tmake_file = @tmake_file@
host_canonical=@host@
#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
@@ -217,12 +217,20 @@ all: all.indirect
# This tells GNU Make version 3 not to put all variables in the environment.
.NOEXPORT:
-# sed inserts variable overrides after the following line.
-####target overrides
-@target_overrides@
-
-####host overrides
-@host_overrides@
+# tmake_file and xmake_file expand to lists with entries of the form
+# $(srcdir)/config/... but here $(srcdir) is the ada subdirectory so we
+# need to adjust the paths. There can't be spaces in the subst arguments
+# or we get spurious spaces in the actual list of files to include.
+
+# target overrides
+ifneq ($(tmake_file),)
+include $(subst /config,/../config,$(tmake_file))
+endif
+
+# host overrides
+ifneq ($(xmake_file),)
+include $(subst /config,/../config,$(xmake_file))
+endif
# Now figure out from those variables how to compile and link.
@@ -277,6 +285,13 @@ ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdi
$(ADAC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $<
.ads.o:
$(ADAC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $<
+
+# how to regenerate this file
+Makefile: ../config.status $(srcdir)/Makefile.in $(srcdir)/../version.c
+ cd ..; \
+ LANGUAGES="$(CONFIG_LANGUAGES)" \
+ CONFIG_HEADERS= \
+ CONFIG_FILES=ada/Makefile $(SHELL) config.status
# This tells GNU make version 3 not to export all the variables
# defined in this file into the environment.