Thread View: mot.general
5 messages
5 total messages
Started by Robert Turner
Mon, 12 Nov 1990 23:00
Gnu Make Question
Author: Robert Turner
Date: Mon, 12 Nov 1990 23:00
Date: Mon, 12 Nov 1990 23:00
27 lines
1738 bytes
1738 bytes
I have a gnu make question. Environment: Apollo running BSD4.3, SR10.2. The sources are maintained in RCS. The question is how to get gnu make to check out an include file from RCS, perform the compile and then delete the include file. Sample makefile contains but a single line, below. pgm: pgm.o pgm.h With pgm.c and pgm.h checked into RCS, gnu make checks out pgm.c and pgm.h. Make compiles and links pgm.c to form pgm. Make then deletes pgm.c, but not pgm.h. I have been told that make views pgm.c as a temporary file as make had to "invent" it. Pgm.h on the other hand is explicitly stated so make did not "invent" it, therefore make does not delete it. Is it possible to get make to delete those objects that it checks out instead of deleting only "invented" objects? The above example has all of the files having the same root, "pgm". In the real world, there are several objects and several include files. Robert -- Robert Turner (602) 897-5441 Semiconductor Systems Design Technology, Motorola turner@dover.sps.mot.com OR ...!uunet!dover!turner "Most Americans do not know or appreciate the fact that citizenship is the primary political office under a constitutional government." Mortimer Adler
Re: Gnu Make Question
Author: Don Horr
Date: Tue, 13 Nov 1990 13:39
Date: Tue, 13 Nov 1990 13:39
10 lines
906 bytes
906 bytes
I have found the same thing happening with gnumake. I.e., if it checks a file out, the file is not erased. I just add an "rcsclean" to the make action to clean things up. It removes any files which have been checked out but not modified and leaves the modified files alone. -- Don Horr SSDT Motorola, Inc., Austin TX (donh@victory.sps.mot.com)
Re: Gnu Make Question
Author: Don Horr
Date: Tue, 13 Nov 1990 13:39
Date: Tue, 13 Nov 1990 13:39
11 lines
1062 bytes
1062 bytes
--text follows this line-- I have found the same thing happening with gnumake. I.e., if it checks a file out, the file is not erased. I just add an "rcsclean" to the make action to clean things up. It removes any files which have been checked out but not modified and leaves the modified files alone. -- Don Horr SSDT Motorola, Inc., Austin TX (donh@victory.sps.mot.com)
Re: Gnu Make Question
Author: Alan Bair
Date: Wed, 14 Nov 1990 06:10
Date: Wed, 14 Nov 1990 06:10
39 lines
2229 bytes
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
Re: Gnu Make Question
Author: Alan Bair
Date: Wed, 14 Nov 1990 06:10
Date: Wed, 14 Nov 1990 06:10
40 lines
2231 bytes
2231 bytes
--text follows this line-- 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads