当前位置: 动力学知识库 > 问答 > 编程问答 >

recursion - Is there a way to avoid recursive make with nobase?

问题描述:

I've got the following directory structure:

Makefile.am

src/

mymod/

mod.cc

submod/

submod.cc

inc/

Makefile.am

mymod/

mod.hh

submod/

submod.hh

Using autotools, I'd like to distribute both a library made from src and the headers in inc. The top level Makefile.am looks something like

lib_LTLIBRARIES = mylib.la

mylib_la_SOURCES=./mymod/mod.cc\

./mymod/submod/submod.cc

SUBDIRS=inc

Then inc/Makefile.am has

mymod_includedir=$(includedir)

nobase_mymod_include_HEADERS=mymod/mod.hh\

mymod/submod/submod.hh

This works OK. I end up with whatever library stuff, and my headers get installed appropriately. However, I'd like to eliminate the recursion involved in the Makefile. The problem is that if I move the lines in inc/Makefile.am to the root directory, then I have to update the paths as follows:

mymod_includedir=$(includedir)

nobase_mymod_include_HEADERS=inc/mymod/mod.hh\

inc/mymod/submod/submod.hh

This results in my headers getting dumped as $PREFIX/include/inc/mymod/mod.hh and not $PREFIX/include/mymod/mod.hh like I want. I know I

could do something like

mymodincludedir=$(includedir)/mymod

mymod_HEADERS=inc/mymod/mod.hh

mysubmodincludedir=$(includedir)/mymod/submod

mysubmod_HEADERS=inc/mymod/submod/submod.hh

but that's pretty painful, because there's a lot of subdirectories, and more subdirectories within the subdirectories (we're distributing a 3rd party's code that our own headers need). What I'd like to be able to do is either tell automake to just copy the directories in /inc to $(includepath) along with every subdirectory it encounters within, or tell it to only strip part of the path from the header files I'm listing. Is this possible?

网友答案:

I think the closest you can find is Karel Zak's Makemodule.am approach for which nobase_ would work as you need.

分享给朋友:
您可能感兴趣的文章:
随机阅读: