Mail Archives: djgpp/1997/08/28/05:24:50
On Wed, 27 Aug 1997, Michael Mauch wrote:
> x.exe: x.o
>
> This makes the x.o from x.c, because of the implicit rule for compiling
> .o from .c. But x.exe is not created.
Make doesn't know how to make .exe from .o, it's not in its built-in
rule data-base. So you must tell it how to do that. For example:
x.exe: x.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
(All of the $(whatever) variables used in the above are stored in
Make's built-in rule data-base; see the manual for more details.)
You could also make this rule more general by using pattern rules:
%.exe: %.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
This will make the rule work for any .o file, not just for x.o.
Again, see the Make manual for details.
- Raw text -