home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10395 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.8 KB  |  62 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!mcsun!sunic!sics.se!eua.ericsson.se!etxaha
  3. From: etxaha@eua.ericsson.se (Anders Hallberg)
  4. Subject: make: bug?
  5. Message-ID: <1992Aug26.150451.10614@eua.ericsson.se>
  6. Summary: Error in make when using : sh = macros
  7. Keywords: make
  8. Sender: news@eua.ericsson.se
  9. Nntp-Posting-Host: euas20.eua.ericsson.se
  10. Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden
  11. Date: Wed, 26 Aug 1992 15:04:51 GMT
  12. Lines: 48
  13.  
  14. I wanted to create a make file that collected all files in a directory
  15. tree with a given extension into a variable so I made the following
  16. makefile as a test:
  17.  
  18. % cat Makefile
  19. ALL_SRC :sh = find . -name '*.cc' -print
  20. ALL_LIBS :sh = find . -name '*.a' -print
  21.  
  22. all:
  23.         @echo '.cc files:'
  24.         @echo $(ALL_SRC)
  25.         @echo '.a files:'
  26.         @echo $(ALL_LIBS)
  27.  
  28. I then created a directory tree with a number of .cc files but no .a
  29. files and...
  30.  
  31. % make
  32. .cc files:
  33. ./a/a/a/a.cc ./a/a/b/b.cc ./a/a/c/c.cc ./a/b/a/d.cc ./a/b/a/e.cc ./a/b/b/f.cc\
  34.  /a/c/g.cc ./a/c/h.cc
  35. .a files:
  36. a/a/a.cc ./a/a/b/b.cc ./a/a/c/c.cc ./a/b/a/d.cc ./a/b/a/e.cc ./a/b/b/f.cc\
  37.  ./a/c/g.cc ./a/c/h.cc
  38.  
  39. Not what I expected.  Then I created a .a file.
  40.  
  41. % touch a/a/a/a.a
  42. % make
  43. .cc files:
  44. ./a/a/a/a.cc ./a/a/b/b.cc ./a/a/c/c.cc ./a/b/a/d.cc ./a/b/a/e.cc ./a/b/b/f.cc\
  45.  ./a/c/g.cc ./a/c/h.cc
  46. .a files:
  47. ./a/a/a/a.a
  48.  
  49. Suddenly, it works.  Apparently the value of the macro is undefined if
  50. there is no output from the shell command.  Changing the order of the
  51. two macro definitions in the first case (no .a files) gave a different
  52. value for ALL_LIBS.  I.e. when ALL_LIBS was defined first it became
  53. empty.
  54.  
  55. As for versions and such, this is from the man pages of make:
  56.  
  57. Sun Release 4.1  Last change: 15 September 1989
  58.  
  59. Now, is this an error?  I think it is.
  60.  
  61. /Anders Hallberg
  62.