help - makefile keeps removing a file automatically.

help - makefile keeps removing a file automatically.

Post by Ed Wheelhou » Thu, 08 Nov 2001 02:13:05



Please help me!
I have a problem with a makefile and RCS. I have the following rules:

.
.
.
.
chap1.f : chap1.N
           $(COMMAND) chap1.N

chap1.N : chap1.N,v
           co -l chap1.N
.
.
.
.
This should check chap1.N out of RCS if is not already checked out and
available. It does this correctly.
However, once the rest of the makefile has been executed the chap1.N
file is removed automatically if, and only if, it was checked out of
RCS by the makefile. There is no rm command in the makefile and I
don't want it to be removed.

I would really appreciate knowing why it does this and whether there
is any way of stopping it?

 
 
 

help - makefile keeps removing a file automatically.

Post by John Gord » Thu, 08 Nov 2001 02:29:18



> chap1.f : chap1.N
>            $(COMMAND) chap1.N
> chap1.N : chap1.N,v
>            co -l chap1.N

> This should check chap1.N out of RCS if is not already checked out and
> available. It does this correctly.
> However, once the rest of the makefile has been executed the chap1.N
> file is removed automatically if, and only if, it was checked out of
> RCS by the makefile. There is no rm command in the makefile and I
> don't want it to be removed.

make isn't removing the file.  something else must be.  i'm not
familiar with RCS, perhaps the "co -l chap1.N" command is removing
the file?

---
"... What with you being his parents and all, I think that you could
be trusted not to shaft him."  -- Robert Chang, rec.games.board



 
 
 

help - makefile keeps removing a file automatically.

Post by Paul D. Smit » Thu, 08 Nov 2001 03:00:34



  ew> I have a problem with a makefile and RCS. I have the following rules:

  ew> chap1.f : chap1.N
  ew>            $(COMMAND) chap1.N

  ew> chap1.N : chap1.N,v
  ew>            co -l chap1.N

No you don't.

The behavior you're seeing can't happen with the above makefile, unless
you're using a whacked version of make.  I suspect you're using GNU
make, which is most definitely not whacked (at least not in this respect
:).

It's not a good idea to provide examples which you haven't tested to be
sure they actually exhibit the behavior you're seeing--it's usually more
confusing than no example at all.

I'm sure that in your real makefile, you are not using an explicit rule
for the RCS co command, but are rather relying on implicit (pattern)
rules.  Further, I'm sure that your rule to build the .f file from the
.N file is _also_ an implicit rule, not explicit as you show above.

  ew> This should check chap1.N out of RCS if is not already checked out and
  ew> available. It does this correctly.

  ew> However, once the rest of the makefile has been executed the chap1.N
  ew> file is removed automatically if, and only if, it was checked out of
  ew> RCS by the makefile. There is no rm command in the makefile and I
  ew> don't want it to be removed.

  ew> I would really appreciate knowing why it does this and whether there
  ew> is any way of stopping it?

Look up "intermediate files" in the index of the GNU make manual; this
behavior is described in the chapter "Chains of Implicit Rules".  All
will be revealed...

--
-------------------------------------------------------------------------------

 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

 
 
 

help - makefile keeps removing a file automatically.

Post by Alan Cliffor » Thu, 08 Nov 2001 05:23:21



EW> Please help me!
EW> I have a problem with a makefile and RCS. I have the following rules:
EW>

EW>
EW> I would really appreciate knowing why it does this and whether there
EW> is any way of stopping it?
EW>

On my Linux system, make appears to understand RCS.  So if I delete the
source file and then run make, make takes it out of my RCS/ directory and
compiles it.  But it takes it out of the repository using the equivalent
of co -u filename.c

Alan

(If replying by mail, change scatology to AC2)

 
 
 

help - makefile keeps removing a file automatically.

Post by Chuck Dillo » Fri, 09 Nov 2001 01:04:00



> I would really appreciate knowing why it does this and whether there
> is any way of stopping it?

First there are a lot of different implementation of make and a lot of vendor
specific behaviors.

Generally I would expect that your make has some implicit rules/behavior with
regards to RCS (GNU make for example). The implicit rules apparently are
considering the .N file as an intermediate and removing it to leave the state
of your directory the same as it found it.

RTFM for make and look for the .PRECIOUS target, which you can probably use to
tell make that you want the .N files.  Also, consider whether you need your RCS
tarket.

-- ced

--
Chuck Dillon
Senior Software Engineer
Accelrys Inc., a subsidiary of Pharmacopeia, Inc.

 
 
 

1. How can I remove the first 6 lines of a text file and keep the rest?

Hello All :)
I'm no shell wizard (obvious?)

I need to process x number of text files, all with a .txt extention, and
remove only the first 6 lines of the file and print the rest of the file to
the original filename. It seems like something this simple would have
already been written, does anyone know of a script that will do this, or
could possibly write one? I would be highly grateful :)

Please cc replies to:

so that I can be sure to get it.

Thanks, In Advance,

Clayton Dukes

2. Solstice - Disk Errors

3. Removing funny files (Re: how do i remove a file with a ~ in it ????)

4. adduser command

5. Linux Sysadmin Type Questions

6. Can't remove a file called "---remove-files"

7. config option for irq_balance()

8. Help on keeping Netscape honest on UNIX (remove cookies, cache, etc.)

9. How to determine automatically in makefile the cpu target

10. Automatically generate makefiles?

11. Automatically creating packages (Makefile or scripts)

12. How to keep PPP link up automatically