OSDN Git Service

2010-12-12 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
[mingw/mingw-dist.git] / Makefile.comm.in
1 # @configure_input@
2 #
3 # $Id$
4 #
5 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
6 # Copyright (C) 2010, MinGW Project
7 #
8 #
9 # Makefile template for generating mingw-get distribution manifests.
10 #
11 #   Project: @PACKAGE_TARNAME@
12 #   Version: @PACKAGE_VERSION@
13 #
14 #
15 # This is free software.  Permission is granted to copy, modify and
16 # redistribute this software, under the provisions of the GNU General
17 # Public License, Version 3, (or, at your option, any later version),
18 # as published by the Free Software Foundation; see the file COPYING
19 # for licensing details.
20 #
21 # Note, in particular, that this software is provided "as is", in the
22 # hope that it may prove useful, but WITHOUT WARRANTY OF ANY KIND; not
23 # even an implied WARRANTY OF MERCHANTABILITY, nor of FITNESS FOR ANY
24 # PARTICULAR PURPOSE.  Under no circumstances will the author, or the
25 # MinGW Project, accept liability for any damages, however caused,
26 # arising from the use of this software.
27 #
28 VPATH = ${srcdir}
29
30 # Define hooks for invoking system tools.
31 #
32 LN_S = @LN_S@
33
34 all: all-sync all-distfiles
35
36 # To accommodate a top-level make on just a single subdirectory, we list
37 # each of the managed subdirectories as an independent goal, invoking the
38 # "all" action for the target subdirectory.
39 #
40 @mingw_ac_subdirs@: all
41
42 # We use an automatically generated Makefile.sub to manage the list
43 # of distributable files, ensuring that we automatically capture all
44 # XML files in the source directory, and converting them to serialised
45 # LZMA compressed format for upload to the repository server.
46 #
47 Makefile.sub: ${srcdir}/*.xml
48         echo "auto-distfiles = \\" > $@
49         for file in $^; do echo "$$file.lzma \\" | sed 's,.*/,  ,' >> $@; done
50         echo '  $$(EXTRA_DISTFILES)' >> $@
51
52 include Makefile.sub
53 all-distfiles: unpublished $(DISTFILES) $(auto-distfiles)
54
55 # Distributed manifests are serialised by incorporating a date-stamped
56 # issue number, of the form YYYYMMDDNN; we track issue numbers using the
57 # issue.log file, (which we keep in CVS to ensure that all maintainers
58 # can share a common issue number registry).
59 #
60 issue_number = YYYYMMDDNN
61 issue_log = ${srcdir}/issue.log
62
63 # Formatting within issue.log is controlled by PAD and TAB settings.
64 #
65 TAB = [  ]
66 PAD = "  "
67
68 # The following generic rule processes an XML source template, inserting
69 # the appropriate issue number, and compressing to yield the required LZMA
70 # distribution manifest.  The generated issue number which gets applied is
71 # appropriately serialised relative to the original record for the  source
72 # XML file being processed, as noted in the local copy of issue.log, which
73 # is then updated to record the new issue number; to avoid any regression
74 # of issue numbers, all maintainers are advised to update issue.log from
75 # CVS immediately prior manifest generation, and to commit back as soon
76 # as possible thereafter; any ensuing conflict must be resolved before
77 # any updated manifest is uploaded to the repository server.
78 #
79 %.xml.lzma: %.xml
80         >> $(issue_log)
81         sed '/^$(TAB)*$$/d;/^$(TAB)*#/d' $(issue_log) > issue.tmp
82         sed -n '/^$(TAB)*$$/q;/^$(TAB)*[^#]/q;p' $(issue_log) > issue.new
83         test x$${issue="`sed -n 's/^$(TAB)*$*.xml://p' $(issue_log)`"} = x && \
84           issue=0 && echo $(PAD)"$*.xml:0" >> issue.tmp; \
85         test $$issue -lt $${mark="`date -u +%Y%m%d`00"} && \
86           issue=$$mark || issue=`expr $$issue + 1`; \
87         sed "s/^\($(TAB)*$*.xml:\).*/\1$$issue/" issue.tmp | sort >> issue.new; \
88         sed "s/@$(issue_number)@/$$issue/" $< | lzma -c > $@
89         sed -n 's/^$(TAB)*$$/break/;1,/^$(TAB)*[^#]/d;/^$(TAB)*#/p' \
90           $(issue_log) >> issue.new
91         rm -f $(issue_log) issue.tmp
92         mv issue.new $(issue_log)
93         cd unpublished && $(LN_S) ../$@ .
94
95 .PHONY: FORCE
96 # An internal target, to specify a dependency which must always be updated.
97 FORCE:
98
99 # Create a local directory in which to collect files which we have generated,
100 # but we have not yet published; (we make this a prerequisite of all sources,
101 # to ensure that it is created when the source directory is scanned to create
102 # Makefile.sub, so that will always exist when any individual source file is
103 # processed, even on explicit file-by-file request).
104 #
105 ${srcdir}/*.xml: unpublished
106 unpublished: FORCE
107         test -d unpublished || mkdir unpublished
108
109 # Before creating any set of files for publication, the local working copy
110 # of the entire publication data set needs to be synchronised with the state
111 # of any externally published copies.  This is accomplished with reference
112 # to the publication state as recorded in the `issue.log' files which may
113 # be found in each publication subdirectory; the `all-sync-offline' and
114 # `all-sync-to-cvs' targets fulfil this requirement, allowing the user to
115 # select between synchronising to the locally recorded publication state as
116 # is, or (preferably) after first synchronising the local state with the
117 # state as recorded in the master CVS repository, respectively.
118 #
119 cvsroot = `cat ${srcdir}/CVS/Root`
120 repository = `cat ${srcdir}/CVS/Repository`
121
122 all-sync-offline: all-sync-offline-begin all-sync-to-cvs-or-offline
123 all-sync all-sync-to-cvs: all-sync-to-cvs-begin all-sync-to-cvs-or-offline
124
125 all-sync-begin: FORCE
126         rm -rf tmp
127
128 all-sync-offline-begin: all-sync-begin
129         mkdir tmp
130
131 all-sync-to-cvs-begin: all-sync-begin
132         cvs -z3 -Q -d ${cvsroot} checkout -A -d tmp ${repository}/issue.log
133         rm -f $(issue_log); mv tmp/issue.log $(issue_log)
134
135 all-sync-to-cvs-or-offline: FORCE
136         $(LN_S) ../$(issue_log) tmp
137         for file in ${srcdir}/*.xml *.xml.lzma; do \
138           if test -f $$file; then $(LN_S) ../$$file tmp; fi; done
139         cd tmp && $(MAKE) -f ../../Makefile.sync $@
140         rm -rf tmp
141
142 # $RCSfile$: end of file