[9c3424]: Makefile.comm.in Maximize Restore History

Download this file

Makefile.comm.in    230 lines (203 with data), 9.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# @configure_input@
#
# $Id$
#
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
# Copyright (C) 2010, 2011, 2013, MinGW.org Project
#
#
# Makefile template for generating mingw-get distribution manifests.
#
# 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.
#
VPATH = ${srcdir}:${top_srcdir}:${top_builddir}
# Define hooks for invoking system tools.
#
LN_S = @LN_S@
all: all-distfiles
# Capture repository infrastructure changes. The following rules ensure
# that configure, config.status, and all working makefiles will be updated,
# when any of their respective sources are modified.
#
configure: configure.ac makeopts.m4
cd ${top_srcdir}; autoconf
config.status: configure
cd ${top_builddir}; ./config.status --recheck
Makefile: config.status Makefile.in Makefile.stub.in Makefile.comm.in
cd ${top_builddir}; ./config.status
# To accommodate a top-level make on just a single subdirectory, we list
# each of the managed subdirectories as an independent goal, invoking the
# "all" action for the target subdirectory.
#
@mingw_ac_subdirs@: all
# We use an automatically generated Makefile.sub to manage the list
# of distributable files, ensuring that we automatically capture all
# XML files in the source directory, and converting them to serialised
# LZMA compressed format for upload to the repository server.
#
Makefile.sub: ${srcdir}/*.xml
echo "auto-distfiles = \\" > $@
for file in $^; do echo "$$file.lzma \\" | sed 's,.*/, ,' >> $@; done
echo ' $$(EXTRA_DISTFILES)' >> $@
include Makefile.sub
all-distfiles: unpublished issue.sed $(DISTFILES) $(auto-distfiles)
@SET_MAKE@
# Distributed manifests are serialised by incorporating a date-stamped
# issue number, of the form YYYYMMDDNN; we track issue numbers using the
# issue.log file, (which we keep in CVS to ensure that all maintainers
# can share a common issue number registry).
#
issue_number = YYYYMMDDNN
issue_key = awk '$$3 == "$*.xml" { print $$1 }' issue.new
issue_log = ${srcdir}/issue.log
update_issue_number = \
test -n "$$issue" || issue=0; \
test $$issue -lt $${mark="`date -u +%Y%m%d`00"} && \
issue=$$mark || issue=`expr $$issue + 1`
generate_catalogue = -f ${top_builddir}/issue.sed -e $(store_issue_number)
store_issue_number = "s/@$(issue_number)@/$(issue)/"
# We use SHA1 hashes to determine when source files have been changed
# from the last published version, as recorded in `issue.log'; the hash
# is computed by openssl, after filtering the source through awk; (this
# ensures that the computed hash is not influenced by any unintentional
# pollution due to accidental insertion of CRLF line endings).
#
sha1hash = awk '{ sub( "\r$$", "" ); print }' $$catalogue | $(sha1sum)
sha1sum = openssl sha1 | awk '{print $$NF}'
# Formatting within issue.log is controlled by PAD and TAB settings.
#
TAB = [ ]
PAD = " "
# The following generic rule processes an XML source template, inserting
# the appropriate issue number, and compressing to yield the required LZMA
# distribution manifest. The generated issue number which gets applied is
# appropriately serialised relative to the original record for the source
# XML file being processed, as noted in the local copy of issue.log, which
# is then updated to record the new issue number; to avoid any regression
# of issue numbers, all maintainers are advised to update issue.log from
# CVS immediately prior manifest generation, and to commit back as soon
# as possible thereafter; any ensuing conflict must be resolved before
# any updated manifest is uploaded to the repository server.
#
%.xml.lzma: %.xml
@echo
>> $(issue_log)
rm -f issue.new issue.tmp
test -f ${top_builddir}/issue.sed || $(MAKE) issue.sed
sed '/^$(TAB)*$$/d;/^$(TAB)*#/d' $(issue_log) > issue.new
@catalogue="$<" issue=`awk '$$3 == "$*.xml" { print $$2 }' issue.new`; \
if test x$${hash="`$(sha1hash)`"} != x"`$(issue_key)`"; then \
$(update_issue_number); \
$(RMAKE) refname=$*.xml issue=$$issue hash=$$hash issue.tmp; \
fi; \
$(RMAKE) catalogue=$@ source=$< issue=$$issue generate-catalogue
@if test -f issue.tmp; then \
$(RMAKE) refname=$@ select-for-publication; \
$(RMAKE) update-issue-log; \
fi
rm -f issue.new issue.tmp
.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:
test -d $@ || mkdir $@
# Package lists are dynamically updated, to record the latest issues of each
# referenced package catalogue; the "sed" script used to accomplish this must
# be generated, and driven from, within the top build directory.
#
update-references issue.sed: FORCE
cd ${top_builddir}; $(MAKE) $@
# Requests to update references will be redirected back to each sub-directory
# in turn, to be processed by the following recursive make rule.
#
update-local-references: unpublished issue.sed
rm -rf tmp; mkdir tmp; rm -f issue.tmp
sed '/^$(TAB)*$$/d;/^$(TAB)*#/d' $(issue_log) > issue.new
@for catalogue in `grep -l 'catalogue=' ${srcdir}/*.xml`; \
do refname=`echo $$catalogue | sed 's,^${srcdir}/,,'` \
issue=`awk '$$3 == "'$$refname'" { print $$2 }' issue.new`; \
$(RMAKE) refname=$$refname issue=$$issue generate-reference; \
lzma -dc $$refname.lzma | cmp -s - tmp/$$refname || \
{ $(update_issue_number); \
$(RMAKE) dir=${top_builddir} issue.chk; \
$(RMAKE) refname=$$refname issue=$$issue \
hash=`$(sha1hash)` issue.tmp; \
$(RMAKE) catalogue=$$refname.lzma source=$$catalogue \
issue=$$issue generate-catalogue; \
$(RMAKE) refname=$$refname.lzma select-for-publication; \
}; \
done
@test -f issue.tmp && $(RMAKE) update-issue-log || true
rm -f ${top_builddir}/issue.sed issue.new issue.tmp
rm -rf tmp
# The preceding rules for compiling catalogues for publication, and resolving
# "package-list" references, use several recursive make hooks to perform common
# sub-tasks. GNU make tends to be very verbose about entering and leaving the
# directories in which these sub-tasks are performed, even when there is no
# change of directory involved; to make it quieter, we prefer this form of
# recursive invocation for local sub-tasks.
#
RMAKE = $(MAKE)@NO_PRINT_DIRECTORY@
# The following sub-task rule creates a tentative "publication-ready" version
# of each catalogue.
#
generate-catalogue: FORCE
sed $(generate_catalogue) $(source) \
| lzma -c > $(catalogue)
# The following sub-task rule creates a reference copy of each catalogue, for
# comparison with the tentative "publication-ready" version, when checking for
# changes introduced by resolution of "package-list" references.
#
generate-reference: FORCE
sed $(generate_catalogue) ${srcdir}/$(refname) \
> tmp/$(refname)
# When any generated catalogue has been found to differ from its previously
# published version, (if any), the following rule adds it to the schedule of
# catalogues which should be republished, (or published for the first time).
#
select-for-publication: FORCE
cd unpublished && $(LN_S) -f ../$(refname) .
# The remaining macros and rules define the sub-tasks for management of the
# temporary files used to control the iterative resolution of "package-list"
# references, and to capture modifications to be recorded in the issue log...
#
extract_log_file_header = '/^$(TAB)*$$/q;/^$(TAB)*[^\#]/q;p'
extract_log_file_footer = 's/^$(TAB)*$$/break/;1,/^$(TAB)*[^\#]/d;/^$(TAB)*\#/p'
issue.chk: FORCE
test -f issue.tmp && mv -f issue.tmp issue.new || true
test -f ${dir}/$@ && echo check > ${dir}/$@ || true
issue.new: FORCE
issue.tmp: issue.new
awk '$$3 != "$(refname)"' $^ > $@
echo $(PAD)$(hash) $(issue) $(refname) >> $@
# ...with this final rule completing the recording of the current state of
# publication, in the permanent issue log files.
#
update-issue-log: FORCE
sed -n $(extract_log_file_header) $(issue_log) > issue.new
LC_COLLATE=POSIX sort -k3 issue.tmp >> issue.new;
sed -n $(extract_log_file_footer) $(issue_log) >> issue.new;
rm -f $(issue_log) && mv issue.new $(issue_log)
# $RCSfile$: end of file