I received the code from a proprietary Linux driver, which has the following structure:
common/common.c
moduleA/Makefile
moduleB/Makefile
The issue is that both moduleA and moduleB contain the statement moduleX-objs += ../common/common.o. This is obviously racy, because when doing a multithread compilation two threads are reading/writing to the file common/common.o at the same time.
What is the clean way to solve this? Create a separate module common.ko?
What is the standard way to do such things with the kernel build system?