11

How can I install a directory tree of HTML files, stylesheets and images with automake without having to create Makefiles in each subdirectory?

Using the following in the toplevel directory

htmldir = $(docdir)/foo/html
html_DATA = \
        stylesheets/foo.css \
        images/foo.jpg \
        index.html \
        about/index.html \
        faq/index.html
EXTRA_DIST = $(html_DATA)

fails because the subdirectories are not created before install is called.

gbr
  • 111
  • 1
  • 3

1 Answers1

12

You could write

foohtmldir = $(htmldir)/foo/html
nobase_dist_foohtml_DATA = \
    stylesheets/foo.css \
    images/foo.jpg \
    index.html \
    about/index.html \
    faq/index.html

htmldir is a variable the user is entitled to modify using configure --htmldir=... so I suggest using another one if you want to write to some subdirectory of it. The nobase_ prefix will tell Automake not to strip leading directories during installation, and the dist_ prefix requires the files to be distributed.

adl
  • 15,627
  • 6
  • 51
  • 65