Norman Feske wrote:
Hi Valery,
On 18.03.19 00:17, Valery V. Sedletski via users wrote:
Hi all.
Does Genode build system only allow to build a binary or library with each "target.mk" makefile? Is it possible to have non-binary targets in these makefiles, or have more than one target? ...
to target.mk. So, the map file should be a dependency of "all" target, but this does not work, because "map" then is built before the binary specified as
TARGET = <binary_name>
Does someone have any ideas, how it's possible to accomplish this?
I'm afraid that your use case is currently not very well covered.
So we should probably add a proper hook for it. In the meantime, could you give the following idea a try?
So, the targets other than binaries/libraries are not possible currently? This is what I suspected. Indeed, having a hook for extra custom targets executed before or after the main target would be a good idea.
ifneq ($(INSTALL_DIR),) all: map endif
map: $(TARGET) nm $< | sed "s/some/magic" > $@
The check for 'INSTALL_DIR' is needed because the target.mk file is actually visited twice during the build. First, it is examined to find out the inter-library dependencies. This dependency stage is followed by the actual build stage. The custom rule should be executed in the latter stage only. As INSTALL_DIR is defined only at the build stage, we can use it as a condition here.
The dependency from $(TARGET) ensures that your binary exists before 'nm' is called on it.
Cheers Norman
This worked fine. So, "map" target is indeed executed before $(TARGET), as required. Thank you very much for the excellent idea about checking INSTALL_DIR, this is what helped. (I noticed that the "all" target is called twice, and this hurted things up. Now it is called only once, as it should).
WBR, valery