bash - How to run "make" from a higher-level directory? -


let's i'm in subdirectory sub:

admin@pc ~/folder/subfolder $ 

i run make on makefile folder directory.

how can achieve when i'm in subfolder directory?

i had ideas like:

admin@pc ~/folder/subfolder $ ../make admin@pc ~/folder/subfolder $ /../make 

but none of these works.

an alternative, built-in answer, avoids sub-shell khachik's answer answer given helpyou in comment:

to run make different directory automatically want -c option make.

‘-c dir’

‘--directory=dir’

change directory dir before reading makefiles. if multiple ‘-c’ options specified, each interpreted relative previous one: ‘-c / -c etc’ equivalent ‘-c /etc’. typically used recursive invocations of make (see recursive use of make).

the -f argument specifies alternate makefile use runs in current directory.

the sub-shell solution 1 , correct 1 if make did not have built-in solution this.