What I am trying to do seems a very basic stuff, but I can\'t find anything about it. I am working on a project built as usual:
project
|-- bin
|-- inc
`-- s
Slight modification of what Adam said:
:set makeprg=[[\ -f\ Makefile\ ]]\ &&\ make\ \\\|\\\|\ make\ -C\ ..
Unescaped, this is
[[ -f Makefile ]] && make || make -C ..
which means, pseudo code style
if file-exists(Makefile)
then make
else make -C ..
This only goes one directory up. If you'd like a more general solution that will go as many directories up as necessary, you'll need to be able to search ancestor directories until a Makefile is found, and I'm not sure how to do that simply from the command line. But writing a script (in whatever language you prefer) and then calling it from your makeprg shouldn't be hard.