home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / question / 12934 < prev    next >
Encoding:
Text File  |  1992-11-04  |  2.5 KB  |  78 lines

  1. 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
  2. From: etxmesa@eos.ericsson.se (Michael Salmon)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: simple makefile question
  5. Message-ID: <1992Nov5.080624.3984@ericsson.se>
  6. Date: 5 Nov 92 08:06:24 GMT
  7. References: <EJH.92Nov4112711@khonshu.colorado.edu>
  8. Sender: news@ericsson.se
  9. Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
  10. Organization: Ericsson Telecom AB
  11. Lines: 64
  12. Nntp-Posting-Host: eos6c02.ericsson.se
  13.  
  14. In article <EJH.92Nov4112711@khonshu.colorado.edu>, 
  15. Edward J. Hartnett writes:
  16. |> 
  17. |> I've been using makefiles for years, but never really learned too much
  18. |> about them, just copied existing ones and modified them somehow to
  19. |> work. But recently I decided to take the plunge, and, of course, got
  20. |> into trouble.
  21. |> 
  22. |> I had a makefile that worked fine for a program called atob.f, which
  23. |> was alone in it's own directory. I put another program in that
  24. |> directory (rdhdr.f) which has no code in common with the first (except
  25. |> a shared library), but is functionally related to it. I wanted to
  26. |> update the makefile such that when it was invoked it would recompile
  27. |> one or both programs as needed. Here's what I ended up with:
  28. |> 
  29. |> OBJ = atob.o
  30. |> FFLAGS = -e -C
  31. |> F77 = f77
  32. |> LIB = /home/khonshu/ejh/subs/ejhsubs.a
  33. |> LIB2 = /home/khonshu/ejh/cond_samp/subs/cond_samp.a
  34. |> 
  35. |> 
  36. |> atob: $(OBJ)
  37. |>     $(F77) $(FFLAGS) -o atob $(OBJ) $(LIB) $(LIB2)
  38. |> 
  39. |> rdhdr: rdhdr.o
  40. |>     f77 $(FFLAGS) -o rdhdr rdhdr.o $(LIB2)
  41. |> 
  42. |> 
  43. |> It seemed to me this would do the trick. At this point rdhdr needed to
  44. |> be recompiled, but atob.f was unchanged. I invoked make and got a
  45. |> message that atob was up to date (which was correct), and then it
  46. |> exited. It never even attempted rdhdr! So I switched the lines thusly:
  47. |> 
  48. |> rdhdr: rdhdr.o
  49. |>     f77 $(FFLAGS) -o rdhdr rdhdr.o $(LIB2)
  50. |> 
  51. |> atob: $(OBJ)
  52. |>     $(F77) $(FFLAGS) -o atob $(OBJ) $(LIB) $(LIB2)
  53. |> 
  54. |> And then it worked for rdhdr, but never gave me a message about atob.
  55. |> I thought that all dependancies are evaluated, but it seems to do only
  56. |> the first! Any help out there?
  57.  
  58. From the man page for make:
  59.  
  60.      If no target is specified on the command line, make uses the
  61.      first target defined in makefile.
  62.  
  63. What you need is an entry like:
  64.  
  65. all : atob rdhdr
  66.  
  67. as the first target.
  68. -- 
  69.  
  70. Michael Salmon
  71.  
  72. #include    <standard.disclaimer>
  73. #include    <witty.saying>
  74. #include    <fancy.pseudo.graphics>
  75.  
  76. Ericsson Telecom AB
  77. Stockholm
  78.