Idea: Avoid symlinking the Makefiles
Closed this issue · 3 comments
(Merely an idea/suggestion, not a wishlist thing. I just read ocrd-make
the first time.) The way I use "the backend Makefile
" is that I have this in my "frontend" eval.mk
:
# Determine directory of this file – must be at the top before other includes
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
# [...]
include $(SELF_DIR)Makefile
This is – I think – the most elegant way to find the Makefile
from my eval.mk
, assuming both are in the same directory. Then I can just use:
cd /path/to/some/directory/of/workspaces
make -f /usr/local/src/workflow-configuration/eval.mk
I have simplified a bit because I run this by container, but it should be correct like this.
I remember make
was severely restricted in search directory resolution. This was quite a struggle under various circumstances (esp. -C
and recursive invocation), despite using -I
and abspath
.
This is worth another try though. If it does work, then not only does config symlinking/copying become unnecessary, but ocrd-make
itself.
However, it's something of a stain to that new simpler UI that you have to remember (and type) the full path where workflow-configuration has been installed. That's were (a complete rewrite of) ocrd-make
could step in: It could delegate to its install-time SHAREDIR
, thus translating…
ocrd-make -j -f eval.mk all
…to your…
make -j -f /usr/local/src/workflow-configuration/eval.mk all
Ok, so the situation is this: your idea of course works in that anyone can write their local workflow configurations like that (with the abspath include $(SELFDIR)/Makefile
) and then call them from anywhere by make -f full/path/to/config.mk
. But I don't want to rewrite existing configurations (both the old examples in the repo and all my local makefiles) for that little gain. The alternative (without modifying the configs) is to just use make -I full/path/to -f full/path/to/config.mk
.
Unfortunately, there is no simple way to make a wrapper ocrd-make
out of this pattern that would enable calling the makefile without its full path. The reason is that make -I SEARCHDIR -f CFGFILE
does not use the searchdir
to resolve the cfgfile
path, and I don't want to start parsing the parameters externally and guessing which prefixes to add, and whether users have their files under the install location or elsewhere.
@mikegerber, we can close this because in 1746daa I decided against top-level (recursive) make anyway. The new ocrd-make
does not symlink/copy makefiles (in fact, it adds a -I
so there is no need for path name resolution of the main Makefile
anymore).
See #21 for the general idea (and further perspectives).