1 ## Process this file with Automake to produce Makefile.in
3 bin_SCRIPTS = bin/stow bin/chkstow
4 info_TEXINFOS = doc/stow.texi
5 dist_man_MANS = doc/stow.8
7 HTML = doc/manual-single.html
10 $(PDF) $(HTML) doc/version.texi \
11 ChangeLog doc/ChangeLog.OLD
15 pmstowdir = $(pmdir)/Stow
16 dist_pmstow_DATA = lib/Stow/Util.pm
18 TEXINFO_TEX = doc/texinfo.tex
19 export TEXI2DVI_BUILD_MODE = clean
20 AM_MAKEINFOFLAGS = -I $(srcdir)
22 # We require this -I parameter to ensure that the include of the
23 # default ignore list in the manual works. Unfortunately this is
24 # the only way to do it:
26 # http://article.gmane.org/gmane.comp.sysutils.automake.bugs/4334/match=passing+parameters
28 # even though it annoyingly produces a warning with the -Wall option
29 # to AM_INIT_AUTOMAKE which has to be silenced via -Wno-override.
30 TEXI2DVI = texi2dvi $(AM_MAKEINFOFLAGS)
32 doc_deps = $(info_TEXINFOS) doc/version.texi
34 DEFAULT_IGNORE_LIST = $(srcdir)/default-ignore-list
36 TESTS_DIR = $(srcdir)/t
37 TESTS_OUT = tmp-testing-trees
38 TESTS_ENVIRONMENT = $(PERL) -Ibin -Ilib -I$(TESTS_DIR)
40 # This is a kind of hack; TESTS needs to be set to ensure that the
41 # `check-am' target makes check-TESTS, but we override check-TESTS
42 # so it doesn't really matter what it's set to, as long as it already
43 # exists (otherwise automake will try to build it).
46 # GNU autotools standardised on the 'check' target, but CPAN (and the
47 # rest of the world) standardised on the 'test' target.
50 # required in vpath mode to ensure $build/t/ exists
51 check_DATA = $(TESTS_OUT)
53 # Test::Harness produces cleaner output than automake's default test
54 # harness, albeit without the pretty colours provided by the
55 # `color-tests' AM_INIT_AUTOMAKE option. This also dodges having to
56 # set TESTS to the full list of tests, which is good because automake
57 # doesn't support wildcards, and so it would be too easy to forget to
58 # add a new one to the list.
60 # Note that automake's `check' rule cannot be overridden
61 # for some weird reason:
63 # http://thread.gmane.org/gmane.comp.sysutils.automake.general/13040/focus=13041
65 # so we override check-TESTS instead which is where the real work is
66 # done anyway. Unfortunately this produces a warning with the -Wall
67 # option to AM_INIT_AUTOMAKE which has to be silenced via
71 $(TESTS_ENVIRONMENT) -MTest::Harness -e 'runtests(@ARGV)' "$${dir#./}"/*.t
76 CPAN_FILES = MANIFEST MANIFEST.SKIP Build.PL META.yml META.json
78 bin/stow.in bin/chkstow.in lib/Stow.pm.in \
80 $(TESTS) t/testutil.pm \
82 $(DEFAULT_IGNORE_LIST) \
84 CLEANFILES = $(bin_SCRIPTS) $(pm_DATA) $(dist_man_MANS) $(HTML) $(PDF) ChangeLog
87 # clean up auto-generated files
91 -rm -rf doc/manual-split
93 # this is more explicit and reliable than the config file trick
94 edit = sed -e 's|[@]PERL[@]|$(PERL)|g' \
95 -e 's|[@]VERSION[@]|$(VERSION)|g'
97 bin/stow: bin/stow.in Makefile
98 [ -d bin ] || mkdir bin # required in vpath mode
102 bin/chkstow: bin/chkstow.in Makefile
103 [ -d bin ] || mkdir bin # required in vpath mode
107 lib/Stow.pm: lib/Stow.pm.in Makefile $(DEFAULT_IGNORE_LIST)
108 [ -d lib ] || mkdir lib # required in vpath mode
109 ( $(edit) < $<; cat $(DEFAULT_IGNORE_LIST) ) > $@
111 ##############################################################################
112 # The below rules should only be needed by developers.
113 ##############################################################################
115 doc/stow.8: bin/stow.in
116 [ -d doc ] || mkdir doc # required in vpath mode
119 # We use automake's built-in rule to generate stow.info. The built-in
120 # rules would also generate doc/stow.html and doc/stow.pdf, but after
121 # installation we want $(docdir) (typically /usr/share/doc/stow/) to
122 # contain manual-single.html, manual.pdf, and manual-split/*.html, to
123 # make it explicitly obvious that these files contain the user manual
124 # rather than some other Stow-related documentation.
126 # If it were not for a troublesome dependency on doc/$(am__dirstamp):
128 # http://article.gmane.org/gmane.comp.sysutils.automake.general/13192
130 # we could have achieved this using the built-in rules combined with
131 # install-data-hook to rename from stow.pdf to manual.pdf etc. on
132 # install. Instead, by overriding the built-in rules with modified
133 # versions, we can kill both birds with one stone.
136 [ -d doc ] || mkdir doc # required in vpath mode
138 texi2html --P=$(srcdir) --output=$@ -expandinfo -menu -monolithic -verbose $<
141 TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
142 MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
143 $(TEXI2PDF) -o $@ `test -f 'doc/stow.texi' || echo '$(srcdir)/'`doc/stow.texi
145 doc/manual-split: $(doc_deps)
147 if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
148 -o $@.new `test -f 'doc/stow.texi' || echo '$(srcdir)/'`doc/stow.texi; \
157 # The split version of the manual is copied to $(docdir)/manual-split
158 # by install-data-hook. The whole subdirectory is included via
159 # EXTRA_DIST in order to avoid having to list each file explicitly in
160 # dist_doc_DATA, since automake doesn't support wildcards, and
161 # dist_doc_DATA cannot refer to directories while EXTRA_DIST can (go
164 install-data-hook: doc/manual-split
165 cp -r $(srcdir)/doc/manual-split $(DESTDIR)$(docdir)
168 chmod u+w -R $(DESTDIR)$(docdir)/manual-split
169 rm -rf $(DESTDIR)$(docdir)/manual-split
171 # Using install-data-hook has the slightly annoying disadvantage that
172 # by default the split version of the manual isn't automatically
173 # rebuilt during development by a simple `make'. A workaround hack
174 # for this is to piggy-back the dependency onto manual-single.html,
175 # which *is* automatically rebuilt by `make':
176 $(HTML): doc/manual-split
178 # With the above hack, this probably isn't necessary but is safer to
180 dist-hook: doc/manual-split
182 dist-hook: $(dist_man_MANS) ChangeLog
184 ChangeLog: doc/ChangeLog.OLD
185 @if [ -d .git ]; then \
188 --format="format:%ad %aN <%aE>%n%n * %w(70,0,4)%s%+b%n" \
191 | sed 's/^\([A-Z]\)\t/ \1 /'; \
194 echo "Rebuilt $@ from git commit history."; \
196 echo "Not in a git repository; can't update ChangeLog."; \