Arnold Daniels
Arnold Daniels

Reputation: 16573

Use autotools with README.md

I'm using autotools for a libraries hosted on GitHub. Instead of using an ordinary README text file, I want to use README.md.

When running automake, I get the following error

Makefile.am: required file `./README' not found

Is it possible to tell autotools not to check for README?

Upvotes: 27

Views: 4638

Answers (5)

Oskar Berggren
Oskar Berggren

Reputation: 5629

automake 1.16.4 (from 2021) is now supposed to natively allow .md extension for a bunch of files, including getting make dist correct for those files.

Upvotes: 0

Marc Wäckerlin
Marc Wäckerlin

Reputation: 740

The simples solution, based pn fceller's answer: The only thing that is needed, is a build rule for README in makefile.am. This rule can even be empty. So just add the following line to your makefile.am:

README: README.md

That's all, now automake does not complain anymore, and you don't need to declare your project as foreign.

It is not needed, but I prefer a more complete rule, I add to makefile.am:

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

CLEANFILES = README

But even with this rule, README is not built unless you explicitly call make README.

Upvotes: 7

fceller
fceller

Reputation: 2764

We are using

README: README.md
        fgrep -v "[Build Status]" $< \
                | markdown \
                | html2text -style pretty -nobs \
                | sed -e 's:&gt;:>:g' \
                > [email protected]

to generate a text README from the markdown README.md

Upvotes: 7

William Pursell
William Pursell

Reputation: 212268

Just pass the foreign option to automake. This tells it that your software does not conform to the typical gnu standards, and thus omitting README is not an error. Typically, this is done in configure.ac:

AM_INIT_AUTOMAKE([foreign])

but it can also be done by assigning AUTOMAKE_OPTIONS in Makefile.am:

AUTOMAKE_OPTIONS = foreign

Upvotes: 30

deau
deau

Reputation: 1223

Why ask it not to look for your README file when you already have one? It just happens to be in markdown format and saved as README.md. If you want your README file to be identical to your README.md file, why not link to it?

From the command line:

ln -s README.md README

That way, you get to keep your README.md file and any tools you use will still be able to work with the standard naming conventions. Parenthetically speaking, it is very likely that autotools allows you to specify a custom path for your readme.

Upvotes: 5

Related Questions