The paragraph where you describe your problem is very confusing and hard to understand. When asking questions please be sure that the section describing the problem is the most clear: it's helpful if you provide sample output showing exactly what commands you typed and the results you got, and explain what you expected to get instead.
However, my interpretation is that if you run make first
it uses the built-in rule to compile first
directly from first.c
, rather than your pattern rules (note that both the built-in rules and your pattern rules are considered "implicit rules").
That's because make will choose the "shorter" implicit rule chain so the rule building an executable directly from source, in one step, rather than building the object then the executable in two steps, will be preferred. If you don't want to use the built-in implicit rule then you need to either invoke make with the -r
flag, or else delete it by adding:
% : %.c
(just that) to your makefile.