Jay,I noticed in the documentation of the "include" directive that included fragments may use %reldir%, which is replaced by the directory of the fragment (https://www.gnu.org/software/automake/manual/automake.html#Include)
For example, I think you could write auto1/prog/automake.inc like this: bin_PROGRAMS += todo todo_SOURCES = %reldir%/main.cc todo_CXXFLAGS=-I$(srcdir)/lib todo_LDADD = libtodo.aNotice that you may also need to adjust how you write your include directives in Makefile.am like this:
include $(srcdir)/lib/automake.inc include $(srcdir)/prog/automake.inc Does this work for you? On 06/06/2016 02:31 AM, Jay K wrote:
Ok, I found the subtlety in the documentation that automake in effect uses autoconf's directory or output list. So if I give up non-recursive make, and if I list directories twice, then it works nicely: i.e. non-recursive make, less modular automake: http://github.com/jaykrell/j/tree/master/auto1 recursive make, more modular automake, have to list directories twice; once is almost enough, but you need to tell automake the directories for the recursion to occur -- could almost hand-write the top level Makefile instead: http://github.com/jaykrell/j/tree/master/auto2 Ideal would be to say dirs=prog lib, instead of output prog/makefile lib/makefile, and ideally would get faster non-recursive make. That is, auto1 has ideal performance, non-ideal, less-modular authoring. auto2 has non-ideal performance and close to ideal authoring. Advise? Thank you, - Jay ----------------------------------------From: jay.kr...@cornell.edu To: automake@gnu.org Subject: recursive automake w/o recursive autoconf? Date: Mon, 6 Jun 2016 07:55:11 +0000 I have a system with a bunch of libraries and programs. I want one little autoconf at the top: E.g. how to compile C. I would prefer to compose via SUBDIRS= instead of include, as it feels higher level, but not a big deal. I would prefer non recursive make for performance and parallelism, but this isn't currently crucial. I do not want each Makefile.am to list a full path from the root, but instead just a leaf path. That is, I want the Makefile.am's to look like they do when you use recursive (nested) autoconf) and recursive automake. The only way I've found to avoid the nested autoconf though, includes a nonrecursive automake, where the included automake snippets have to use paths from the root, and where $(srcdir) is always the root. i.e. here: https://github.com/jaykrell/j/blob/master/auto1/prog/automake.inc bin_PROGRAMS += todo todo_SOURCES = prog/main.cc todo_CXXFLAGS=-I$(srcdir)/lib todo_LDADD = libtodo.a I would rather say: bin_PROGRAMS += todo todo_SOURCES = main.cc todo_CXXFLAGS=-I$(srcdir)/../lib todo_LDADD = ../lib/libtodo.a Ideally the list of directories is one place. Advise? Thank you, - Jay
smime.p7s
Description: S/MIME Cryptographic Signature