(toplevel patch) Makefile.tpl reorg/cleanup

Nathanael Nerode
2002-12-03T04:41:27Z

This is a simple reorganization. It's doubtless not the last reorganization
I'll do on this file, but it gets a large portion of the way towards clarity.
This sorts things into comment-delimited "sections" in a sane
manner, and makes the build, host, target, and gcc module sections essentially
parallel in structure. I put most of the "miscellaneous" stuff nearer to the
top.

Only other change is the introduction of a new Make macro. We don't use it
yet.

Tested by bootstrapping i686-pc-linux-gnu successfully (no surprise there).

* Makefile.tpl: Reorganize and comment. Introduce HOST_CONFIGARGS.
* Makefile.in: Regenerate.

Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.5.2.18
diff -u -r1.5.2.18 Makefile.tpl
--- Makefile.tpl 3 Dec 2002 03:42:18 -0000 1.5.2.18
+++ Makefile.tpl 3 Dec 2002 04:34:13 -0000
@@ -223,13 +223,17 @@
BUILD_SUBDIR = @build_subdir@

# This is set by the configure script to the arguments to use when configuring
-# directories built for the target.
-TARGET_CONFIGARGS = @target_configargs@
-
-# This is set by the configure script to the arguments to use when configuring
# directories built for the build system.
BUILD_CONFIGARGS = @build_configargs@

+# This is set by the configure script to the arguments to use when configuring
+# directories built for the host system.
+HOST_CONFIGARGS = @host_configargs@
+
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the target.
+TARGET_CONFIGARGS = @target_configargs@
+
# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
# was used.
SET_LIB_PATH = @SET_LIB_PATH@
@@ -754,41 +758,41 @@
install-no-fixedincludes: installdirs @install_host_modules_nogcc@ \
@install_target_modules@ gcc-no-fixedincludes

