0

Our test data is organized with two folders. We have TestData/ and TestVectors/, depending on the form of the data:

- TestData
  |
  + a.dat
  + b.dat
  + ...

- TestVector
  |
  + x.vec
  + y.vec
  + ...

Our Makefile.am has:

dist_pkgdata_DATA = \
   $(testdata_FILES) \
   $(testvector_FILES)

testdata_FILES = \
   TestData/a.dat TestData/b.dat \
   ...

testvector_FILES = \
   TestVectors/x.vec TestVectors/y.vec \
   ...

Automake installs them in @datadir@/@PACKAGE@/, but we lose the TestData and TestVectors prefix upon installation. That is, once installed, all the files are lumped together:

- @datadir@/@PACKAGE@/
  |
  + a.dat
  + b.dat
  + ...
  + x.vec
  + y.vec
  + ...

There's a very similar question at Install arbitrary data files in arbitrary locations with Automake?, but I am not quite following what needs to be done to ensure make install works as expected.

My question is, how do we preserve the prefix of TestData or TestVectors during install?

jww
  • 97,681
  • 90
  • 411
  • 885

2 Answers2

3

This is what the nobase prefix was invented for. The name stands for "don't call basename" and would be used like:

nobase_dist_pkgdata_DATA = \
    $(testdata_FILES) \
    $(testvector_FILES)

This should result in the listed files keeping their directory names in the install tree.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63
1

My question is, how do we preserve the prefix of TestData or TestVectors during install?

Ordinarily, Automake computes the basename of each target and uses that at install time to record the file directly in the designated directory. If the target names contain directory prefixes that you want to propagate into the installed image then you can tell Automake about it by using the nobase_ prefix on the relevant target variable. This can be combined with other prefixes such as dist_. For example,

nobase_dist_pkgdata_DATA = \
   $(testdata_FILES) \
   $(testvector_FILES)

Prefixes in general are described in section 3.3 of the Automake manual, and nobase_ in particular is detailed in section 12.1 of the Automake manual.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
  • Ah, thanks. I used [3.3 The Uniform Naming Scheme](https://www.gnu.org/software/automake/manual/html_node/Uniform.html) and followed it to [8.4 Program and Library Variables](https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html#Program-and-Library-Variables). Unfortunately some things like `nobase_` are not documented in 8.4 even though 3.3 tells us to go there. Ugh... – jww Nov 14 '17 at 21:47
  • Thanks again @John. That fixed it for me. – jww Nov 14 '17 at 21:56