>>> "Bruce" == Bruce Korb <[EMAIL PROTECTED]> writes:

[...]

 Bruce> That proposal being:

 Bruce> if BAR
 Bruce> MAYBE_BAR = bar
 Bruce> fi
 Bruce> SUBDIRS = foo $(MAYBE_BAR)

 Bruce> The issues are:

 Bruce> 1.  How do you distribute "bar" when BAR is not defined?

Type `make dist' and this will happen automatically :)

Automake will define `DIST_SUBDIRS = foo bar' for you
automatically because he *knows* that `MAYBE_BAR' *can* contain
`bar'.

`make dist' will recurse into `$(DIST_SUBDIRS)' whatever the
value of `$(SUBDIRS)' is, so it will distribute these files even
if the directory was left out of `$(SUBDIRS)' (i.e., out of the
build).

Try it!

 Bruce> "bar" must be listed in either DIST_SUBDIRS or SUBDIRS,
 Bruce> always one of them, but not both. 

No.  See above.  DIST_SUBDIRS should contain any directory that
can appear in SUBDIRS.

(Maybe we could add a sanity check in Automake to ensure that
the values of $(SUBDIRS) are contained in those of
$(DIST_SUBDIRS).)

 Bruce> 2.  bar/Makefile.in must get generated by automake.

Yep.

  AC_CONFIG_FILES([bar/Makefile])

This will cause ./configure to create bar/Makefile unconditionally.
This is what we want: since `make dist' must recurse into `bar/' we
should have a Makefile there.

 Bruce> Can you tell it to do that without listing it in
 Bruce> the AC_CONFIGURE()?

There is no reason to do this here.

 Bruce> 3.  If you list it there, then it will put stuff in the build
 Bruce> directory that will conflict with stuff in the source dir.
 Bruce> *THAT* will cause conflicts come "make distcheck" time.

AFAICT that only causes conflicts when you EXTRA_DIST the
directory.  You don't need to EXTRA_DIST it.



All you need is, in some place read by Autoconf (your macro?):

  AM_CONDITIONAL([BAR], ...)
  AC_CONFIG_FILES([bar/Makefile])

In the top-level Makefile.am

  if BAR
    MAYBE_BAR = bar
  fi
  SUBDIRS = foo $(MAYBE_BAR)

No evil EXTRA_DIST, no redefinition of DIST_SUBDIRS (since
Automake gets it right in this case), no related AC_SUBST.
-- 
Alexandre Duret-Lutz



Reply via email to