2
votes

I've following structure of my project:

|
|---libs
|    |---lib1
|    |---lib2
|
|---lib3

And dependencies:

  • lib1 depends on lib3
  • lib3 depends on lib2

So automake should build libraries in the following order: lib2, lib3, lib1 My question is(I know that this library should be redesigned first, but assume, it can't be): is it possible to defined dependencies in Makefile.am, to build this project properly?

1

1 Answers

0
votes

If you're sticking with a recursive directory structure, you can control the order of descent with the SUBDIRS variable. This is fine for things like separate library and test directories; the "Recursive Make Considered Harmful" catch-all overstates the case. In this case, though, it's sound advice. You obviously realise this - so can it be done?

Top level Makefile.am use:

SUBDIRS = libs/lib2 lib3 libs/lib1

This 'works' - but it means no libs/Makefile.am. So if you were linking them all together as a convenience (noinst_LTLIBRARIES) library or installed library, you would need to handle this at the top level.

In theory, I suppose you could add libs as the last directory. But I have my doubts that this would work, e.g., make dist - and it would be madness anyway. It's best just to pretend this paragraph was never written.