Stefano Lattarini wrote: > On 08/31/2012 09:59 PM, Jim Meyering wrote: >> Jim Meyering wrote: >>> Jim Meyering wrote: >>> ... >>>> No problem. >>>> Next step, "make distcheck". First failure is because inclusion of >>>> version.h fails in the non-srcdir build: >>> ... >>>> This fixes it: >>>> >>>> diff --git a/src/local.mk b/src/local.mk >>> >>> FYI, here's another make distcheck problem, >>> in case someone else can get to it before I do >>> (it'll soon be dinner time here): >>> >>> make[2]: Entering directory >>> `/h/j/w/co/cu/coreutils-8.19.68-ea804-dirty/_build' >>> CC src/uname-arch.o >>> CC src/hostname.o >>> CCLD src/arch >>> CCLD src/hostname >>> GEN man/arch.1 >>> GEN man/hostname.1 >>> mkdir: cannot create directory 'man/arch.td': No such file or directory >>> make[2]: *** [man/arch.1] Error 1 >>> make[2]: *** Waiting for unfinished jobs.... >>> mkdir: cannot create directory 'man/hostname.td': No such file or >>> directory >>> make[2]: *** [man/hostname.1] Error 1 >>> make[2]: Leaving directory >>> `/h/j/w/co/cu/coreutils-8.19.68-ea804-dirty/_build' >>> make[1]: *** [dist] Error 2 >>> make[1]: Leaving directory >>> `/h/j/w/co/cu/coreutils-8.19.68-ea804-dirty/_build' >>> make: *** [distcheck] Error 1 >> >> The fix for this is to create man and src directories: >> >> diff --git a/configure.ac b/configure.ac >> index 8c41d62..5dc4b0a 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -464,6 +464,11 @@ AM_GNU_GETTEXT_VERSION([0.18.1]) >> # For a test of uniq: it uses the $LOCALE_FR envvar. >> gt_LOCALE_FR >> >> +# Now that configure no longer creates src/ or man/, create them here. >> +# Doing it this way is more maintainable that adding to each individual >> +# Makefile rule that creates a file in one of those sub-directories. >> +$MKDIR_P man src >> + > To be extra-purist, shouldn't this be handled with dirstamp rules in the > Makefile? Or maybe, such a purist move could be done at least in the > Automake-NG based fork of coreutils, where we can use GNU make order-only > prerequisites, which will DTRT in this context.
I agree that this is debatable. While converting cppi, my first attempt at addressing this was to create e.g., src/ via rules in src/local.mk. While that seemed like it'd be borderline ok in a project with a single binary, I found that also having to deal with generated headers made it too invasive. In a way, putting the list of directories to create in configure.ac seems appropriate to me, since with cppi, I had just removed src/Makefile and lib/Makefile from the AC_CONFIG_FILES list in that same file. I think you're right that with automake-NG we'll be able to move each mkdir commands back into its corresponding */local.mk file. However, if you have something that looks good for automake, please post a patch.
