Duplicar posibles:
GNU Makefile rule generating a few targets from a single source fileGNU make: objetivos múltiples en una sola regla
Si tengo una regla Makefile así:
a b c:
echo "Creating a b c"
touch a b c
output: a b c
cat a b c > output
y corro make -j9 output
make ve las 3 dependencias (a, b, c), busca cómo producirlas: (la regla "a b c" anterior), pero ¿qué pasa después? ¿No debería darse cuenta de que la regla "a b c" solo necesita ejecutarse una vez para crear los 3 objetivos?
Esto es lo que hacen en realidad hace:
[[email protected] test]$ make -j9 output -n
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
cat a b c > output
[[email protected] test]$
La misma receta se ejecuta 3 veces, una vez para cada dependencia de gobernar "de salida"!
¿Alguien sabe por qué se comporta de esta manera?
Relacionado: http: // stackoverflow.com/questions/3016258/generate-multiple-target-using-single-action-rule y http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a- archivo de una sola fuente – krlmlr