Mail Archives: djgpp/1998/09/28/07:16:16
John S. Fine <johnfine AT erols DOT com> wrote:
> In case that needs to be a little clearer, the source of
> the confusion is that gcc is used as both the compiler and
> the linker (actually gcc is a control program that invokes
> the compiler and linker).
This can be confusing yes. Even more if a makefile asks for LD and you
know you've got ld.exe, but should say gcc.
> The rule above, is using gcc as a linker to combine all the
> .o files (and some libraries) into an exe file. As such, its
> list of .o files must include both the ones that came from .c
> files and the ones that came from .asm files.
And that's no problem to either make nor gcc. It can be confusing to
make if you need xyz.o and you both have xyz.c and xyz.asm.
If you have got xyz.c and abc.asm and the makefile:
CC = gcc
CFLAGS = -m486 -s -Wall -Werror
OBJS = xyz.o abc.o
gall.exe: $(OBJS); gcc -o $@ $(OBJS)
%.o: %.asm; nasm $< -o $@ -fcoff $(NASMFLAGS)
will do what you want, and expect it to do.
(because the %.o: %.c rule is builtin.You can make it explicit also,
for clarity and to control the proces completely)
bye now,
Robert.
--
rjvdboon AT cs DOT vu DOT nl | "En dat is niet waar!" sprak ex-Staatsecretaris-
www.cs.vu.nl/~rjvdboon | van-Onderwijs Netelenbos fel.
- Raw text -