I often got to work with projects organized as follows:
src/
include/
...
Makefile
Is there a way to teach emacs' "compile" function to always use that top-level Makefile regardless which file I'm editing in the current buffer? For example it can be any of
src/sub1/s1.c
include/protocol/p.h
src/x.c
tests/test1/test_x.c
In all those cases I want "compile" command to go as many times "up" in hierarchy as necessary to get into top-level directory (the one in the directory with 'src', 'include' and 'tests' entries) and run Makefile in there. Additional problem is that any of sub directories can have Makefiles of its own.