xmake (using version 14.3.3 of the tools):
We have a module that is compiled into a library. In its
module_build_info file, a few directories are specified in the
`EXPORT_SOURCE_DIRS` variable. So far everything was working, the
specified directories got exported as expected when running
However, recently, we added dependencies to other modules, which are
specified in `LIBRARY_USED_MODULES` in the same module_build_info file.
While the specified modules are successfully found, this results in the
`EXPORT_SOURCE_DIRS` variable being cleared and thus the export not
After reading the makefiles, I found that the variable is cleared inside
a function `INCLUDE_MODULE` that is defined in Makefile.common1. This
function only seems to be called when `LIBRARY_USED_MODULES` is defined,
therefore it did not happen in the past.
From what I understand, the value of `EXPORT_SOURCE_DIRS` is saved in
the beginning of the function to `_EXPORT_SOURCE_DIRS`, then the
variable is cleared and the other module is imported. In the end, the
value of `EXPORT_SOURCE_DIRS` is again written to the otherwise unused
`_EXPORT_SOURCE_DIRS`. I assume that this should actually be the other
way round to restore the original value back to `EXPORT_SOURCE_DIRS`?
Unfortunately I am not very familiar with Makefiles and are not sure, if
I understand the intention of this code correctly. Is this really a bug
in the Makefile.common1 or did I misunderstand something and there is an
other way to specify the module dependencies, that does not affect the
EDIT: Same as for EXPORT_SOURCE_DIRS also happens with LIBRARIES
at the same place in the code.
When I fix the supposed bug locally, everything seems to work well. Diff of my change:
Code: Select all
❱ diff Makefile.common1_orig Makefile.common1_fixed
< _LIBRARIES := $$(LIBRARIES)
< _EXPORT_SOURCE_DIRS := $$(EXPORT_SOURCE_DIRS)
> LIBRARIES := $$(_LIBRARIES)
> EXPORT_SOURCE_DIRS := $$(_EXPORT_SOURCE_DIRS)