Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automake and project dependencies

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.

For example:

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)

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:

  • One of the modules fails to build
  • One of the modules fails a unit test

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?

like image 657
Homunculus Reticulli Avatar asked Nov 21 '11 17:11

Homunculus Reticulli


1 Answers

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

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.

EDIT:

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.

like image 78
Brett Hale Avatar answered Oct 01 '22 05:10

Brett Hale