home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!usc!sol.ctr.columbia.edu!spool.mu.edu!agate!doc.ic.ac.uk!uknet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
- From: etxmesa@eos.ericsson.se (Michael Salmon)
- Newsgroups: comp.unix.questions
- Subject: Re: simple makefile question
- Message-ID: <1992Nov5.080624.3984@ericsson.se>
- Date: 5 Nov 92 08:06:24 GMT
- References: <EJH.92Nov4112711@khonshu.colorado.edu>
- Sender: news@ericsson.se
- Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
- Organization: Ericsson Telecom AB
- Lines: 64
- Nntp-Posting-Host: eos6c02.ericsson.se
-
- In article <EJH.92Nov4112711@khonshu.colorado.edu>,
- Edward J. Hartnett writes:
- |>
- |> I've been using makefiles for years, but never really learned too much
- |> about them, just copied existing ones and modified them somehow to
- |> work. But recently I decided to take the plunge, and, of course, got
- |> into trouble.
- |>
- |> I had a makefile that worked fine for a program called atob.f, which
- |> was alone in it's own directory. I put another program in that
- |> directory (rdhdr.f) which has no code in common with the first (except
- |> a shared library), but is functionally related to it. I wanted to
- |> update the makefile such that when it was invoked it would recompile
- |> one or both programs as needed. Here's what I ended up with:
- |>
- |> OBJ = atob.o
- |> FFLAGS = -e -C
- |> F77 = f77
- |> LIB = /home/khonshu/ejh/subs/ejhsubs.a
- |> LIB2 = /home/khonshu/ejh/cond_samp/subs/cond_samp.a
- |>
- |>
- |> atob: $(OBJ)
- |> $(F77) $(FFLAGS) -o atob $(OBJ) $(LIB) $(LIB2)
- |>
- |> rdhdr: rdhdr.o
- |> f77 $(FFLAGS) -o rdhdr rdhdr.o $(LIB2)
- |>
- |>
- |> It seemed to me this would do the trick. At this point rdhdr needed to
- |> be recompiled, but atob.f was unchanged. I invoked make and got a
- |> message that atob was up to date (which was correct), and then it
- |> exited. It never even attempted rdhdr! So I switched the lines thusly:
- |>
- |> rdhdr: rdhdr.o
- |> f77 $(FFLAGS) -o rdhdr rdhdr.o $(LIB2)
- |>
- |> atob: $(OBJ)
- |> $(F77) $(FFLAGS) -o atob $(OBJ) $(LIB) $(LIB2)
- |>
- |> And then it worked for rdhdr, but never gave me a message about atob.
- |> I thought that all dependancies are evaluated, but it seems to do only
- |> the first! Any help out there?
-
- From the man page for make:
-
- If no target is specified on the command line, make uses the
- first target defined in makefile.
-
- What you need is an entry like:
-
- all : atob rdhdr
-
- as the first target.
- --
-
- Michael Salmon
-
- #include <standard.disclaimer>
- #include <witty.saying>
- #include <fancy.pseudo.graphics>
-
- Ericsson Telecom AB
- Stockholm
-