On 2015-06-21 23:14, Hans-Bernhard Bröker wrote: > It's actually even a little worse: > > Any dependency on sources in another directory causes a simple "make clean" > in one directory to erase _all_ object files on that other one, i.e. if > docs/Makefile.am has > > noinst_PROGRAMS = a > > a_SOURCES = sub/a.c ../src/main.c > a_CPPFLAGS = -DFOO=BAR $(AM_CPPFLAGS) > > then "make -C docs clean" does the following: > > make: Entering directory '/cygdrive/c/prg/gp/am_bug/amhello-1.0/docs' > test -z "a.exe" || rm -f a.exe > rm -f *.o > rm -f ../src/*.o > rm -f sub/*.o > make: Leaving directory '/cygdrive/c/prg/gp/am_bug/amhello-1.0/docs' > > But what logic would a "clean" in one sub project erase all the work done in > another? > > With consequences like that, I think the (all but forced, now) option > "subdir-objects" needs to be reconsidered.
I think that in Automake it is implicit that a makefile controls the directory of the makefile itself and possibly subdirectories of that directory. Sibling directories of this main directory are supposed to be controlled by a makefile in that sibling directory (or by a makefile in a parent directory). Notice how the option is named *subdir*-objects (and not *sibling*-objects or something such) and ../foo is hardly a subdir. You are perhaps better off converting the project to use a single top level makefile instead of using a recursive build. Cheers, Peter