11

I have some header files in a sub directory, that must be copied to a same-named sub directory in my include directory. I can use the nobase prefix to make that happen (I'm working with heimdal code, fyi):

nobase_include_HEADERS = hcrypto/aes.h \
      hcrypto/bn.h      \
      hcrypto/cmac.h    \
      hcrypto/des.h     \
      hcrypto/dh.h      \
      hcrypto/dsa.h     \
etc...

But some of those header files are generated during the build process (since heimdal must be built before those header files exist), so I need to use the nodist prefix so that the dist doesn't die.

I found an article that said I could use them both together, and even provided a similar example, so I did this:

nobase_nodist_include_HEADERS = hcrypto/aes.h \
      hcrypto/bn.h      \
      hcrypto/cmac.h    \
      hcrypto/des.h     \
      hcrypto/dh.h      \
      hcrypto/dsa.h     \
etc...

I didn't notice any warnings or errors, but those header files DO NOT get copied to my include directory. Am I doing something wrong, or is there a bug in autotools?

Interesting, if I reverse the prefixes, I get this error:

Makefile.am:93: error: 'nodist_nobase_include_HEADERS' is used but 'nobase_includedir' is undefined

The reason for that error is explained here in the automake documentation:

‘nobase_’ should be specified first when used in conjunction with either ‘dist_’ or ‘nodist_’

I've also defined nodist_include_HEADERS (which is working). Maybe the two definitions are causing some kind of conflict?

I just tried removing the nodist_include_HEADERS and putting all my headers under the nobase_nodist_include_HEADERS line, but now NONE of my headers get installed.

Automake and system info: automake (GNU automake) 1.13.4 openSUSE 13.2 (x86_64)

David Mulder
  • 7,595
  • 11
  • 45
  • 61
  • please add any additional information to the question itself, rather than abusing some comments. – umläute May 02 '16 at 07:27
  • Please, make a mimimal complete working example http://stackoverflow.com/help/mcve (A small collection of Makefile.am in your case) – Stian Skjelstad May 05 '16 at 18:00

1 Answers1

5

If the headers were generated by a program, you should mark them with BUILT_SOURCES, this way automake will not be confused to try to install them as dist.

Second, for headers files that are not meant to be installed, it's better to use SOURCES directive, rather than HEADERS. Try this:

nobase_include_SOURCES += hcrypto/aes.h \
    hcrypto/bn.h      \
    hcrypto/cmac.h    \
    hcrypto/des.h     \
    hcrypto/dh.h      \
    hcrypto/dsa.h
BUILT_SOURCES = hcrypto/aes.h \
    hcrypto/bn.h      \
    hcrypto/cmac.h    \
    hcrypto/des.h     \
    hcrypto/dh.h      \
    hcrypto/dsa.h
fluter
  • 13,238
  • 8
  • 62
  • 100
  • Question: BUILT_SOURCES seems can still be installed and distributed by default. If you are dealing with a source that is simply packaged and distributed in another format, such as a generated python script xx.py that is simple packaged independently with setup.py utility. I want to avoid the distribution and installation of xx.py, how to you add nodist_ Here we have no include_SOURCES. – Kemin Zhou Jun 18 '22 at 19:50