delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/31/22:00:06

From: Jerzy Klejnowski <dziabol AT polbox DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Make, suffix rules and pattern rules.
Date: Wed, 01 Nov 2000 04:25:53 +0100
Organization: samotnik w swoim zamku
Lines: 44
Message-ID: <39FF8D41.BB16E9F6@polbox.com>
NNTP-Posting-Host: pc47.wroclaw.ppp.tpnet.pl
Mime-Version: 1.0
X-Trace: news.tpi.pl 973045557 12979 212.160.40.47 (1 Nov 2000 02:25:57 GMT)
X-Complaints-To: usenet AT tpi DOT pl
NNTP-Posting-Date: 1 Nov 2000 02:25:57 GMT
X-Mailer: Mozilla 4.07 [en] (X11; I; Linux 2.0.36 i686)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi!

Maybe I don't understand 'make' documentation, but some things
I've tried seems to behave opposite to what I've read in it.

The documentation says:
   "Suffix rules cannot have any prerequisites of their own.  If they
have any, they are treated as normal files with funny names, not as
suffix rules."
And below that doc shows an example for '%.o: %.c foo.h' pattern rule
"which tells how to make `.o' files from `.c' files, and makes all `.o'
files using this pattern rule also depend on `foo.h'."

But pattern rule does not work for me, while suffix rule does...
Here's part of my makefile:

--<begin>--
SHELL = bash
CFLAGS = -many -many -options
.SUFFIXES :
.SUFFIXES : .o .c .h

{various rules}
       @echo $<
        @$(CC) -c $(CFLAGS) $< -o $@
--<end>--

The results are:

  {various rules}          what 'make' does
  ------------------       -----------------
1  %.o : %.c                uses my rule
2  %.o : %.c header.h       uses predefined rule
3  .c.o :                   uses my rule
4  .c.o :  header.h         uses my rule

Can anybody explain it? Did I misunderstand the docs?

Thanks in advance.

  HARY


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019