OSDN Git Service

Update build system to facilitate publication state synchronisation.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Wed, 1 Sep 2010 20:18:39 +0000 (20:18 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Wed, 1 Sep 2010 20:18:39 +0000 (20:18 +0000)
ChangeLog
Makefile.comm.in
Makefile.in
Makefile.sync.in [new file with mode: 0644]
configure.ac

index 5552a21..d335634 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
 2010-09-01  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Update build system to facilitate publication state synchronisation.
+
+       * configure.ac (AC_PROG_LN_S): Add macro reference.
+       (mingw_ac_subdirs): Add `common' subdirectory reference.
+       (Makefile.sync): New AC_OUTPUT target; add it.
+
+       * Makefile.in (all): New default goal; define it, replacing...
+       (all-distfiles): ...this; retain as a dependent synonym for `all'.
+       (all-sync, all-sync-to-cvs, all-sync-offline): New alternative goals;
+       define them, as further dependent synonyms for `all'.
+       (update): Defunct goal; delete it.
+
+       * Makefile.comm.in (LN_S): New macro; define from AC_PROG_LN_S.
+       (unpublished, all-sync-online): New primary targets.
+       (all-sync, all-sync-to-cvs): New primary targets, mutually aliased.
+       (cvsroot, repository): New internal use macros; define them.
+       (all-sync-begin, all-sync-offline-begin, all-sync-to-cvs-begin):
+       (all-sync-to-cvs-or-offline): New internal targets.
+       (all): Remove prerequisite `update'; add `all-sync'.
+       (all-distfiles): Add prerequisite `unpublished'.
+       (update): Defunct target; delete it.
+
+       * Makefile.sync.in: New file; it defines the recursive make actions
+       required to perform the issue.log --> *.xml.lzma synchronisation.
+
+2010-09-01  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        Add free-standing manifest for msys-flex.
 
        * msys/msys-flex.xml (msys-flex-bin): Add missing dependency...
index 3f4ac16..0d8ba73 100644 (file)
 #
 VPATH = ${srcdir}
 
-all: update all-distfiles
+# Define hooks for invoking system tools.
+#
+LN_S = @LN_S@
+
+all: all-sync all-distfiles
 
 # To accommodate a top-level make on just a single subdirectory, we list
 # each of the managed subdirectories as an independent goal, invoking the
@@ -46,7 +50,7 @@ Makefile.sub: ${srcdir}/*.xml
        echo '  $$(EXTRA_DISTFILES)' >> $@
 
 include Makefile.sub
-all-distfiles: $(DISTFILES) $(auto-distfiles)
+all-distfiles: unpublished $(DISTFILES) $(auto-distfiles)
 
 # Distributed manifests are serialised by incorporating a date-stamped
 # issue number, of the form YYYYMMDDNN; we track issue numbers using the
@@ -56,10 +60,6 @@ all-distfiles: $(DISTFILES) $(auto-distfiles)
 issue_number = YYYYMMDDNN
 issue_log = ${srcdir}/issue.log
 
-update: FORCE
-       cd ${srcdir}; cvs -z3 -Q update -AC issue.log
-       rm -f ${srcdir}'/.#issue.log'*
-
 # Formatting within issue.log is controlled by PAD and TAB settings.
 #
 TAB = [         ]
@@ -90,9 +90,53 @@ PAD = "  "
          $(issue_log) >> issue.new
        rm -f $(issue_log) issue.tmp
        mv issue.new $(issue_log)
+       cd unpublished && $(LN_S) ../$@ .
 
 .PHONY: FORCE
 # An internal target, to specify a dependency which must always be updated.
 FORCE:
 
+# Create a local directory in which to collect files which we have generated,
+# but we have not yet published; (we make this a prerequisite of all sources,
+# to ensure that it is created when the source directory is scanned to create
+# Makefile.sub, so that will always exist when any individual source file is
+# processed, even on explicit file-by-file request).
+#
+${srcdir}/*.xml: unpublished
+unpublished: FORCE
+       test -d unpublished || mkdir unpublished
+
+# Before creating any set of files for publication, the local working copy
+# of the entire publication data set needs to be synchronised with the state
+# of any externally published copies.  This is accomplished with reference
+# to the publication state as recorded in the `issue.log' files which may
+# be found in each publication subdirectory; the `all-sync-offline' and
+# `all-sync-to-cvs' targets fulfil this requirement, allowing the user to
+# select between synchronising to the locally recorded publication state as
+# is, or (preferably) after first synchronising the local state with the
+# state as recorded in the master CVS repository, respectively.
+#
+cvsroot = `cat ${srcdir}/CVS/Root`
+repository = `cat ${srcdir}/CVS/Repository`
+
+all-sync-offline: all-sync-offline-begin all-sync-to-cvs-or-offline
+all-sync all-sync-to-cvs: all-sync-to-cvs-begin all-sync-to-cvs-or-offline
+
+all-sync-begin: FORCE
+       rm -rf tmp
+
+all-sync-offline-begin: all-sync-begin
+       mkdir tmp
+
+all-sync-to-cvs-begin: all-sync-begin
+       cvs -z3 -Q -d ${cvsroot} checkout -A -d tmp ${repository}/issue.log
+       rm -f $(issue_log); mv tmp/issue.log $(issue_log)
+
+all-sync-to-cvs-or-offline: FORCE
+       $(LN_S) ../$(issue_log) tmp
+       for file in ${srcdir}/*.xml *.xml.lzma; do \
+         if test -f $$file; then $(LN_S) ../$$file tmp; fi; done
+       cd tmp && $(MAKE) -f ../../Makefile.sync $@
+       rm -rf tmp
+
 # $RCSfile$: end of file
index f93ce60..23d0be9 100644 (file)
@@ -25,7 +25,7 @@
 # MinGW Project, accept liability for any damages, however caused,
 # arising from the use of this software.
 #
-update all-distfiles: @mingw_ac_subdirs@
+all: @mingw_ac_subdirs@
 
 @mingw_ac_subdirs@: FORCE
        @if test -r $@/Makefile; then \
@@ -35,4 +35,11 @@ update all-distfiles: @mingw_ac_subdirs@
 .PHONY: FORCE
 FORCE:
 
+# We must list all goals which may be specified for sub-directories,
+# so that they may be correctly passed through $(MAKECMDGOALS); at this
+# level, the action for each is equivalent to that to be performed for
+# the `all' goal.
+#
+all-sync all-sync-offline all-sync-to-cvs all-distfiles: all
+
 # $RCSfile$: end of file
diff --git a/Makefile.sync.in b/Makefile.sync.in
new file mode 100644 (file)
index 0000000..fd79f12
--- /dev/null
@@ -0,0 +1,68 @@
+# @configure_input@
+#
+# $Id$
+#
+# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+# Copyright (C) 2010, MinGW Project
+#
+#
+# Auxiliary makefile template; this provides for synchronisation of
+# a local manifest build with the published, state as it is recorded
+# in the issue.log files in the source for each managed subdirectory.
+#
+#   Project: @PACKAGE_TARNAME@
+#   Version: @PACKAGE_VERSION@
+#
+#
+# This is free software.  Permission is granted to copy, modify and
+# redistribute this software, under the provisions of the GNU General
+# Public License, Version 3, (or, at your option, any later version),
+# as published by the Free Software Foundation; see the file COPYING
+# for licensing details.
+#
+# Note, in particular, that this software is provided "as is", in the
+# hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
+# even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
+# PARTICULAR PURPOSE.  Under no circumstances will the author, or the
+# MinGW Project, accept liability for any damages, however caused,
+# arising from the use of this software.
+#
+
+TAB = [         ]
+serial_number = YYYYMMDDNN
+
+LN_S = @LN_S@
+
+# This default rule attempts to synchronise the state of the locally generated
+# manifest files, to match the published state as recorded in `issue.log'
+#
+all-sync all-sync-to-cvs-or-offline: issue.log
+issue.log: FORCE *.xml
+       @for srcfile in $^; do \
+         case $$srcfile in `echo FORCE $? | sed 's, ,|,g'`) ;; *) \
+           if test ! -e "$$srcfile.lzma"; then \
+             stamp=`sed -n "s,^$(TAB)*$$srcfile:\([0-9][0-9]*\),\1,p" $@`; \
+             if test -n "$$stamp"; then \
+               echo sed "s,@$(serial_number)@,$$stamp," "$$srcfile |" \
+                 "lzma -c > $$srcfile.lzma"; \
+               sed "s,@$(serial_number)@,$$stamp," $$srcfile | \
+                 lzma -c > $$srcfile.lzma; \
+               echo touch -r $@ $$srcfile.lzma; \
+               touch -r $@ $$srcfile.lzma; \
+               rm -f ../$$srcfile.lzma; \
+               mv $$srcfile.lzma ..; \
+               $(LN_S) ../$$srcfile.lzma .; \
+             fi; \
+           fi ;; \
+         esac; \
+       done
+
+.PHONY: FORCE
+# An internal target, to specify a dependency which must always be updated.
+FORCE:
+
+# If there are no *.xml files, this provides a "do nothing" fall back rule.
+#
+*.xml:
+
+# $RCSfile$: end of file
index 379eb1c..7e6c116 100644 (file)
 #
   AC_INIT([mingw-dist],[0.0],[http://mingw.org/reporting_bugs])
 
+# Check for required tools.
+#
+  AC_PROG_LN_S
+
 # Specify all makefiles which are to be created
 #
   AC_CONFIG_FILES([Makefile])
   AC_CONFIG_FILES([Makefile.comm])
-  AC_FOREACH([subdir],[mingw32 msys],
+  AC_CONFIG_FILES([Makefile.sync])
+  AC_FOREACH([subdir],[common mingw32 msys],
   [AC_CONFIG_FILES(subdir[/Makefile:Makefile.stub.in])dnl
    mingw_ac_subdirs=${mingw_ac_subdirs+"${mingw_ac_subdirs} "}"subdir"dnl
   ])