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

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!think.com!enterpoop.mit.edu!bloom-picayune.mit.edu!news.mit.edu!jdell
  3. From: jdell@nefertiti.mit.edu (John Ellithorpe)
  4. Subject: Re: easy make question
  5. In-Reply-To: sct@crayfish.dsto.gov.au's message of 22 Jan 93 13:21:42 CST
  6. Message-ID: <JDELL.93Jan23121414@nefertiti.mit.edu>
  7. Sender: news@athena.mit.edu (News system)
  8. Nntp-Posting-Host: nefertiti.mit.edu
  9. Organization: Massachusetts Institute of Technology
  10. References: <1993Jan22.132144.165613@dstos3.dsto.gov.au>
  11. Date: Sat, 23 Jan 1993 17:14:14 GMT
  12. Lines: 49
  13.  
  14. On 22 Jan 93 13:21:42 CST, sct@crayfish.dsto.gov.au (Sean Troedson) said:
  15. > Nntp-Posting-Host: crayfish.dsto.gov.au
  16.  
  17. > has anyone used the wild card "%" in make? According to the man page you
  18. > can use it in a target or dependency as in ...
  19.  
  20. > all: %.o
  21.  
  22. > file1.o:
  23. > file2.o:
  24.  
  25. > but "make all" spits the dummy with "don't know how to make target `%.o'".
  26. > I am using SunOs 4.1.2.
  27.  
  28. Usually you would make the executables not the object files, but anyway if you
  29. need to have more than one dependency then just list them, you don't need to
  30. use a wildcard
  31.  
  32.     all: file1.o file2.o
  33.  
  34.     file1.o: ...
  35.     file2.o: ...
  36.  
  37. My typical setup for a makefile for a program is:
  38.  
  39.     CC=gcc
  40.     CFLAGS=-O
  41.  
  42.     PROGRAM=myprog
  43.     OBJS=obj1.o obj2.o ...
  44.     HDRS=hdr1.h hdr2.h ...
  45.     LIBS=-llib1 -llib2 ...
  46.  
  47.     $(PROGRAM) : $(OBJS)
  48.         $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
  49.  
  50.     $(OBJS) : $(HDRS)
  51.  
  52. Hope this helps,
  53.  
  54. John
  55. --
  56.  
  57. ===============================================================================
  58. John Ellithorpe                           | Internet: jdell@maggie.mit.edu
  59. Dept. of Physics, Rm 26-349               | Phone   : (617) 253-3074  Office
  60. Massachusetts Institute of Technology     |           (617) 253-3072  Lab
  61. Cambridge, MA  02139                      |           (617) 236-4910  Home
  62. ===============================================================================
  63.