GraemeV
GraemeV

Reputation: 163

Installing generated man pages using autotools

I have some man pages , written in markdown. (see the rule below to convert .md to .1 or .5))

I want to distribute the .md file in the distribution tarball and install the .1 and .5 flavours in /usr/local/man/...

Using this in Makefile.am:

dist_man1_MANS = einksysstat.md
dist_man5_MANS = einksysstat.config.md

man1_MANS = einksysstat.1
man5_MANS = einksysstat.config.5

CLEANFILES = $(man1_MANS) $(man5_MANS)


einksysstat.1: einksysstat.md
    pandoc -f markdown -t plain --wrap=none $< -o $@

einksysstat.config.5: einksysstat.config.md
    pandoc -f markdown -t plain --wrap=none $< -o $@

$ make distcheck --- works fine

However "install-man" insalls the wrong file

$ make install-man
 /usr/bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 'einksysstat.md' '/usr/local/share/man/man1/einksysstat.1'

The tarball contains einksysstat.md and einksysstat.config.md (and NOT the .1 & .5 flavours) I want to have the .md in the tarball (ie this)


If I change this to match the example in: Optional manuals? Or pre-compiled in distribution? (not what I want , as it distributes the .1 and .5 flavours of the files)

To:

dist_man5_MANS = einksysstat.config.5

CLEANFILES = $(dist_man1_MANS) $(dist_man5_MANS)

It now installs the correct files (using source tree)

$ make install-man
 /usr/bin/mkdir -p '/usr/local/share/man/man5'
 /usr/bin/install -c -m 644 einksysstat.config.5 '/usr/local/share/man/man5'

But make distcheck fails:

make[3]: *** No rule to make target 'einksysstat.config.md', needed by 'einksysstat.config.5'.  Stop.
make[3]: Leaving directory '/home/graeme/src/eink_sysstat/clean_repo/eink_sysstat/gpv-eink-1.0-2-g0dde6ca-dirty/_build/sub'
make[2]: *** [Makefile:591: all-recursive] Error 1
make[2]: Leaving directory '/home/graeme/src/eink_sysstat/clean_repo/eink_sysstat/gpv-eink-1.0-2-g0dde6ca-dirty/_build/sub'
make[1]: *** [Makefile:398: all] Error 2
make[1]: Leaving directory '/home/graeme/src/eink_sysstat/clean_repo/eink_sysstat/gpv-eink-1.0-2-g0dde6ca-dirty/_build/sub'
make: *** [Makefile:808: distcheck] Error 1

And the tarball contains the .1 and .5 versions, but NOT the .md flavours. (which is why the above make errors)


Upvotes: 1

Views: 42

Answers (1)

Mike Kinghan
Mike Kinghan

Reputation: 61575

Your *.md files are not actually man pages so don't include them in them in any of the *_MANS file lists. Instead include them in the EXTRA_DIST file list in the relevant Makefile.am or the toplevel Makefile.am of the project. In the latter case of course list them with the full paths relative to that toplevel Makefile.am. E.g.

EXTRA_DIST = [rel/path/to/]einksysstat.md [rel/path/to/]einksysstat.config.md

Automake manual: 14.1 Basics of Distribution:

... Despite all this automatic inclusion, it is still common to have files to be distributed which are not found by the automatic rules. You should listed these files in the EXTRA_DIST variable. You can mention files in subdirectories in EXTRA_DIST.

You don't want your *.md files handled by the automatic *_MANS rules.

Upvotes: 2

Related Questions