From 6208cfce7a49c2f3307f5fe30177a06b363e6ede Mon Sep 17 00:00:00 2001 From: Keith Marshall Date: Sun, 15 Jan 2012 15:10:09 +0000 Subject: [PATCH] Update and correct makefile rebuilding rules. --- winsup/w32api/ChangeLog | 19 +++++++++++++++ winsup/w32api/Makefile.comm.in | 33 +++++++++++++++++++++++++++ winsup/w32api/Makefile.in | 11 ++++++++- winsup/w32api/lib/Makefile.in | 3 --- winsup/w32api/lib/ddk/Makefile.in | 3 --- winsup/w32api/lib/directx/Makefile.in | 3 --- 6 files changed, 62 insertions(+), 10 deletions(-) diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog index ed063c55c..f57ab30fc 100644 --- a/winsup/w32api/ChangeLog +++ b/winsup/w32api/ChangeLog @@ -1,3 +1,22 @@ +2012-01-15 Keith Marshall + + Update and correct makefile rebuilding rules. + + * Makefile.in (Makefile): Remove dependency on configure; it causes + incorrect invocation of config.status when configure is regenerated. + (config.status): New rule; it invokes the corrected command. + + * lib/Makefile.in lib/ddk/Makefile.in lib/directx/Makefile.in: + (Makefile): Factor out rebuilding rules; replace by... + * Makefile.comm.in (Makefile): ...corrected implementation here. + (top_builddir/Makefile.comm): New rebuilding rule; it establishes the + commands to rebuild Makefile.comm and all other makefiles, when its + own Makefile.comm.in, or any subdirectory Makefile.in is modified, + or when config.status is updated. + (top_builddir/config.status): New rule; it corrects the previously + inappropriate command implementation to update config.status, when the + configure script is regenerated. + 2012-01-15 Keith Marshall More formatting adjustments. diff --git a/winsup/w32api/Makefile.comm.in b/winsup/w32api/Makefile.comm.in index c43720715..9a1fcf5d0 100644 --- a/winsup/w32api/Makefile.comm.in +++ b/winsup/w32api/Makefile.comm.in @@ -124,4 +124,37 @@ distclean: clean maintainer-clean: distclean +# Rules for rebuilding makefiles in sub-directories: +# +# Each of these should be rebuilt when its own Makefile.in is modified, +# or when ${top_builddir}/config.status is updated. Rebuilding is achieved +# by running ${top_builddir}/config.status, with ${top_builddir} as CWD; as +# a side effect this also rebuilds all other makefiles in the package tree. +# In particular, it causes ${top_builddir}/Makefile.comm.in to be rebuilt, +# BEFORE any sub-directory specific Makefile is updated. +# +# Since ${top_builddir}/Makefile.comm is also required by each individual +# sub-directory Makefile, and since all sub-directory makefiles are ALWAYS +# updated along with ${top_builddir}/Makefile.comm, we may simply declare +# the dependency... +# +Makefile: ${top_builddir}/Makefile.comm + +# ...then by adding Makefile.in as an artificial prerequisite of this, +# together with its own real dependence on ${top_builddir}/config.status +# and ${top_srcdir}/Makefile.comm.in, we can simply rely on the mutually +# effective rebuilding side effects to update both the subdirectory's own +# Makefile, and ${top_builddir}/Makefile.comm, in a single operation. +# +${top_builddir}/Makefile.comm: ${top_builddir}/config.status +${top_builddir}/Makefile.comm: Makefile.in ${top_srcdir}/Makefile.comm.in + cd ${top_builddir} && $(SHELL) config.status + +# ${top_builddir}/config.status must itself be updated, at any time when +# ${top_srcdir}/configure has been modified; this is a distinct operation +# from the rebuilding of makefiles. +# +${top_builddir}/config.status: ${top_srcdir}/configure + cd ${top_builddir} && $(SHELL) config.status --recheck + # Makefile.comm.in: end of file diff --git a/winsup/w32api/Makefile.in b/winsup/w32api/Makefile.in index d72f4e80a..d863dda5c 100644 --- a/winsup/w32api/Makefile.in +++ b/winsup/w32api/Makefile.in @@ -109,9 +109,18 @@ endif snapshot: make dist SNAPDATE=$(shell date '+%Y%m%d') -Makefile: Makefile.in config.status configure +# Makefile must be rebuilt if Makefile.in is modified, +# or if config.status is updated. +# +Makefile: Makefile.in config.status $(SHELL) config.status +# config.status itself must be updated if configure is modified; +# this requires a distinct invocation of itself. +# +config.status: configure + $(SHELL) config.status --recheck + mostlyclean-top: rm -f *~ diff --git a/winsup/w32api/lib/Makefile.in b/winsup/w32api/lib/Makefile.in index d06da0aca..df8727ac0 100644 --- a/winsup/w32api/lib/Makefile.in +++ b/winsup/w32api/lib/Makefile.in @@ -214,7 +214,4 @@ dist: (cd $$dir; $(MAKE) distdir=../${distdir} dist); \ done -Makefile: Makefile.in ../config.status ../configure - cd ..; $(SHELL) config.status - # Makefile.in: end of file diff --git a/winsup/w32api/lib/ddk/Makefile.in b/winsup/w32api/lib/ddk/Makefile.in index bdfb4f000..7879cdedc 100644 --- a/winsup/w32api/lib/ddk/Makefile.in +++ b/winsup/w32api/lib/ddk/Makefile.in @@ -122,7 +122,4 @@ dist: cp -p ${srcdir}/$$file ${distdir}/lib/ddk; \ done -Makefile: Makefile.in ../../config.status ../../configure - cd ../..; $(SHELL) config.status - # Makefile.in: end of file diff --git a/winsup/w32api/lib/directx/Makefile.in b/winsup/w32api/lib/directx/Makefile.in index 92f00a16b..c085f390f 100644 --- a/winsup/w32api/lib/directx/Makefile.in +++ b/winsup/w32api/lib/directx/Makefile.in @@ -150,7 +150,4 @@ dist: cp -p ${srcdir}/$$file ${distdir}/lib/directx; \ done -Makefile: Makefile.in ../../config.status ../../configure - cd ../..; $(SHELL) config.status - # Makefile.in: end of file