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 lib/Stow/Util.pm.in \
80 $(TESTS) t/testutil.pm \
82 $(DEFAULT_IGNORE_LIST) \
84 CLEANFILES = $(bin_SCRIPTS) $(pm_DATA)
85 MAINTAINERCLEANFILES = $(dist_man_MANS) $(HTML) $(PDF) ChangeLog
87 # clean up auto-generated files
90 maintainer-clean-local:
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' \
96 -e "s|[@]USE_LIB_PMDIR[@]|$$use_lib_pmdir|g"
99 PERL5LIB= $(PERL) -V | \
100 awk '/@INC/ {p=1; next} p==1 {print $$1}' | \
103 calc_use_lib_pmdir = \
104 if $(pmdir_in_INC); then \
107 use_lib_pmdir="use lib \"$(pmdir)\";"; \
112 echo "\# Perl modules will be installed to $(pmdir)"; \
114 if $(pmdir_in_INC); then \
115 echo "\# This is in $(PERL)'s built-in @INC, so everything"; \
116 echo "\# should work fine with no extra effort."; \
118 echo "\# This is not in $(PERL)'s built-in @INC, so the"; \
119 echo "\# front-end scripts will have an appropriate \"use lib\""; \
120 echo "\# line inserted to compensate."; \
124 bin/stow: bin/stow.in Makefile.am
125 [ -d bin ] || mkdir bin # required in vpath mode
127 @$(calc_use_lib_pmdir); \
129 @echo "Generated $@ from $<"
132 bin/chkstow: bin/chkstow.in Makefile.am
133 @[ -d bin ] || mkdir bin # required in vpath mode
135 @echo "Generated $@ from $<"
138 lib/Stow.pm: lib/Stow.pm.in $(DEFAULT_IGNORE_LIST) Makefile.am
139 @[ -d lib ] || mkdir lib # required in vpath mode
140 @( $(edit) < $<; cat $(DEFAULT_IGNORE_LIST) ) > $@
141 @echo "Generated $@ from $< and $(DEFAULT_IGNORE_LIST)"
143 lib/Stow/Util.pm: lib/Stow/Util.pm.in Makefile.am
144 @[ -d lib/Stow ] || mkdir -p lib/Stow # required in vpath mode
146 @echo "Generated $@ from $<"
148 ##############################################################################
149 # The below rules should only be needed by developers.
150 ##############################################################################
152 doc/stow.8: bin/stow.in Makefile.am
153 [ -d doc ] || mkdir doc # required in vpath mode
154 $(edit) < $< | pod2man > $@
156 # We use automake's built-in rule to generate stow.info. The built-in
157 # rules would also generate doc/stow.html and doc/stow.pdf, but after
158 # installation we want $(docdir) (typically /usr/share/doc/stow/) to
159 # contain manual-single.html, manual.pdf, and manual-split/*.html, to
160 # make it explicitly obvious that these files contain the user manual
161 # rather than some other Stow-related documentation.
163 # If it were not for a troublesome dependency on doc/$(am__dirstamp):
165 # http://article.gmane.org/gmane.comp.sysutils.automake.general/13192
167 # we could have achieved this using the built-in rules combined with
168 # install-data-hook to rename from stow.pdf to manual.pdf etc. on
169 # install. Instead, by overriding the built-in rules with modified
170 # versions, we can kill both birds with one stone.
173 [ -d doc ] || mkdir doc # required in vpath mode
175 texi2html --P=$(srcdir) --output=$@ -expandinfo -menu -monolithic -verbose $<
178 TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
179 MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \
180 $(TEXI2PDF) -o $@ `test -f 'doc/stow.texi' || echo '$(srcdir)/'`doc/stow.texi
182 doc/manual-split: $(doc_deps)
184 if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \
185 -o $@.new `test -f 'doc/stow.texi' || echo '$(srcdir)/'`doc/stow.texi; \
194 # The split version of the manual is copied to $(docdir)/manual-split
195 # by install-data-hook. The whole subdirectory is included via
196 # EXTRA_DIST in order to avoid having to list each file explicitly in
197 # dist_doc_DATA, since automake doesn't support wildcards, and
198 # dist_doc_DATA cannot refer to directories while EXTRA_DIST can (go
201 install-data-hook: doc/manual-split
202 cp -r $(srcdir)/doc/manual-split $(DESTDIR)$(docdir)
205 chmod u+w -R $(DESTDIR)$(docdir)/manual-split
206 rm -rf $(DESTDIR)$(docdir)/manual-split
208 # Using install-data-hook has the slightly annoying disadvantage that
209 # by default the split version of the manual isn't automatically
210 # rebuilt during development by a simple `make'. A workaround hack
211 # for this is to piggy-back the dependency onto manual-single.html,
212 # which *is* automatically rebuilt by `make':
213 $(HTML): doc/manual-split
215 # With the above hack, this probably isn't necessary but is safer to
217 dist-hook: doc/manual-split
219 dist-hook: $(dist_man_MANS)
220 ## If we are creating a distribution from a git checkout, ensure
221 ## the ChangeLog file is in sync the git repository.
222 if test -d $(top_srcdir)/.git; then \
224 && $(MAKE) $(AM_MAKEFLAGS) ChangeLog \
225 && cp -f ChangeLog $(distdir)/ChangeLog; \
228 ChangeLog: doc/ChangeLog.OLD
229 @if [ -d .git ]; then \
232 --format="format:%ad %aN <%aE>%n%n * %w(70,0,4)%s%+b%n" \
235 | sed 's/^\([A-Z]\)\t/ \1 /'; \
238 echo "Rebuilt $@ from git commit history."; \
240 echo "Not in a git repository; can't update ChangeLog."; \