home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / shell / 5454 < prev    next >
Encoding:
Text File  |  1993-01-21  |  975 b   |  33 lines

  1. Path: sparky!uunet!gossip.pyramid.com!pyramid!infmx!hartman
  2. From: hartman@informix.com (Robert Hartman)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: Problem with sh-commands from a Makefile
  5. Message-ID: <1993Jan21.184558.27566@informix.com>
  6. Date: 21 Jan 93 18:45:58 GMT
  7. References: <1993Jan20.211940.18612@odin.diku.dk>
  8. Sender: news@informix.com (Usenet News)
  9. Organization: Informix Software, Inc.
  10. Lines: 21
  11.  
  12. In article <1993Jan20.211940.18612@odin.diku.dk> turin@diku.dk (S|ren Turin) writes:
  13. >Hi netters.
  14. > ...
  15. >
  16. >all    :
  17. >    (for dir in $(DIRS) ; do cd ${dir} ; make VARS=$(VARS) ; done)
  18. >
  19. >The problem is that ${dir} evaluates to "" ($dir evaluates to "ir",
  20. >FYI) so make never descends into any of the relevant subdirectories. 
  21.  
  22. You need to delay the expansion of $dir by prepending a second $.
  23. Try this:
  24.  
  25. all:
  26.     for dir in $(DIRS); do cd $$dir ; ... ; done
  27.                                   ^^
  28.  
  29. make expands $$ to $, and then the shell sees $dir, which it expands
  30. correctly.
  31.  
  32. -r
  33.