Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.unix.sysv386 Subject: Re: bug in SCO UNIX makefiles ? Message-ID: <1991Jan4.035712.14094@NCoast.ORG> Date: 4 Jan 91 03:57:12 GMT References: <19746@netcom.UUCP> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.unix.sysv386 Organization: North Coast Computer Resources (ncoast) Lines: 46 As quoted from by tim@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@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