Tri wrote:
> 1) should I stick to handwriting makefiles (to become more adept at it)
You can probably use a single makefile for most
things, along with suitable inference rules and
the -M flag to gcc.
> or
> 2) is there a program i could use to calculate these dependencies and
gcc -M will produce a make dependency
for source.c. Then you use a make file that looks
(something) like this:
include rules.mak
SOURCES = list.c of.c source.c files.c
OBJS = list.o of.o source.o files.o
all : depend my.exe
my.exe : $(OBJS)
depend :
gcc -M $(OBJS) > depend.mak
include depend.mak
The key is that rules.mak contains the general
rules that tell make how to produce a *.o from
a *.c, and a *.exe from a list of *.o's. I don't
have the gmake docs right at hand, but it's
something like this (this is certainly not
right, though - you need to print out and read
the relevant sections of the GNU make manual):
*.o : *.c
gcc -o $< $!
which says, "To make a .o from a .c, run gcc on
the .c file."
If you have libraries to link to, it will be a
bit more complicated, but for most simple
programs the skeleton above will make a
good starting point.
HTH,
-- Joe
> also write out a makefile for me?
> 3) is there a website that can help me tackle these problems (most talk
> about learning the language and not the annoying aspects that I am
> talking about here.
I'm sure there are many.
> Any help at all would be appreciated (even if it doesn't directly apply
> to this email, but to novice programming in general. it doesn't even
> have to be about c++ since this problem comes up in large complex C
> programs also)
>
> Thanks,
> Tri
> --
> To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.
-- Joe Knapka
* What happens when a mysterious force meets an inscrutable object?
--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.