Best way of doing Make library dependencies
Posted: Tue Sep 14, 2021 1:50 pm
Hello,
I have been working on the build system of my operating system (for 2 months ). I am using non recursive GNU Make to build it. One question I have is what is the best way of making an executable depend on a library? At the moment, I'm doing it like this:
LIBK_OUTPUTNAME contains the name of the libk archive. One problem I perceived is the infinitesimally small chance that libk is still building when the executable is finished. Then, it will see an out of date libk (which is really in the process of being built), and then it will re-invoke the recipe. This would probably cause race conditions and other evils.
So, my question is: How can I make the executable wait for libk to come in date, instead of invoking the recipe itself? Is that even possible?
Thanks,
nexos
P.S. The full repo is in my signature
I have been working on the build system of my operating system (for 2 months ). I am using non recursive GNU Make to build it. One question I have is what is the best way of making an executable depend on a library? At the moment, I'm doing it like this:
Code: Select all
$(BOOTEFI_OUTPUTNAME): $(BOOTEFI_OBJFILES) $(LIBK_OUTPUTNAME) Makefile
So, my question is: How can I make the executable wait for libk to come in date, instead of invoking the recipe itself? Is that even possible?
Thanks,
nexos
P.S. The full repo is in my signature