我正在使用autotool
构建项目。基本上,该项目依赖于几个由autotool
管理的第三方项目。
my_project/
my_project/3rd-party/
为了启用递归构建,我在configure.ac中添加了AC_CONFIG_SUBDIRS
个宏:
AC_CONFIG_SUBDIRS([3rd-party/gtest-1.7.0])
AC_CONFIG_SUBDIRS([3rd-party/libstatgrab-0.91])
AC_CONFIG_SUBDIRS([3rd-party/leveldb-1.2.0])
这为我提供了递归构建,链接和清理的便利。但是,当我点击make install
时,我不想安装所有这些第三方库,而是安装我自己的项目。反正我有没有摆脱这种特殊的递归?
答案 0 :(得分:4)
如果您没有更改第3个pardy目录中的任何makefile(我甚至可以从主Makefile中执行,只需通过sed
重命名目标,我认为您不能简单地删除此单个文件。 [脏黑客])。
我猜你在第三方目录中调用内部配置,不是吗?如果是,您可以设置prefix
(或data-prefix
和exec-prefix) different. It may be a good idea in any case to create a
第三方构建目录,并在那里构建第三方内容并更改安装前缀以使用此目录。< / p>
您没有要求它,但“解决方案”不同:从主makefile中删除第三方内容:
build_dep.sh
这既解决了问题又允许使用库/工具(如果它们已经存在),并允许用户选择使用不同的版本,同时保持简单“你可以从主目录中获取所有这些并且不需要在你自己的“
上获得/构建依赖项答案 1 :(得分:0)
这并不是我所希望的,因为您还必须引入要在这些子树中使用的所有递归规则,但是它更接近了。
https://github.com/protocolbuffers/protobuf/blob/master/Makefile.am#L14
DIST_SUBDIRS = src conformance benchmarks third_party/googletest
# Build gmock before we build protobuf tests. We don't add gmock to SUBDIRS
# because then "make check" would also build and run all of gmock's own tests,
# which takes a lot of time and is generally not useful to us. Also, we don't
# want "make install" to recurse into gmock since we don't want to overwrite
# the installed version of gmock if there is one.
check-local:
@echo "Making lib/libgmock.a lib/libgmock_main.a in gmock"
@cd third_party/googletest/googletest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
@cd third_party/googletest/googlemock && $(MAKE) $(AM_MAKEFLAGS) lib/libgmock.la lib/libgmock_main.la
# We would like to clean gmock when "make clean" is invoked. But we have to
# be careful because clean-local is also invoked during "make distclean", but
# "make distclean" already recurses into gmock because it's listed among the
# DIST_SUBDIRS. distclean will delete gmock/Makefile, so if we then try to
# cd to the directory again and "make clean" it will fail. So, check that the
# Makefile exists before recursing.
clean-local:
@if test -e third_party/googletest/Makefile; then \
echo "Making clean in googletest"; \
cd third_party/googletest && $(MAKE) $(AM_MAKEFLAGS) clean; \
fi; \