[SOLVED] Remake on library change?
I have an application project with "libcommon.a" library dependency in my .pro file added using "LIBS += -L../common/ -lcommon". This works fine, but when I recompile the library and try to recompile the application, the application doesn't recognise a newer archive file as a dependency - i.e. as a reason to re-link. I then have to make some arbitrary change+undo+save, which is (i) annoying and (ii) I sometimes forget and, particularly with subtle changes, this leads to me wasting time tracking down problems that should be gone etc. What's the best way to add my library as a dependency so that the application re-links after it changes?
Thanks for any help!
Try to use "PHONY":http://www.gnu.org/software/make/manual/html_node/Phony-Targets.html in makefile
also you can try -B == --always-make makeflags
Hi - thanks for the response, but I don't think that's what I'm after. -B/-always-make takes far too much time (it's a big project) and I'd still need to make the main executable depend on the PHONY target, which I don't know how to do. If I could do that, it'd be easier to just add the dependency to the executable in the makefile, like:
application: ../common/libcommon.a [other stuff]
I just don't know how to do that in a .pro file.
Add to your .pro file for the project that uses the library:
PRE_TARGETDEPS = /path/to/your/libcommon.a
Thanks Volker - worked like a charm.
For some reasons it does not work for me, this is what I get:
@make: *** No rule to make target '/home/alex/Projects/dtrcet/src/gui/libs/libcore.a', needed by 'gui'. Stop.@