help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on rule priority


From: Anton Shepelev
Subject: A question on rule priority
Date: Sun, 3 Mar 2019 20:00:10 +0300

Hello, all

I have the following make file:
 
 test.o: test.c

  %.o:   %.c; tcc -c $< -o $@
  %.exe: %.o; tcc -o $@ $^
  %.exe: %.c; tcc $^ -o $@

and invoke it as:
  make test.exe
in a directory that has test.c, but has no test.o .
It runs these commands:

  tcc -c test.c -o test.o
  tcc -o test.exe test.o

But since paragraph 10.5.4 How Patterns Match of the manual
says that "a rule whose prerequisites actually exist or are
mentioned always takes priority over a rule with prerequisites
that must be made by chaining other implicit rules," I expected
make to follow the shortest path using the third pattern rule,
i.e.:  tcc test.c -o test.exe .

Why did make decide on build test.o from test.c and then test.exe
from test.o?

-- 
()  ascii ribbon campaign -- against html e-mail
/\  http://preview.tinyurl.com/qcy6mjc [archived]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]