Adding dependencies to a library clears EXPORT_SOURCE_DIRS

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
luator
New User
Posts: 2
Joined: Mon Mar 18, 2019 2:54 pm

Adding dependencies to a library clears EXPORT_SOURCE_DIRS

Postby luator » Wed Mar 20, 2019 3:10 pm

I noticed a potential bug in the makefiles for compiling libraries with
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
`xmake export`.

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
working anymore.

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
export?

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
641,642c641,642
< _LIBRARIES := $$(LIBRARIES)
< _EXPORT_SOURCE_DIRS := $$(EXPORT_SOURCE_DIRS)
---
> LIBRARIES := $$(_LIBRARIES)
> EXPORT_SOURCE_DIRS := $$(_EXPORT_SOURCE_DIRS)

Who is online

Users browsing this forum: No registered users and 4 guests