-# Install the gcc headers files, but not the fixed include files,
-# which Cygnus is not allowed to distribute. This rule is very
-# dependent on the workings of the gcc Makefile.in.
-.PHONY: gcc-no-fixedincludes
-gcc-no-fixedincludes:
- @if [ -f ./gcc/Makefile ]; then \
- rm -rf gcc/tmp-include; \
- mv gcc/include gcc/tmp-include 2>/dev/null; \
- mkdir gcc/include; \
- cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
- touch gcc/stmp-fixinc gcc/include/fixed; \
- rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
- r=`${PWD}`; export r; \
- s=`cd $(srcdir); ${PWD}` ; export s; \
- $(SET_LIB_PATH) \
- (cd ./gcc; \
- $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
- rm -rf gcc/include; \
- mv gcc/tmp-include gcc/include 2>/dev/null; \
- else true; fi
+### other supporting targets

-# These rules are used to build the modules which are built with the
-# build machine's native compiler.
-[+ FOR build_modules +]
-.PHONY: all-build-[+module+] maybe-all-build-[+module+]
-maybe-all-build-[+module+]:
-all-build-[+module+]:
- @if [ -f ./[+module+]/Makefile ] ; then \
- r=`${PWD}`; export r; \
- s=`cd $(srcdir); ${PWD}`; export s; \
- (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all); \
- else \
- true; \
+MAKEDIRS= \
+ $(DESTDIR)$(prefix) \
+ $(DESTDIR)$(exec_prefix)
+.PHONY: installdirs
+installdirs: mkinstalldirs
+ $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
+
+dir.info: do-install-info
+ if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
+ $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
+ mv -f dir.info.new dir.info ; \
+ else true ; \
fi

+dist:
+ @echo "Building a full distribution of this tree isn't done"
+ @echo "via 'make dist'. Check out the etc/ subdirectory"
+
+etags tags: TAGS
+
+# Right now this just builds TAGS in each subdirectory. emacs19 has the
+# ability to use several tags files at once, so there is probably no need
+# to combine them into one big TAGS file (like CVS 1.3 does). We could
+# (if we felt like it) have this Makefile write a piece of elisp which
+# the user could load to tell emacs19 where all the TAGS files we just
+# built are.
+TAGS: do-TAGS
+
+
+# --------------------------------------
+# Modules which run on the build machine
+# --------------------------------------
+[+ FOR build_modules +]
.PHONY: configure-build-[+module+] maybe-configure-build-[+module+]
maybe-configure-build-[+module+]:
configure-build-[+module+]:
@@ -860,10 +864,22 @@
else \
true; \
fi
+
+.PHONY: all-build-[+module+] maybe-all-build-[+module+]
+maybe-all-build-[+module+]:
+all-build-[+module+]: configure-build-[+module+]
+ @if [ -f ./[+module+]/Makefile ] ; then \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}`; export s; \
+ (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all); \
+ else \
+ true; \
+ fi
[+ ENDFOR build_modules +]

-# These rules are used to build the modules which use FLAGS_TO_PASS. To
-# build a target all-X means to cd to X and make all.
+# --------------------------------------
+# Modules which run on the host machine
+# --------------------------------------
[+ FOR host_modules +]
.PHONY: all-[+module+] maybe-all-[+module+]
maybe-all-[+module+]:
@@ -922,8 +938,9 @@
[+ ENDIF no_install +]
[+ ENDFOR host_modules +]

-# These rules are used to build the modules which are built with the target
-# tools. To make foo-X means to cd to X and make foo.
+# --------------------------------------
+# Modules which run on the target machine
+# --------------------------------------
[+ FOR target_modules +]
.PHONY: configure-target-[+module+] maybe-configure-target-[+module+]
maybe-configure-target-[+module+]:
@@ -1012,7 +1029,7 @@

.PHONY: all-target-[+module+] maybe-all-target-[+module+]
maybe-all-target-[+module+]:
-all-target-[+module+]:
+all-target-[+module+]: configure-target-[+module+]
@r=`${PWD}`; export r; \
s=`cd $(srcdir); ${PWD}`; export s; \
$(SET_LIB_PATH) \
@@ -1056,6 +1073,14 @@
[+ ENDIF no_install +]
[+ ENDFOR target_modules +]

+# ----------
+# GCC module
+# ----------
+
+# Unfortunately, while gcc _should_ be a host module,
+# libgcc is a target module, and gen* programs are
+# build modules. So GCC is a sort of hybrid.
+
# gcc is the only module which uses GCC_FLAGS_TO_PASS.
.PHONY: all-gcc maybe-all-gcc
maybe-all-gcc:
@@ -1157,6 +1182,27 @@
true; \
fi

+# Install the gcc headers files, but not the fixed include files,
+# which Cygnus is not allowed to distribute. This rule is very
+# dependent on the workings of the gcc Makefile.in.
+.PHONY: gcc-no-fixedincludes
+gcc-no-fixedincludes:
+ @if [ -f ./gcc/Makefile ]; then \
+ rm -rf gcc/tmp-include; \
+ mv gcc/include gcc/tmp-include 2>/dev/null; \
+ mkdir gcc/include; \
+ cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
+ touch gcc/stmp-fixinc gcc/include/fixed; \
+ rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
+ r=`${PWD}`; export r; \
+ s=`cd $(srcdir); ${PWD}` ; export s; \
+ $(SET_LIB_PATH) \
+ (cd ./gcc; \
+ $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
+ rm -rf gcc/include; \
+ mv gcc/tmp-include gcc/include 2>/dev/null; \
+ else true; fi
+
# --------------------------------------
# Dependencies between different modules
# --------------------------------------
@@ -1264,47 +1310,13 @@
all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3
configure-target-qthreads: $(ALL_GCC_C)

-# Dependencies of all-build-foo on configure-build-foo.
-[+ FOR build_modules +]all-build-[+module+]: configure-build-[+module+]
-[+ ENDFOR build_modules +]
-
-# Dependencies of all-target-foo on configure-target-foo.
-[+ FOR target_modules +]all-target-[+module+]: configure-target-[+module+]
-[+ ENDFOR target_modules +]
-
# Dependencies of maybe-foo on foo. These are used because, for example,
# all-gcc only depends on all-gas if gas is present and being configured.
@maybe_dependencies@

-### other supporting targets
-
-MAKEDIRS= \
- $(DESTDIR)$(prefix) \
- $(DESTDIR)$(exec_prefix)
-.PHONY: installdirs
-installdirs: mkinstalldirs
- $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS)
-
-dir.info: do-install-info
- if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
- $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
- mv -f dir.info.new dir.info ; \
- else true ; \
- fi
-
-dist:
- @echo "Building a full distribution of this tree isn't done"
- @echo "via 'make dist'. Check out the etc/ subdirectory"
-
-etags tags: TAGS
-
-# Right now this just builds TAGS in each subdirectory. emacs19 has the
-# ability to use several tags files at once, so there is probably no need
-# to combine them into one big TAGS file (like CVS 1.3 does). We could
-# (if we felt like it) have this Makefile write a piece of elisp which
-# the user could load to tell emacs19 where all the TAGS files we just
-# built are.
-TAGS: do-TAGS
+# --------------------------------
+# Regenerating top level configury
+# --------------------------------

# Rebuilding Makefile.in, using autogen.
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def