0
votes

I have a static library called libunikey.la, and an app named ibus-unikey that links to it.

The problem is, whenever libunikey.la is rebuilt, ibus-unikey is not rebuilt, so the changes to libunikey.la don't take effect on ibus-unikey.

I want ibus-unikey to be rebuilt (relinked) whenever libunikey.la is changed, the way Makefile dependency does.

How to do it with automake, GNU autotools?

___UPDATE_________

To make it simpler, the real question is: How could I make a rule to force a target to be recompiled when another target / or simply a file, is changed? (with automake)

2
Can yo make a minimal example that shows this? What you're asking for is the default behaviour. - Flexo
@awoodland: I've updated the question, please take a look. - perfwill

2 Answers

1
votes

I assume that your starting situation was along the lines of _LDADD = -Lpath/to -lthe_dependency, so yes in that case you fixed it (for most situations) by using the path to the .la file.

The best option, though, is to use non-recursive automake, so that the _LDADD dependency is expanded properly in all cases.

Namely, let's say your binary is in src/ and your library is in lib/ — if your current work directory is src and you changed a file in lib, that will not cause the library to be rebuilt, and your binary re-linked, because inter-Makefile.am dependencies do not exist.

0
votes

Found the answer my self, just post this answer for those in the same situation:
add a line to Makefile.am:

my_target_LDADD = path/to/the_dependency  

It will solve the problem.