🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mot.general
Article #3

Re: Gnu Make Question

#3
From: Alan Bair
Date: Wed, 14 Nov 1990 06:10
39 lines
2229 bytes
With any Make program, if you use the default rules, like Robert is in his
example, you have to except what the builtin action does.  One fix is what
Don suggested, add to the actions performed for the target.  A more general 
fix, is to define your own actions to perform for a rule. Here is what I 
believe the default rules to be (the make man page tells how to get the 
whole list):

.c~.o:
	$(GET) $(GFLAGS) -p $< > $*.c
	$(CC) $(CFLAGS) -c $*.c
	-rm -f $*.c

Which when make finds a file needs to be checked out (thats what the ~ means),
it does a get, compiles it, then erases the checked out file.

.h~.h:
	$(GET) $(GFLAGS) -p $< > $*.h

This is what make uses to checkout the required .h file.  There is also a
similar one for .c files.

Now, if we were to assume that you want to erase any files that are checked
out, which means they are younger than the target, the following new rule
for building .o files from .c files may work.

.c.o:
	cc $(CFLAGS) -c $<
	rm $?

This says that .o files depend on .c files and the dependent .c file, $<,
is compiled and then any dependent files younger than the target, $?, are
to be erased.  This will use the default rules to checkout .c and .h files.
I haven't tested this, just wrote it from memory and a peek at the man page,
so it could be wrong.  However, I think it will provide some ideas to try.

--
Alan Bair                 SSDT (formerly SPS CAD)
Motorola, Inc.            Logic Simulation & Test
Austin, Texas             abair@turbinia.sps.mot.com
Technical Details
Message-ID: <ABAIR.90Nov14001003@turbinia.sps.mot.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!mips!pacbell.com!att!emory!ra!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!motbos!motaus!oakhill!abair
References: <2455@dover.sps.mot.com> <DONH.90Nov13073924@victory.oakhill.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!mips!pacbell.com!att!emory!ra!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!motbos!motaus!oakhill!abair
From: abair@turbinia.sps.mot.com (Alan Bair)
Newsgroups: mot.general,comp.sys.apollo,gnu.emacs.help
Subject: Re: Gnu Make Question
Message-ID: <ABAIR.90Nov14001003@turbinia.sps.mot.com>
Date: 14 Nov 90 06:10:03 GMT
References: <2455@dover.sps.mot.com> <DONH.90Nov13073924@victory.oakhill.uucp>
Sender: news@oakhill.UUCP
Distribution: na
Organization: SSDT, Motorola Inc., Austin, Texas.
Lines: 39
In-reply-to: donh@victory.oakhill.uucp's message of 13 Nov 90 13:39:24 GMT