home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!think.com!enterpoop.mit.edu!bloom-picayune.mit.edu!news.mit.edu!jdell
- From: jdell@nefertiti.mit.edu (John Ellithorpe)
- Subject: Re: easy make question
- In-Reply-To: sct@crayfish.dsto.gov.au's message of 22 Jan 93 13:21:42 CST
- Message-ID: <JDELL.93Jan23121414@nefertiti.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: nefertiti.mit.edu
- Organization: Massachusetts Institute of Technology
- References: <1993Jan22.132144.165613@dstos3.dsto.gov.au>
- Date: Sat, 23 Jan 1993 17:14:14 GMT
- Lines: 49
-
- On 22 Jan 93 13:21:42 CST, sct@crayfish.dsto.gov.au (Sean Troedson) said:
- > Nntp-Posting-Host: crayfish.dsto.gov.au
-
- > has anyone used the wild card "%" in make? According to the man page you
- > can use it in a target or dependency as in ...
-
- > all: %.o
-
- > file1.o:
- > file2.o:
-
- > but "make all" spits the dummy with "don't know how to make target `%.o'".
- > I am using SunOs 4.1.2.
-
- Usually you would make the executables not the object files, but anyway if you
- need to have more than one dependency then just list them, you don't need to
- use a wildcard
-
- all: file1.o file2.o
-
- file1.o: ...
- file2.o: ...
-
- My typical setup for a makefile for a program is:
-
- CC=gcc
- CFLAGS=-O
-
- PROGRAM=myprog
- OBJS=obj1.o obj2.o ...
- HDRS=hdr1.h hdr2.h ...
- LIBS=-llib1 -llib2 ...
-
- $(PROGRAM) : $(OBJS)
- $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
-
- $(OBJS) : $(HDRS)
-
- Hope this helps,
-
- John
- --
-
- ===============================================================================
- John Ellithorpe | Internet: jdell@maggie.mit.edu
- Dept. of Physics, Rm 26-349 | Phone : (617) 253-3074 Office
- Massachusetts Institute of Technology | (617) 253-3072 Lab
- Cambridge, MA 02139 | (617) 236-4910 Home
- ===============================================================================
-