Tengo el siguiente makefile recursiva:Al declarar la regla patrón tan falsa, no se desencadena
.PHONY: all clean
%.subdir:
$(MAKE) -C src $*
$(MAKE) -C dict $*
all: all.subdir
clean: clean.subdir
y trabaja muy bien:
$ make all
make -C src all
make[1]: Entering directory `/or-1.3.6-fix/src'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/or-1.3.6-fix/src'
make -C dict all
make[1]: Entering directory `/or-1.3.6-fix/dict'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/or-1.3.6-fix/dict'
pero sería más lógico para definir %.subdir
normas como falsa:
.PHONY: all clean all.subdir clean.subdir
y ahora hacen paradas a trabajar como yo quiero:
$ make all
make: Nothing to be done for `all'.
$ make -d all
...
Updating goal targets....
Considering target file `all'.
File `all' does not exist.
Considering target file `all.subdir'.
File `all.subdir' does not exist.
Finished prerequisites of target file `all.subdir'.
Must remake target `all.subdir'.
Successfully remade target file `all.subdir'.
Finished prerequisites of target file `all'.
Must remake target `all'.
Successfully remade target file `all'.
make: Nothing to be done for `all'.
¿Alguien puede explicarme por qué (o incluso mejor me señalan para hacer la documentación)?
¡Gracias por la buena pista! Muy bien. Prefiero embellecerme un poco más y decir 'PHONY_TARGETS: = all clean' y luego' .PHONY: $ (PHONY_TARGETS) $ (addsuffix .subdir, $ (PHONY_TARGETS)) ' –
Encontré la documentación para esos dos puntos buscando target/dep línea si alguien está interesado: https://www.gnu.org/software/make/manual/html_node/Static-Usage.html#Static-Usage – solstice333