This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Death to configure.frag


The new requirement to use GNU Make means that we can count on make
understanding a very general 'include' mechanism, and that completely
eliminates the need for configure.frag.

The odd-looking idiom 'include /dev/null $(variable)' prevents make
from grousing if $(variable) expands to nothing.  No, -include does
not prevent that error, I tried it.

Since the epoch of this CVS repository, the Makefile regeneration rule
has copied config.status to config.run before invoking it.  This is
contrary to the recommendations of the autoconf manual, and serves no
purpose apparent to me, so I have removed that.  I have also augmented
that rule into a static pattern rule which knows how to build
subdirectory Makefiles; we did not have any such thing before.

Bootstrapped i686-linux, all languages including Ada.  Since we seem
to be having an argument about the propriety of using GNU make
features, I will wait 24 hours before checking this in.  I hope this
patch - and there are lots more things that can be done like this -
demonstrates the value of using such features.

(Patches which get rid of ada/Makefile.in, dammit, are solicited.)

zw

        * configure.frag: Deleted.
        * configure.in: Don't set or substitute host_overrides,
        target_overrides, or language_fragments.  Rename
        dep_host_xmake_file to xmake_file, and dep_tmake_file to
        tmake_file.  Do not expand $srcdir in their values here;
        leave that to the makefile.  Distinguish between language
        makefrags, which are included, and language makefiles, which
        get run through config.status separately.  Do not run configure.frag.
        Create language build subdirs from config.status extra commands.

        * Makefile.in: Instead of @-substituting host_overrides,
        target_overrides, and language_fragments, use GNU Make's
        "include" directive to read all files in $(xmake_file),
        $(tmake_file), and $(LANG_MAKEFRAGS) respectively.
        (xmake_file, tmake_file): Adjust name of @-substitution.
        (Makefile rule): Replace with static pattern rule which can
        rebuild any subdirectory Makefile as well as the top level
        Makefile.  No need to invoke configure.frag.  Set
        CONFIG_HEADERS and CONFIG_FILES so only the appropriate file
        is rebuilt.  Don't bother copying config.status to config.run.
ada:
        * Makefile.in: Instead of @-substituting host_overrides,
        target_overrides, and language_fragments, use GNU Make's
        "include" directive to read all files in $(xmake_file) and
        $(tmake_file).
        (xmake_file, tmake_file): Adjust name of @-substitution.

===================================================================
Index: Makefile.in
--- Makefile.in	26 Aug 2003 18:47:25 -0000	1.1142
+++ Makefile.in	29 Aug 2003 03:39:53 -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,12 @@ 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
+include /dev/null $(tmake_file)
+
+# host overrides
+include /dev/null $(xmake_file)
 
-####host overrides
-@host_overrides@
 #
 # Now figure out from those variables how to compile and link.
 
@@ -735,6 +735,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 +918,22 @@ 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
+include /dev/null $(LANG_MAKEFRAGS)
 
-# 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 $(LANG_MAKEFILES): %: %.in config.status $(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 +1002,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: configure.in
--- configure.in	21 Aug 2003 02:19:32 -0000	1.718
+++ configure.in	29 Aug 2003 03:39:55 -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: ada/Makefile.in
--- ada/Makefile.in	4 Jul 2003 19:45:50 -0000	1.44
+++ ada/Makefile.in	29 Aug 2003 03:39:56 -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,16 @@ 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@
+# 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.
 
-####host overrides
-@host_overrides@
+# target overrides
+include /dev/null $(subst /config,/../config,$(tmake_file))
+
+# host overrides
+include /dev/null $(subst /config,/../config,$(xmake_file))
 
 # Now figure out from those variables how to compile and link.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]