home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / utils / bug / 1457 < prev    next >
Encoding:
Text File  |  1992-09-01  |  2.3 KB  |  92 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!transarc.com!Bob_Sidebotham
  3. From: Bob_Sidebotham@transarc.com
  4. Subject: dependency chaining bug
  5. Message-ID: <MecuRpL0BwwS412306@transarc.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 1 Sep 1992 09:25:09 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 79
  12.  
  13. There's a bug in the way that dependencies of the form -l<lib> work. In
  14. the following makefile, "baz" and "bar" are made in a similar manner,
  15. except that baz is made implicitly with a dependency list of "baz.o
  16. -lfoo", while bar is made with a dependency list of "bar.o libfoo.a". If
  17. the file "foo.h" is touched, the object file and library will not be
  18. remade if you type "make baz", but will be remade if you type "make bar".
  19.  
  20. To try this out, put this makefile in a clean directory, and type
  21. "make". It will create all the necessary files. Then type "make baz" and
  22. "make bar". You should see the following results:
  23.  
  24. [make-bug] make -v
  25. GNU Make version 3.62, by Richard Stallman and Roland McGrath.
  26. Copyright (C) 1988-1991 Free Software Foundation, Inc.
  27. This is free software; see the source for copying conditions.
  28. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  29. PARTICULAR PURPOSE.
  30.  
  31. echo "main() {}" > bar.c
  32. cc    -c bar.c -o bar.o
  33. echo "/* a library component */" > foo.c
  34. echo "/* a header file */" > foo.h
  35. cc    -c foo.c -o foo.o
  36. ar rv libfoo.a foo.o
  37. ar: creating an archive file libfoo.a
  38. a - foo.o
  39. cc -L.  bar.o libfoo.a   -o bar
  40. echo "main() {}" > baz.c
  41. cc    -c baz.c -o baz.o
  42. cc -L.  baz.o -lfoo   -o baz
  43. [make-bug] touch foo.h
  44. [make-bug] make baz
  45. make: `baz' is up to date.
  46. [make-bug] make bar
  47. cc    -c foo.c -o foo.o
  48. ar rv libfoo.a foo.o
  49. r - foo.o
  50. cc -L.  bar.o libfoo.a   -o bar
  51.  
  52. Here's the makefile:
  53.  
  54. ------------------CUT HERE-----------------
  55. vpath        .
  56. LDFLAGS=    -L.
  57.  
  58. all:        bar baz
  59.  
  60. foo.c:
  61.         echo "/* a library component */" > foo.c
  62.  
  63. foo.h:
  64.         echo "/* a header file */" > foo.h
  65.  
  66. bar.c:
  67.         echo "main() {}" > bar.c
  68.  
  69. baz.c:
  70.         echo "main() {}" > baz.c
  71.  
  72. foo.o:        foo.c foo.h
  73.  
  74. libfoo.a:    foo.o
  75.         ar rv libfoo.a foo.o
  76.  
  77. bar:        bar.o libfoo.a
  78.  
  79. baz:        baz.o -lfoo
  80.  
  81. clean:
  82.         $(RM) foo.c foo.h bar.c bar.o baz.c baz.o foo.o libfoo.a bar baz
  83. --------------------END Makefile---------------
  84.  
  85. Thanks,
  86.  
  87. Bob Sidebotham bob@transarc.com
  88. Transarc Corporation 412-338-4367
  89.  
  90.  
  91.  
  92.