Hi all,
I frequently set up my Chibi projects to depend on my own common libraries for sharing code between different projects. They are built separately and installed into a dir where I point the Chibi build system. So I typically have something like this in my Makefile:
ULIBDIR = some/path/where/installed
ULIBS = -lfoo -lbar
However, during development sometimes I'll recompile libfoo.a and rebuild my Chibi project afterwards. If I haven't made any changes to the Chibi project itself, it thinks it is already up to date. Is there a way to set up the Chibi makefile to have a proper dependency on the libfoo.a timestamp so it knows to rebuild when the underlying libraries have been modified?
Thanks
Dave
External dependencies for Makefile
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: External dependencies for Makefile
Hi,
Not sure how to implement that, there is not a direct path to library files, even the library name is not the real file name.
Giovanni
Not sure how to implement that, there is not a direct path to library files, even the library name is not the real file name.
Giovanni
Re: External dependencies for Makefile
So the nice folks in #gnu IRC channel pointed me in the right direction. In case anyone else needs, you can easily make the project elf target depend on an arbitrary file's time. The trick is making sure you put it _after_ the include rules.mk which defines the elf target.
The use of $(ULIBDIR) may need to be tweaked in other situations, since if it is a list, and not all directories contain .a files, it will fail. YMMV
Code: Select all
...
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
# Relink whenever a static library is updated
$(BUILDDIR)/$(PROJECT).elf: $(ULIBDIR)/*.a
The use of $(ULIBDIR) may need to be tweaked in other situations, since if it is a list, and not all directories contain .a files, it will fail. YMMV
Who is online
Users browsing this forum: No registered users and 45 guests