automake和项目依赖 [英] automake and project dependencies

查看:214
本文介绍了automake和项目依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我想用automake建设项目。该项目由不同的组件或模块,并且有哪些要求项目要建在一个特定的顺序间模块依赖关系。

I have a project that I want to build using automake. The project consists of different components or modules, and there are inter module dependencies which require the project to be built in a specific order.

例如:

project dir/
  module1 (core C shared lib)
  module2 (C++ shared lib wrapper around module 1)
  module3 (C++ application with dependency on module2)
  module4 (C library with dependency on module1)
  module5 (C application with dependency on module4)

我是比较新的automake的,但我(只是)知道如何使用它成功地构建一个项目。

I am relatively new to automake, but I (just about) know how to use it to successfully build a single project.

我想有一个主项目文件(如果可能的话),指定项目模块的构建顺序,运行单元测试,如果失败,要么在整个构建过程:

I would like to have a 'master' project file (if that's possible), which specifies the build order of the projects modules, runs unit tests and fails the entire build process if either:


  • 一个模块的编译失败

  • 一个模块失败单元测试

我将如何去写这样的主项目文件(或调用任何其他机制)来构建有很多相互依存的模块化项目?

How would I go about writing such a 'master project' file (or invoking any other mechanism) to build projects that have a lot of inter-modular dependencies?

推荐答案

如果你使用自动工具,那么你还不如用automake的。顶层 Makefile.am 可以提供按顺序下降子目录的列表,例如:

If you're using autotools, then you might as well use automake. The top level Makefile.am can provide a list of subdirectories that are descended in order, e.g:

SUBDIRS = module1 module2 module3 module4 module5

子目录 Makefile.am 可以添加对测试的目标,以做检查调用,如果需要的话,这将迫使编译:

The subdirectory Makefile.am can add targets for tests, invoked with 'make check', which will force the build if necessary:

check_PROGRAMS = t_module1

t_module1_SOURCES = t_module1.c
t_module1_LDADD = ./libmodule1.la

有一个很多的学习,最好的目前的做法可能是难以确定的,但如果你使用自动工具,你会习惯了这种局面。

There's a lot to learn, and best current practice can be difficult to determine, but if you're using autotools, you'll be used to this situation.

修改

信息的automake 提供的参考文档 - 但它使一个贫穷的教程。一个我遇到的最好的导游可以发现这里

info automake provides the reference documentation - but it makes a poor tutorial. One of the best guides I've come across can be found here.

这篇关于automake和项目依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