bug in SCO UNIX makefiles ?

Brandon S. Allbery KB8JRR allbery at NCoast.ORG
Fri Jan 4 14:57:12 AEST 1991


As quoted from <tim.662894618 at holly> by tim at delluk.uucp (Tim Wright):
+---------------
| Suffixes have to be declared with ".SUFFIXES" before you can use them i.e.
| you need a line of the form
| .SUFFIXES: .cc .hh
| before you can setup rules of the above form. I don't why this strangeness
| is in Sys V but it is !
+---------------

When I responded to him (via mail) I explained not only what but what I
suspect is why.  Maybe the why needs to be aired more publicly....

The problem with make recognizing suffix rules on its own is that it won't do
the right thing with "dot-files".  I've seen Makefiles that, for example,
eschew the "all" rule (where "all" isn't a file, it's just used as a rule
name) in favor of an actual file name that gets "touch"ed when everything is
up to date --- and use a file like ".all" to do it.  (Actually, there is an
"all" rule:

	all: .all

I've never needed that kind of hack --- but I have needed another hack that
used .-files to track update times of archive entries in archive formats make
knows nothing about (ACMB, anyone?).)

If make grabs anything starting with a dot as a suffix rule, then you can't
"make" a file starting with a dot.  If it requires two dots, the problem is
lessened at the expense of suffix rules like:

	.c:
		$(CC) $(CFLAGS) -o $* $<

It can, of course, intuit the proper behavior by checking for a file with the
right name --- but then someone else can break that, either unintentionally or
maliciously, by saying "cp /dev/null .c.o".  The .SUFFIXES target lets you be
more explicit about how to recognize suffix rules without having to explicitly
define individual suffix rules as such (".SUFFIXRULE: .c.o" would be safest,
but much more of a pain than just specifying the list of suffixes and then
combining them as desired).

++Brandon
-- 
Me: Brandon S. Allbery			    VHF/UHF: KB8JRR on 220, 2m, 440
Internet: allbery at NCoast.ORG		    Packet: KB8JRR @ WA8BXN
America OnLine: KB8JRR			    AMPR: KB8JRR.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery    Delphi: ALLBERY



More information about the Comp.unix.sysv386 mailing list