OSDN Git Service

Refactor mingwrt and w32api common makefile content.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 14 Mar 2017 16:24:00 +0000 (16:24 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 14 Mar 2017 16:24:00 +0000 (16:24 +0000)
ChangeLog
Makefile.comm [new file with mode: 0644]
mingwrt/ChangeLog
mingwrt/Makefile.in
w32api/ChangeLog
w32api/Makefile.in

index ccc46c0..1c4bdc3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-03-14  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Refactor mingwrt and w32api common makefile content.
+
+       * Makefile.comm: New file.
+       (COMMON_MAKEFILE): New macro; define it to identify this file.
+       (%-srcdist-common-files): New generic build rule; implement it.
+       (configure, config.status, Makefile, config.status.missing, _mingw.h)
+       (w32api.h, PACKAGE_VERSION_SCRIPT, PACKAGE_VERSION_FORMAT): Reproduce
+       the original common content, which has been factored out from...
+       * mingwrt/Makefile.in w32api/Makefile.in: ...here.
+
 2017-03-09  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        MinGW.org WSL-5.0 released; update repository version.
diff --git a/Makefile.comm b/Makefile.comm
new file mode 100644 (file)
index 0000000..af83ded
--- /dev/null
@@ -0,0 +1,106 @@
+# Makefile.comm
+#
+# Common elements, shared by the subpackage makefiles for each of the
+# MinGW.org Runtime Library and Windows-32 API packages.
+#
+# $Id$
+#
+# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+# Copyright (C) 2017, MinGW.org Project
+#
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+
+# Note whence we are reading this makefile fragment, so that we may
+# access it again, for inclusion in source distributions.
+#
+COMMON_MAKEFILE := $(lastword $(MAKEFILE_LIST))
+
+# Configuration
+# -------------
+#
+# Keep the configuration in a consistent state.  Note that we assume
+# that configure has been run initially, (otherwise we wouldn't have
+# a Makefile to begin with); since this also creates config.status,
+# we may normally assume that it is already available ...
+#
+vpath configure ${top_srcdir}
+config.status: configure
+       $(SHELL) config.status --recheck
+
+# ... in which case, updating Makefile should be a simple matter of
+# running config.status ...
+#
+vpath Makefile.in ${top_srcdir}
+requires_existing = $(if $(wildcard $1),$1,$1.missing)
+Makefile: Makefile.in configure $(call requires_existing,config.status)
+       $(SHELL) config.status
+       $(RM) Makefile.stub
+
+.PHONY: config.status.missing
+# ... but, in the event that this may be missing, (e.g. because it
+# has been manually removed, or removed by "make distclean"), suggest
+# running configure, and bail out.
+#
+config.status.missing:
+       $(warning *** cannot execute config.status)
+       $(error please run ${top_srcdir}/configure to regenerate it.)
+
+# If configure itself needs to be updated, we must run autoconf in the
+# respective top level source directory.
+#
+vpath configure.ac ${top_srcdir}
+vpath %.m4 ${top_srcdir}/.. ${top_srcdir}
+configure: configure.ac aclocal.m4 VERSION.m4
+       cd ${top_srcdir}; autoconf -I ..
+
+# Propagate package version, as configured, consistently throughout
+# the package build; in particular, we must generate the _mingw.h and
+# w32api.h header files, from their respective templates with each of
+# the package version macro definitions completed.
+#
+vpath %.h.in ${mingwrt_srcdir}/include ${w32api_srcdir}/include
+
+_mingw.h w32api.h: %.h: %.h.in VERSION.m4
+       $(PACKAGE_VERSION_SCRIPT) $< > $@
+
+PACKAGE_VERSION_SCRIPT = sed \
+  -e s"`$(call PACKAGE_VERSION_FORMAT,LONG,%d,$$3+1000*($$2+1000*$$1))`" \
+  -e s"`$(call PACKAGE_VERSION_FORMAT,MAJOR,%7d,$$1)`" \
+  -e s"`$(call PACKAGE_VERSION_FORMAT,MINOR,%7d,$$2)`" \
+  -e s"`$(call PACKAGE_VERSION_FORMAT,PATCH,%7d,$$3)`"
+
+PACKAGE_VERSION_FORMAT = echo $(PACKAGE_VERSION).0.0 | awk -F. '{ \
+  printf ",%%PACKAGE_VERSION_$1%%,$2,", $3; \
+}'
+
+
+# Distribution
+# ------------
+#
+# Propagate common source files to individual subpackage source
+# distribution tarballs.
+#
+vpath install-sh ${top_srcdir}/.. ${top_srcdir}
+%-srcdist-common-files: $(COMMON_MAKEFILE) VERSION.m4 aclocal.m4 install-sh
+       cp -p $^ dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
+
+# $RCSfile$: end of file
index 2051e3c..e3f2881 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-14  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Refactor mingwrt and w32api common makefile content.
+
+       * Makefile.in (mingwrt-srcdist-config-files): Rename it...
+       (mingwrt-srcdist-common-files): ...as this phoney build rule.
+       (shared_include_file): New macro; define it, and include named file.
+       (configure, config.status, Makefile, config.status.missing, _mingw.h)
+       (w32api.h, PACKAGE_VERSION_SCRIPT, PACKAGE_VERSION_FORMAT): Factor
+       out; relocate them to new file in common parent directory...
+       * ../Makefile.comm: ...here.
+
 2017-03-09  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Fix generated header file dependencies.
index e9bcee2..7e2be61 100644 (file)
@@ -107,59 +107,13 @@ INSTALL_DATA = @INSTALL_DATA@ $1 $2
 mkinstalldirs = @MKDIR_P@ $(addprefix $1,$2)
 LN_S = @LN_S@
 
-# Keep the configuration in a consistent state.  Note that we assume
-# that configure has been run initially, (otherwise we wouldn't have
-# a Makefile to begin with); since this also creates config.status,
-# we may normally assume that it is already available ...
+# Include the makefile content which is common to both the mingwrt,
+# and the w32api packages; this may be included within the top level
+# source directory for each package individually, but we must also
+# be prepared to find it in their common parent directory.
 #
-vpath configure ${top_srcdir}
-config.status: configure
-       $(SHELL) config.status --recheck
-
-# ... in which case, updating Makefile should be a simple matter of
-# running config.status ...
-#
-vpath Makefile.in ${top_srcdir}
-requires_existing = $(if $(wildcard $1),$1,$1.missing)
-Makefile: Makefile.in configure $(call requires_existing,config.status)
-       $(SHELL) config.status
-       $(RM) Makefile.stub
-
-.PHONY: config.status.missing
-# ... but, in the event that this may be missing, (e.g. because it
-# has been manually removed, or removed by "make distclean"), suggest
-# running configure, and bail out.
-#
-config.status.missing:
-       $(warning *** cannot execute config.status)
-       $(error please run ${top_srcdir}/configure to regenerate it.)
-
-# If configure itself needs to be updated, we must run autoconf in the
-# top level source directory.
-#
-vpath configure.ac ${top_srcdir}
-vpath %.m4 ${top_srcdir}/.. ${top_srcdir}
-configure: configure.ac aclocal.m4 VERSION.m4
-       cd ${top_srcdir}; autoconf -I ..
-
-# Propagate package version, as configured, consistently throughout
-# the package build.
-#
-vpath _mingw.h.in ${top_srcdir}/include
-vpath w32api.h.in ${w32api_srcdir}/include
-
-_mingw.h w32api.h: %.h: %.h.in VERSION.m4
-       $(PACKAGE_VERSION_SCRIPT) $< > $@
-
-PACKAGE_VERSION_SCRIPT = sed \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,LONG,%d,$$3+1000*($$2+1000*$$1))`" \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,MAJOR,%7d,$$1)`" \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,MINOR,%7d,$$2)`" \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,PATCH,%7d,$$3)`"
-
-PACKAGE_VERSION_FORMAT = echo $(PACKAGE_VERSION).0.0 | awk -F. '{ \
-  printf ",%%PACKAGE_VERSION_$1%%,$2,", $3; \
-}'
+shared_include_file = $1$(if $(wildcard $1/$2),,/..)/$2
+include $(call shared_include_file,${top_srcdir},Makefile.comm)
 
 # Capture dependencies conveyed within source files, ensuring that
 # header files are taken from our working source tree, and not from
@@ -986,14 +940,10 @@ mingwrt-srcdist-dir:
        $(RM) -r dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
        $(call mkinstalldirs,,dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION))
 
-mingwrt-srcdist-files: mingwrt-srcdist-config-files
+mingwrt-srcdist-files: mingwrt-srcdist-common-files
 mingwrt-srcdist-files: mingwrt-srcdist-testsuite-files
 mingwrt-srcdist-files: mingwrt-srcdist-package-files
 
-vpath install-sh ${top_srcdir}/.. ${top_srcdir}
-mingwrt-srcdist-config-files: aclocal.m4 VERSION.m4 install-sh
-       cp -p $^ dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
-
 mingwrt-srcdist-package-files:
        (cd ${mingwrt_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
          (cd dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) && tar xf -)
index 1c7976d..888d825 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-14  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Refactor mingwrt and w32api common makefile content.
+
+       * Makefile.in (w32api-srcdist-config-files): Rename it...
+       (w32api-srcdist-common-files): ...as this phoney build rule.
+       (shared_include_file): New macro; define it, and include named file.
+       (configure, config.status, Makefile, config.status.missing, _mingw.h)
+       (w32api.h, PACKAGE_VERSION_SCRIPT, PACKAGE_VERSION_FORMAT): Factor
+       out; relocate them to new file in common parent directory...
+       * ../Makefile.comm: ...here.
+
 2017-03-12  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Correct a copyright notice update omission.
index 2ee7204..ba39f7b 100644 (file)
@@ -80,57 +80,13 @@ INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@ $1 $2
 LN_S = @LN_S@
 
-# Keep the configuration in a consistent state.  Note that we assume
-# that configure has been run initially, (otherwise we wouldn't have
-# a Makefile to begin with); since this also creates config.status,
-# we may normally assume that it is already available ...
+# Include the makefile content which is common to both the mingwrt,
+# and the w32api packages; this may be included within the top level
+# source directory for each package individually, but we must also
+# be prepared to find it in their common parent directory.
 #
-vpath configure ${top_srcdir}
-config.status: configure
-       $(SHELL) config.status --recheck
-
-# ... in which case, updating Makefile should be a simple matter of
-# running config.status ...
-#
-vpath Makefile.in ${top_srcdir}
-requires_existing = $(if $(wildcard $1),$1,$1.missing)
-Makefile: Makefile.in configure $(call requires_existing,config.status)
-       $(SHELL) config.status
-
-.PHONY: config.status.missing
-# ... but, in the event that this may be missing, (e.g. because it
-# has been manually removed, or removed by "make distclean"), suggest
-# running configure, and bail out.
-#
-config.status.missing:
-       $(warning *** cannot execute config.status)
-       $(error please run ${top_srcdir}/configure to regenerate it.)
-
-# If configure itself needs to be updated, we must run autoconf in the
-# top level source directory.
-#
-vpath configure.ac ${top_srcdir}
-vpath %.m4 ${top_srcdir}/.. ${top_srcdir}
-configure: configure.ac aclocal.m4 VERSION.m4
-       cd ${top_srcdir}; autoconf -I ..
-
-# Propagate package version, as configured, consistently throughout
-# the package build.
-#
-vpath %.h.in ${top_srcdir}/include ${mingwrt_srcdir}/include
-
-w32api.h _mingw.h: %.h: %.h.in VERSION.m4
-       $(PACKAGE_VERSION_SCRIPT) $< > $@
-
-PACKAGE_VERSION_SCRIPT = sed \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,LONG,%d,$$3+1000*($$2+1000*$$1))`" \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,MAJOR,%7d,$$1)`" \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,MINOR,%7d,$$2)`" \
-  -e s"`$(call PACKAGE_VERSION_FORMAT,PATCH,%7d,$$3)`"
-
-PACKAGE_VERSION_FORMAT = echo $(PACKAGE_VERSION).0.0 | awk -F. '{ \
-  printf ",%%PACKAGE_VERSION_$1%%,$2,", $3; \
-}'
+shared_include_file = $1$(if $(wildcard $1/$2),,/..)/$2
+include $(call shared_include_file,${top_srcdir},Makefile.comm)
 
 # Capture dependencies conveyed within source files, ensuring that
 # header files are taken from our working source tree, and not from
@@ -362,14 +318,10 @@ mingwrt-srcdist-dir w32api-srcdist-dir: %-srcdist-dir:
        $(RM) -r dist/$*-$(PACKAGE_VERSION)
        $(call mkinstalldirs,,dist/$*-$(PACKAGE_VERSION))
 
-w32api-srcdist-files: w32api-srcdist-config-files
+w32api-srcdist-files: w32api-srcdist-common-files
 w32api-srcdist-files: w32api-srcdist-testsuite-files
 w32api-srcdist-files: w32api-srcdist-package-files
 
-vpath install-sh ${top_srcdir}/.. ${top_srcdir}
-%-srcdist-config-files: aclocal.m4 VERSION.m4 install-sh
-         cp -p $^ dist/$*-$(PACKAGE_VERSION)
-
 %-srcdist-package-files:
        (cd ${$*_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
          (cd dist/$*-$(PACKAGE_VERSION) && tar xf -)