Pergunta

What is the standard ? And in which case we should use the following ?

$(MAKE) -C subdir

cd subdir && $(MAKE)

cd subdir ; $(MAKE)

same for when doing make clean ?

Foi útil?

Solução

Here's a diagram:

Method  | Correct | Cross-platform
--------+---------+---------------
-C      |    X    |     
&&      |    X    |      X
 ;      |         |      X

-C works well for GNU make, but is not POSIX.

; works equally poorly on all platforms (if subdir is inaccessible, it results in an infinite loop).

&& is both correct and portable, and therefore the best option.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top