home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15896 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.5 KB  |  49 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!sangam!cmie!rs
  3. From: rs@cmie.ernet.in (Rajappa Iyer)
  4. Subject: Re: easy make question
  5. Message-ID: <C1CunH.1MG@cmie.ernet.in>
  6. Organization: Centre for Monitoring Indian Economy, Bombay
  7. References: <1993Jan22.132144.165613@dstos3.dsto.gov.au> <JDELL.93Jan23121414@nefertiti.mit.edu>
  8. Date: Sun, 24 Jan 1993 11:02:04 GMT
  9. Lines: 38
  10.  
  11. jdell@nefertiti.mit.edu (John Ellithorpe) writes:
  12.  
  13. >On 22 Jan 93 13:21:42 CST, sct@crayfish.dsto.gov.au (Sean Troedson) said:
  14.  
  15. >> has anyone used the wild card "%" in make? According to the man page you
  16. >> can use it in a target or dependency as in ...
  17.  
  18. >> all: %.o
  19.  
  20. >> file1.o:
  21. >> file2.o:
  22.  
  23. >> but "make all" spits the dummy with "don't know how to make target `%.o'".
  24.  
  25. `%' is not really a "wild-card" in the shell sense--it cannot be
  26. evaluated independently. From the manual: "... matches any string of
  27. zero or more characters in a target name or dependency in the target
  28. portion of a conditional macro definition, or within a pattern
  29. replacement macro reference."
  30.  
  31. Perhaps the examples below will help clarify the same:
  32.  
  33. SRCS=filea.c fileb.c
  34. OBJS=$(SRCS:%.c=%.o)
  35.  
  36. OBJS will now expand to "filea.o fileb.o"
  37.  
  38. Take another example:
  39.  
  40. % : RCS/%,v
  41.     $(CO) $(COFLAGS) $<
  42.  
  43. Which says the any file, say, "filea.c" depends on "RCS/filea.c,v" and
  44. the command to extract it is "$(CO) $(COFLAGS) RCS/filea.c,v" (of
  45. course, with $(CO) and $(COFLAGS) replaced by their definitions.)
  46. -- 
  47. Rajappa Iyer            rs@cmie.ernet.in (Preferred)
  48.                 riyer@shakti.ncst.ernet.in
  49.