From: Jim Brown <jbrown@si...> - 2002-11-23 01:25:19
Thanks Oscar - obvious when you know how.
From: Oscar Fuentes [mailto:ofv@...]
Sent: Friday, November 22, 2002 4:55 PM
To: mingw-users@...; Jim Brown
Subject: Re: [Mingw-users] makefile problems
"Jim Brown" <jbrown@...> writes:
> Hi - I have just downloaded MinGW and I have a problem creating a
> makefile that works. Below is a simple makefile I use for test:
> zeta.o : zeta.c
> gcc -c zeta.c
> trig.o : trig.c
> gcc -c trig.c
> No matter what I try, the second file is never even considered by
'Make' is doing its work. If you don't provide a target name on the
command line, it defaults to the first target listed on your
Makefile. So when you execute 'make', zeta.o is built and then 'make'
stops. If you want to build 'my.exe' write this makefile:
my.exe : zeta.o trig.o
zeta.o : zeta.c
gcc -c zeta.c
trig.o : trig.c
gcc -c trig.c
Now, the first target is 'my.exe' and 'make' will try to build it when
you invoke the command without providing a target name. As 'my.exe'
depends on 'zeta.o', 'make' will try to build that file if it is not
up to date. Likewise for the other dependencies.
If you later want to build 'trig.o' and ignore the other targets,
invoke 'make' this way:
From: Soren A <soren_andersen@fa...> - 2002-11-24 00:32:53
"Jim Brown" <jbrown@...> wrote around 22 Nov 2002
> Below is a simple makefile
If you would like to skim some complex Makefiles sometime, to glean ideas
for writing your own Makefiles, then I invite you to visit my site at:
I found that learning the nuances and subtleties of GNU `make' was promoted
for me, by looking at well-written Makefiles for existing packages. That's
primarily why my site exists. The Makefiles there are displayed in the
graphical WWW browser as syntax-highlighted files that make it easier to
quickly grasp what's being done in them, syntactically (many people feel it
is easier, anyway. YMMV).
Yes, it's really Sören, not Soren.