1

次のメイクファイルを検討してください。

default: foo.o

clean:
    rm -f fmake test_second
%.o: %.c
    echo This is customized implicit rule

%.o: %.c
    echo This is overriden implicit rule

makeコマンドの出力は次のとおりです。

echo This is overriden implicit rule
This is overriden implicit rule

これで結構です。ただし、makefile が次の場合:

default: foo.o

clean:
    rm -f fmake test_second
%.o: %.c
    echo This is customized implicit rule

%.o: %.z
    echo This is overriden implicit rule

makeコマンドの出力は次のとおりです。

echo This is customized implicit rule
This is customized implicit rule

最初の例と同じになると思っていました。なぜ違うのですか?makefile のディレクトリに foo.c と foo.z の両方のファイルがあります。

4

1 に答える 1