OSDN Git Service

Streamline the installation procedure.
[mingw/mingw-get.git] / Makefile.in
1 # @configure_input@
2 #
3 # $Id$
4
5 PACKAGE_TARNAME = @PACKAGE_TARNAME@
6 PACKAGE_VERSION = @PACKAGE_VERSION@
7
8 # Written by Keith Marshall <keith@users.osdn.me>
9 # Copyright (C) 2009-2013, 2020, MinGW.org Project
10 #
11 #
12 # Makefile template for mingw-get
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.org Project, accept liability for any damages, however caused,
26 # arising from the use of this software.
27 #
28 PACKAGE_SUBSYSTEM = @host_os@
29
30 CLI_RELEASE_CLASS = @CLI_RELEASE_CLASS@
31 GUI_RELEASE_CLASS = @GUI_RELEASE_CLASS@
32
33 BUILD_TAG = `test -f build.tag && cat build.tag`
34 DEBUGLEVEL = @DEBUGLEVEL@
35
36 # Establish the appropriate mechanism for invoking 'make' recursively,
37 # WITHOUT incurring the noise of its "Entering directory..." messages.
38 #
39 QUIET_MAKE = $(MAKE)@NO_PRINT_DIRECTORY@
40 @SET_MAKE@
41
42 # Establish source code directory organisation, and set reference
43 # paths for access to source files.
44 #
45 srcdir = @srcdir@
46 abs_top_srcdir = @abs_top_srcdir@
47
48 vpath %.ico @srcdir@/icons
49 VPATH = @top_srcdir@/src @top_srcdir@/src/pkginfo @top_srcdir@/tinyxml
50
51 # Identify common build tools, and set their default options.
52 #
53 CC = @CC@
54 CFLAGS = @CFLAGS@
55 CPPFLAGS = @CPPFLAGS@ -D DEBUGLEVEL=$(DEBUGLEVEL) $(INCLUDES)
56
57 CXX = @CXX@
58 CXXFLAGS = $(CFLAGS)
59
60 INCLUDES = -I ${srcdir}/src -I ${srcdir}/src/pkginfo -I ${srcdir}/tinyxml
61
62 AR = @AR@
63 ARFLAGS = @ARFLAGS@
64
65 # A 'lex' compatible LALR(1) scanner is required for SCM sourced builds,
66 # or if the user modifies any 'lex' source.  This AC_PROG_LEX compatible
67 # macro set facilitates the handling of any situation where 'lex' is not
68 # available, but is required to complete the build.
69 #
70 LEX = @LEX@
71 LEX_COMMAND = $(LEX) $(LFLAGS) -t $< > $(LEX_OUTPUT)
72 LEX_COMMAND_ABORT = { $(LEX_MISSING); rm -f $(LEX_OUTPUT); exit 2; }
73 LEX_MISSING = (echo; echo $(LEX_MISSING_MESSAGE); echo) | $(FORMAT_MESSAGE)
74 LEX_MISSING_MESSAGE = "I cannot find the program 'lex' on your system; \
75 it is required because you either do not have the file '$@', or you appear \
76 to have modified the file '$<'.  If neither of these is the case, then you \
77 may wish to update the time stamp of '$@', so that it appears to be newer \
78 than '$<', before you run make again."
79 LEX_OUTPUT = @LEX_OUTPUT_ROOT@.c
80
81 # The following macro uses 'awk' to emulate a rudimentary 'nroff' filter,
82 # for formatting notification messages, such as those which are emitted to
83 # report the above "missing 'lex'" condition.
84
85 FORMAT_MESSAGE = awk '\
86   BEGIN       { $(AWK_CLEAR_LINE_BUFFER) }\
87   /^\. *br$$/ { $(AWK_PRINT_AND_CLEAR_BUFFER) }\
88   NF == 0     { $(AWK_COLLECT_BLANK_LINE) }\
89   /^[^.]/     { $(AWK_COLLECT_MESSAGE) }\
90   END         { $(AWK_FLUSH_LINE_BUFFER) }'
91
92 # Establish a default line length for formatting messages.
93 #
94 MESSAGE_FOLD_WIDTH = 68
95
96 # The following macros implement the internals of the message formatter.
97 #
98 AWK_CLEAR_LINE_BUFFER = linebuf = "";
99 AWK_FLUSH_LINE_BUFFER = if( linebuf != "" ){ $(AWK_PRINT_AND_CLEAR_BUFFER) }
100 AWK_PRINT_AND_CLEAR_BUFFER = $(AWK_PRINT_LINE_BUFFER) $(AWK_CLEAR_LINE_BUFFER)
101 AWK_COLLECT_MESSAGE = \
102   for( i = 0; i < NF; ) \
103   { if( linebuf == "" ) newbuf = $$++i; else \
104     { newbuf = linebuf; \
105       if( match( linebuf, "[.!?]$$" ) ) newbuf = newbuf " "; \
106       newbuf = newbuf " " $$++i; \
107     } \
108     if( length( newbuf ) > $(MESSAGE_FOLD_WIDTH) ) \
109     { print linebuf; \
110       linebuf = $$i; \
111     } \
112     else linebuf = newbuf; \
113   }
114 AWK_COLLECT_BLANK_LINE = $(AWK_FLUSH_LINE_BUFFER) $(AWK_PRINT_LINE_BUFFER)
115 AWK_PRINT_LINE_BUFFER = print linebuf; 
116
117 # Identify an appropriate resource compiler, for GUI builds,
118 # and define a set of script macros to propagate the build-time
119 # specific package meta-data into compiled resource modules.
120 #
121 RC = @RC@
122 RC_SCRIPT = tag_class=$(GUI_RELEASE_CLASS) \
123     $(TAG_SCRIPT)
124
125 VERSION_SCRIPT = tag_class=$(CLI_RELEASE_CLASS) \
126     $(TAG_SCRIPT)
127
128 TAG_SCRIPT = tag=$(BUILD_TAG); \
129   test "x$$tag_class" != x && test "x$$tag" != x && tag="$$tag_class-$$tag"; \
130   test "x$$tag" != x && tag="-$$tag"; \
131   sed  \
132     -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
133     -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
134     -e "s!%PACKAGE_VERINFO_PRODUCT_VERSION%!`$(PACKAGE_VERINFO_SCRIPT)`!g" \
135     -e "s!%PACKAGE_BASE_DISTNAME%!$(PACKAGE_DISTNAME)$$tag-%s.$(TAREXT)!g" \
136     -e "s!%PACKAGE_DATA_DISTNAME%!$(SETUP_DISTNAME)$$tag-%s.$(TAREXT)!g" \
137     -e "s!%PACKAGE_DIST_URL%!@PACKAGE_DIST_DOMAIN@/@PACKAGE_DIST_DIR@!g" \
138     -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
139     -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
140
141 PACKAGE_VERINFO_SCRIPT = \
142   echo $(PACKAGE_VERSION) | awk -F. '{ \
143     printf "%d, %d, ", $$1, $$2 * 100 + $$3 \
144   }'; (test "x$$tag" = x && date +%Y%m%d-0 || echo $$tag) | awk -F- '{ \
145     DF = NF - 1; printf "%d, %d", (( substr( $$DF, 1, 4 ) - 1970 ) * 16 \
146       + substr( $$DF, 5, 2 )) * 32 + substr( $$DF, 7, 2 ), $$NF \
147   }'
148
149 RC_INCLUDES = -I . -I ${srcdir}/src -I ${srcdir}/icons
150
151 # Specify extensions, and link-time requirements, for binary
152 # package deliverables.
153 #
154 OBJEXT = @OBJEXT@
155 EXEEXT = @EXEEXT@
156
157 LDFLAGS = -static @LDFLAGS@
158 GUI_LDFLAGS = -mwindows $(LDFLAGS)
159 LIBS = -llua -lz -lbz2 -llzma -lwininet
160
161 # Define the content of package deliverables.
162 #
163 CORE_DLL_OBJECTS  =  \
164    climain.$(OBJEXT) pkgshow.$(OBJEXT) dmhcore.$(OBJEXT) dmhmsgs.$(OBJEXT) \
165    pkgbind.$(OBJEXT) pkginet.$(OBJEXT) pkgstrm.$(OBJEXT) pkgname.$(OBJEXT) \
166    pkgexec.$(OBJEXT) pkgfind.$(OBJEXT) pkginfo.$(OBJEXT) pkgspec.$(OBJEXT) \
167    pkgopts.$(OBJEXT) sysroot.$(OBJEXT) pkghash.$(OBJEXT) pkgkeys.$(OBJEXT) \
168    pkgdeps.$(OBJEXT) pkgreqs.$(OBJEXT) pkginst.$(OBJEXT) pkgunst.$(OBJEXT) \
169    tarproc.$(OBJEXT) xmlfile.$(OBJEXT) keyword.$(OBJEXT) vercmp.$(OBJEXT) \
170    tinyxml.$(OBJEXT) tinystr.$(OBJEXT) tinyxmlparser.$(OBJEXT) \
171    apihook.$(OBJEXT) mkpath.$(OBJEXT)  tinyxmlerror.$(OBJEXT)
172
173 CLI_EXE_OBJECTS  =   \
174    clistub.$(OBJEXT) version.$(OBJEXT) approot.$(OBJEXT) getopt.$(OBJEXT)
175
176 GUIMAIN_OBJECTS  =   \
177    guimain.$(OBJEXT) dmhguix.$(OBJEXT) $(GUIMAIN_LIB_OBJECTS) \
178    approot.$(OBJEXT) guimain.res.$(OBJEXT)
179
180 GUIMAIN_LIB_OBJECTS = \
181    guiexec.$(OBJEXT) pkgview.$(OBJEXT) pkgtree.$(OBJEXT) pkglist.$(OBJEXT) \
182    pkgdata.$(OBJEXT) pkgnget.$(OBJEXT)
183
184 GUIMAIN_LIBS = -lwtklite -lcomctl32
185
186 SETUP_TOOL_OBJECTS = setup.$(OBJEXT) setup.res.$(OBJEXT) apihook.$(OBJEXT)
187 SETUP_TOOL_LIBS = -lwtklite -lwininet -lcomctl32 -lole32 -llzma
188
189 SETUP_DLL_OBJECTS =  \
190    dllhook.$(OBJEXT) $(GUIMAIN_LIB_OBJECTS) guimain.res.$(OBJEXT)
191
192 SETUP_DLL_LIBS = $(GUIMAIN_LIBS)
193
194 script_srcdir = ${srcdir}/scripts/libexec
195
196 BIN_PROGRAMS = pkginfo$(EXEEXT) mingw-get$(EXEEXT)
197 LIBEXEC_PROGRAMS = guistub$(EXEEXT) guimain$(EXEEXT) lastrites$(EXEEXT)
198 LIBEXEC_DLLS = mingw-get-0.dll
199
200 LIBEXEC_SCRIPTS = ${script_srcdir}/setup.lua \
201    ${script_srcdir}/shlink.js ${script_srcdir}/unlink.js
202
203 # Primary build goals...
204 #
205 all: all-core all-setup
206 all-core: $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS) $(LIBEXEC_DLLS)
207 all-setup: all-setup-dll all-setup-exe
208 all-setup-dll: mingw-get-setup-0.dll
209
210 all-setup-exe:
211         @$(QUIET_MAKE) CXXFLAGS='$(CXXFLAGS) -Os' mingw-get-setup$(EXEEXT)
212
213 mingw-get-setup$(EXEEXT): $(SETUP_TOOL_OBJECTS)
214         $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(SETUP_TOOL_LIBS)
215
216 pkginfo$(EXEEXT):  driver.$(OBJEXT) pkginfo.$(OBJEXT)
217         $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $+
218
219 mingw-get$(EXEEXT): $(CLI_EXE_OBJECTS)
220         $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $+
221
222 guistub$(EXEEXT): guistub.$(OBJEXT) pkgicon.$(OBJEXT)
223         $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+
224
225 guimain$(EXEEXT): $(GUIMAIN_OBJECTS) $(LIBEXEC_DLLS)
226         $(CXX) -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(GUIMAIN_LIBS)
227
228 lastrites$(EXEEXT): rites.$(OBJEXT)
229         $(CC) -o $@ $(CFLAGS) $(GUI_LDFLAGS) $+
230
231 mingw-get-0.dll: $(CORE_DLL_OBJECTS)
232         $(CXX) -shared -o $@ $(CXXFLAGS) $(LDFLAGS) $+ $(LIBS)
233
234 mingw-get-setup-0.dll: $(SETUP_DLL_OBJECTS) mingw-get-0.dll
235         $(CXX) -shared -o $@ $(CXXFLAGS) $(GUI_LDFLAGS) $+ $(SETUP_DLL_LIBS)
236
237 # The following recursive invocation hook provides a mechanism for
238 # accessing make's facility for reporting what it is doing, even when
239 # the command to be invoked is encapsulated within a more complex block,
240 # which has been marked for explicit silent execution; usage is:
241 #
242 #   $(WITH_REQUEST)='command to be executed' execute-command
243 #
244 # (with no intervening white space around the assignment operator, and
245 #  ensuring that the command to be executed is appropriately quoted).
246 #
247 WITH_REQUEST = $(QUIET_MAKE) COMMAND
248 execute-command:
249         $(COMMAND)
250
251 # Build system configuration management...
252 #
253 vpath configure @top_srcdir@
254 vpath configure.ac @top_srcdir@
255 vpath %.m4 @top_srcdir@ @buildauxdir@/m4
256 vpath Makefile.in @top_srcdir@
257
258 Makefile: Makefile.in VERSION.m4 config.status
259         ./config.status
260
261 config.status: configure
262         ./config.status --recheck
263
264 configure: configure.ac VERSION.m4 aclocal.m4 missing.m4 makeopts.m4
265         cd ${abs_top_srcdir}; autoconf
266
267 # Compilation and dependency tracking...
268 #
269 DEPFLAGS = -MMD -MP
270 RC_DEPFLAGS = -MM -MP -MD -MF $*.res.x
271 sinclude *.d
272
273 %.c: %.l
274         @test x$(LEX) = x: \
275           && { $(QUIET_MAKE) LEX=lex $(@F) || $(LEX_COMMAND_ABORT); } \
276           || $(WITH_REQUEST)='$(LEX_COMMAND)' execute-command
277         @test -f $(LEX_OUTPUT) && test -n "`cat $(LEX_OUTPUT)`" \
278           && $(WITH_REQUEST)='mv $(LEX_OUTPUT) $(@F)' execute-command \
279           || $(WITH_REQUEST)='rm -f $(LEX_OUTPUT)' execute-command
280
281 %.$(OBJEXT): %.c
282         $(CC) $(DEPFLAGS) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
283
284 %.$(OBJEXT): %.cpp
285         $(CXX) $(DEPFLAGS) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
286
287 %.res.$(OBJEXT): %.rc
288         $(CC) $(RC_DEPFLAGS) $(RC_INCLUDES) -DRC_INVOKED -xc-header $<
289         sed 's,$*\.$(OBJEXT):,$@:,' $*.res.x > $*.res.d; rm -f $*.res.x
290         $(RC_SCRIPT) $< | $(RC) $(RC_INCLUDES) -o $@
291
292 %.$(OBJEXT): %.ico
293         echo $* ICON $*.ico | $(RC) -I ${srcdir}/icons -o $@
294
295 # Release tagging; note that, whereas %.time is nominally updated as
296 # a side effect of %.tag, we also must provide an explicit rule which
297 # will update it directly.  This ensures that we may INDIRECTLY force
298 # a dependency on the TIME when %.tag is updated, WITHOUT creating an
299 # explicit dependency on %.tag itself.
300 #
301 time-stamp:
302 %.time:; > $@
303 %.tag: time-stamp
304         >> $@; tag=`date +%Y%m%d`; \
305           tag=`awk -F- -v today=$$tag ' \
306             BEGIN { tag = 1 } $$1 == today { tag += $$2 } \
307             END { print today "-" tag }' $@`; \
308           echo $$tag > $@
309         > $*.time
310
311 %.c: %.c.in
312         $(VERSION_SCRIPT) $< > $@
313
314 %.h: %.h.in
315         $(VERSION_SCRIPT) $< > $@
316
317 # The following dependencies must be explicitly declared.
318 #
319 guimain.res.$(OBJEXT) setup.res.$(OBJEXT): Makefile build.time verinfo.h
320 verinfo.h version.c: Makefile build.time
321
322 # Installation tools and directory paths...
323 #
324 mkinstalldirs = @MKDIR_P@
325
326 prefix = @prefix@
327 exec_prefix = @exec_prefix@
328 localstatedir = @localstatedir@
329 libexecdir = @libexecdir@
330 bindir = @bindir@
331
332 PACKAGE_CONFIG_DIR = ${localstatedir}/lib/${PACKAGE_TARNAME}/data
333
334 INSTALL = @INSTALL@
335 INSTALL_DATA = @INSTALL_DATA@
336 INSTALL_PROGRAM = @INSTALL_PROGRAM@
337 INSTALL_SCRIPT = @INSTALL_SCRIPT@
338
339 LN_S = @LN_S@
340
341 # Installation rules...
342 #
343 installdirs:
344         $(mkinstalldirs) ${bindir}
345         $(mkinstalldirs) ${libexecdir}/${PACKAGE_TARNAME}
346         $(mkinstalldirs) ${PACKAGE_CONFIG_DIR}
347
348 install: all installdirs install-profile
349         $(INSTALL_PROGRAM) $(BIN_PROGRAMS) ${bindir}
350         $(INSTALL_PROGRAM) $(LIBEXEC_DLLS) ${libexecdir}/${PACKAGE_TARNAME}
351         $(INSTALL_PROGRAM) $(LIBEXEC_PROGRAMS) ${libexecdir}/${PACKAGE_TARNAME}
352         $(INSTALL_DATA) $(LIBEXEC_SCRIPTS) ${libexecdir}/${PACKAGE_TARNAME}
353
354 vpath %.xml.in ${srcdir}/xml
355 install-profile: install-%: %.xml
356         $(INSTALL_DATA) $*.xml ${PACKAGE_CONFIG_DIR}/defaults.xml
357
358 %.xml: %.xml.in
359         $(TAG_SCRIPT) $< > $@
360
361 install-strip:
362         $(QUIET_MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
363
364 # Packaging and distribution...
365 # "Native" source files, (i.e. those specific to mingw-get), are...
366 #
367 LICENCE_FILES = README COPYING
368 SRCDIST_FILES = $(LICENCE_FILES) ChangeLog NEWS INSTALL \
369   aclocal.m4 configure.ac configure Makefile.in
370
371 # ...plus the entire content of the sub-directories...
372 #
373 SRCDIST_SUBDIRS = src src/pkginfo srcdist-doc icons \
374   scripts/libexec tinyxml xml
375
376 # In addition to the native sources for mingw-get, our source distribution
377 # must include a filtered subset of those additional files which we import
378 # from the project's global build-aux repository...
379 #
380 BUILD_AUX_DIRS = build-aux build-aux/m4
381 BUILD_AUX_FILES = config.guess config.sub install-sh \
382   makeopts.m4 missing.m4
383
384 # The names of distributed package archive files incorporate version
385 # information, derived from PACKAGE_VERSION; this is decomposed, so that
386 # the PACKAGE_SUBSYSTEM may be interposed between the principal version
387 # number and any qualifying suffix, which specifies development status.
388 # Additionally, the package maintainer may specify, (at `make dist' time),
389 # a SNAPSHOT qualifier; if specified, this will be appended, (literally),
390 # to the principal version number component of the package version number,
391 # as it appears in the distributed archive file names.
392 #
393 PACKAGE_DISTROOT = $(PACKAGE_TARNAME)-$(PACKAGE_ROOTVERSION)
394 PACKAGE_ROOTVERSION = `echo $(PACKAGE_VERSION) | sed 's,-[^0-9].*,,'`
395 PACKAGE_DISTVERSION = `echo $(PACKAGE_VERSION)-$(PACKAGE_SUBSYSTEM) | sed \
396   -e 's,-[^0-9],-$(PACKAGE_SUBSYSTEM)&,' \
397   -e 's,\(-$(PACKAGE_SUBSYSTEM).*\)-$(PACKAGE_SUBSYSTEM),\1,' \
398   -e 's,-$(PACKAGE_SUBSYSTEM),$(SNAPSHOT)&,'`
399 PACKAGE_DISTNAME = $(PACKAGE_TARNAME)-$(PACKAGE_DISTVERSION)
400
401 SETUP_DISTNAME = $(PACKAGE_TARNAME)-setup-$(PACKAGE_DISTVERSION)
402
403 dist: srcdist bindist readme.txt.dist
404
405 # Specify where distributable files should be collected; by default,
406 # we will simply use the current build directory.
407 #
408 distdir = @abs_builddir@
409
410 # "Install" distributable text files into the distribution directory.
411 #
412 %.txt.dist: %.txt
413         cmp -s $< ${distdir}/$(<F) 2>/dev/null || $(INSTALL_DATA) $< ${distdir}
414
415 # Specify default compression command, and associated file name extension,
416 # for creation and identification of packaged tar archives.
417 #
418 TARZIP = xz
419 TAREXT = tar.$(TARZIP)
420
421 # The following macros facilitate the inclusion of SCM build tags within
422 # the generated names for the release tarballs; the GCMTAG macro is used
423 # to identify explicitly GUI components, while SCMTAG is used otherwise.
424 #
425 BLDTAG =  @abs_top_builddir@/build.tag
426 SCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(CLI_RELEASE_CLASS)-&,'`
427 GCMTAG = `>> $(BLDTAG); cat $(BLDTAG) | sed 's,.,-$(GUI_RELEASE_CLASS)-&,'`
428
429 bindist: all licdist
430         rm -rf staged
431         $(mkinstalldirs) ${distdir}
432         $(MAKE) --no-print-directory prefix=`pwd`/staged install-strip
433         cd staged; tar chf - bin/pkginfo$(EXEEXT) | $(TARZIP) -c > \
434           ${distdir}/pkginfo-$(PACKAGE_DISTVERSION)$(SCMTAG)-bin.$(TAREXT)
435         rm staged/bin/pkginfo$(EXEEXT)
436         cd staged; tar chf - libexec/mingw-get/guimain$(EXEEXT) | \
437           $(TARZIP) -c > ${distdir}/$(PACKAGE_DISTNAME)$(GCMTAG)-gui.$(TAREXT)
438         rm staged/libexec/mingw-get/guimain$(EXEEXT)
439         cd staged; tar chf - * | $(TARZIP) -c > \
440           ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-bin.$(TAREXT)
441         cd staged; zip -r ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-bin.zip *
442         rm -rf staged
443
444 licdist:
445         rm -rf share
446         $(mkinstalldirs) ${distdir} ./share/doc/${PACKAGE_TARNAME}
447         cd ./share/doc/${PACKAGE_TARNAME}; for file in $(LICENCE_FILES); \
448           do test -f ${abs_top_srcdir}/$$file \
449             && $(LN_S) ${abs_top_srcdir}/$$file . \
450             || $(LN_S) ${CURDIR}/$$file .; \
451           done
452         tar chf - share | $(TARZIP) -c > \
453           ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-lic.$(TAREXT)
454         rm -rf share
455
456 srcdist: srcdist-doc pkginfo.c
457         rm -rf ${PACKAGE_DISTROOT}
458         $(mkinstalldirs) ${distdir} ${PACKAGE_DISTROOT}
459         cd ${PACKAGE_DISTROOT}; for file in $(SRCDIST_FILES); do \
460           test -f ${abs_top_srcdir}/$$file \
461             && $(LN_S) ${abs_top_srcdir}/$$file . \
462             || $(LN_S) ../$$file .; \
463           done
464         for dir in $(SRCDIST_SUBDIRS); do \
465           $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
466           && cd ${PACKAGE_DISTROOT}/$$dir; \
467           for file in `cd ${abs_top_srcdir}/$$dir && echo *`; do \
468             if test -f ${abs_top_srcdir}/$$dir/$$file; then \
469               $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
470             fi; \
471           done; \
472         cd ${CURDIR}; done
473         for dir in $(BUILD_AUX_DIRS); do \
474           $(mkinstalldirs) ${PACKAGE_DISTROOT}/$$dir \
475           && cd ${PACKAGE_DISTROOT}/$$dir; \
476           for file in $(BUILD_AUX_FILES); do \
477             if test -f ${abs_top_srcdir}/$$dir/$$file; then \
478               $(LN_S) ${abs_top_srcdir}/$$dir/$$file .; \
479             fi; \
480           done; \
481         cd ${CURDIR}; done
482         cd ${PACKAGE_DISTROOT}/src/pkginfo; $(LN_S) ${CURDIR}/pkginfo.c .
483         tar chf - ${PACKAGE_DISTROOT} | $(TARZIP) -c > \
484           ${distdir}/$(PACKAGE_DISTNAME)$(SCMTAG)-src.$(TAREXT)
485         rm -rf ${PACKAGE_DISTROOT}
486
487 # README, INSTALL and NEWS files to be included in the source distribution
488 # are generated on demand, as indirect side effects of a set of phoney goals
489 # so that they are always regenerated for each distribution, from templates
490 # in srcdist-doc so that we can make them version specific.
491 #
492 vpath %.in ${srcdir}/srcdist-doc
493 srcdist-doc: README.dist NEWS.dist INSTALL.dist
494
495 # We need to ensure that, when we invoke nroff, the generated output
496 # will be suited to an ASCII class of typesetter; without the -Tascii
497 # option, GNU nroff will substitute Unicode hyphens (u2010) in place
498 # of ASCII hyphens (code 45).
499 #
500 NROFF = nroff -Tascii
501
502 %.dist: %.in gendoc.simple.sed
503         sed -f gendoc.simple.sed $< | $(NROFF) > $*
504
505 %.simple.sed: %.sed.in
506         sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
507             -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", $< > $@
508
509 %.combined.sed: %.sed.in
510         sed -e s,'$${PACKAGE_DIRNAME}',"${PACKAGE_DISTROOT}", \
511             -e s,'$${PACKAGE_DISTNAME}',"${PACKAGE_DISTNAME}", \
512             -e s,'^# *cut:',, $< > $@
513
514 # The following rules use sed and awk to match the RCS Id keyword;
515 # we define and use the following macro, in the form "$(DOLLAR)Id:",
516 # to avoid unwanted substitution on CVS checkout.
517 #
518 DOLLAR = $$
519
520 # The following rule provides a mechanism for generating a composite from
521 # README, INSTALL and NEWS, for use as an on-line package description.
522 #
523 readme.txt: gendoc.combined.sed readme.txt.tag readme.txt.in
524         sed s,'$(DOLLAR)Id:.*',"`cat $@.tag`", $@.in > $@
525         echo '$$Document: $@ $$: end of file' >> $@
526         rm -f gendoc.combined.sed $@.*
527
528 # There should be a new generation of readme.txt for each package release;
529 # since each release should also include an updated NEWS file; we adopt the
530 # ID tag-line from NEWS.in, as most the appropriate template for generation
531 # of a corresponding tag-line for readme.in
532 #
533 readme.txt.tag: NEWS.in
534         awk '/\$(DOLLAR)Id:/{ $$2 = "readme.txt\\,v"; print }' $^ > $@
535
536 # The tag-line generated by the preceding rule may then be substituted, by
537 # the primary readme.txt generation rule above, into the document template
538 # generated by the following rule
539 #
540 readme.txt.in: README.in NEWS.in INSTALL.in
541         rm -f $@
542         for input in $^; do \
543           sed -f gendoc.combined.sed $$input | $(NROFF) >> $@; \
544           done
545
546 # Workspace clean-up...
547 #
548 mostlyclean:
549         rm -f *.$(OBJEXT) *.d *.dll $(BIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
550
551 clean: mostlyclean
552         rm -f version.c verinfo.h
553
554 distclean: clean
555         rm -f config.* build.tag build.time
556
557 maintainer-clean: distclean
558         rm -f README NEWS INSTALL readme.txt Makefile pkginfo.c
559         rm -f *-$(PACKAGE_DISTVERSION)-*.tar.* *-$(PACKAGE_DISTVERSION)-*.zip
560         rm -rf ${PACKAGE_DISTROOT} staged ${srcdir}/autom4te.cache
561
562 # $RCSfile$: end of file