I have a project with the following directory structure:
foo/
foo/Makefile
foo/bar/
My goal is to add a file foo/bar/Makefile, so if I call makein foo/bar, the parent directory's Makefile will be used. This is a kind of inverted recursive Makefile structure (I want each Makefile to call the parent directory until it reaches the project root).
Symlinking error, because a call from the wrong directory interrupts all relative paths:
$ ln -s ../Makefile foo/bar/Makefile
$ make -C foo/bar
[error]
The only solution I found was to write a Makefile that captures all the targets that interest me and calls the parent directory for this purpose:
$ cat foo/bar/Makefile
all clean:
$(MAKE) -C .. $@
It is laborious and easy to break. Is there a more elegant solution?
Justification
LaTeX, .tex , .. make .