🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.sgi.misc
5 messages
5 total messages Started by georgek Mon, 01 Mar 1999 00:00
gnu make & RCS question
#432
Author: georgek
Date: Mon, 01 Mar 1999 00:00
75 lines
2330 bytes
Hi Folks,

  I'm using gnu make 3.77 on an SGI system. I'm trying to interface it
with RCS. I've already got it to check out files that are in the 
local RCS directory, but am having a hard time getting it to delete
some of them once they're done. I can get gmake to check out *.c and
*.h files and delete the *.c files once it's done with them, but I 
can't get it to delete the *.h files when it's done. I'm guessing that
having the *.h files listed in the dependencies is somehow keeping the
*.h files from being considered intermediate files like the .c files.

  My goal is to have make delete any files it had to check out: regardless
of whether they were *.c or *.h.

Any suggestions?

thnx,

gpk


              -------------- example Makefile -------------

# Make.depend is just the standard dependencies file generated by the
# compiler.

MKDEPFILE = Make.depend
MKDEPOPT   = -MDupdate $(MKDEPFILE)

TARGET = ground_motion

INCDIR = ${INCLUDE}
MSGDIR = ${MSET}
LIBDIR = ${LIB}
BINDIR = ${BIN}

# source, header, and RCS files live one level up from this Makefile

VPATH = ..

SRCS =  collisions.c \
        vehicle.c

OBJS = $(SRCS:.c=.o)

LLIBS = libquery.a libtransforms.a 

CFLAGS  = -fullwarn -xansi -c -O -I.. -I${INCDIR} -I${MSGDIR} $(MKDEPOPT) 

LDFLAGS = # -g -s 
LIBS =  -lm 


all:  $(TARGET)

$(TARGET): ${OBJS} ${LLIBS}
	cc $(LDFLAGS) $(OBJS) -o $@  $(LLIBS) $(LIBS)

.c.o:
	cc $(CFLAGS) $<

install : ${BINDIR}/${TARGET}

${BINDIR}/${TARGET} : ${TARGET}
	rm -f ${BINDIR}/${TARGET}
	cp ${TARGET} ${BINDIR}

clean :
        -rm -f *.o core a.out $(TARGET) *~* *.bak 

cleandepends:
	 rm -f $(MKDEPFILE)
	touch $(MKDEPFILE)

include $(MKDEPFILE)
Re: gnu make & RCS question
#428
Author: Paul D. Smith
Date: Mon, 08 Mar 1999 00:00
34 lines
2577 bytes
%% georgek@iluvatar.rsc.raytheon.com writes:

  g>   I'm using gnu make 3.77 on an SGI system. I'm trying to interface
  g> it with RCS. I've already got it to check out files that are in the
  g> local RCS directory, but am having a hard time getting it to delete
  g> some of them once they're done. I can get gmake to check out *.c
  g> and *.h files and delete the *.c files once it's done with them,
  g> but I can't get it to delete the *.h files when it's done. I'm
  g> guessing that having the *.h files listed in the dependencies is
  g> somehow keeping the *.h files from being considered intermediate
  g> files like the .c files.

Exactly correct.  See the GNU make manual chapter on Implicit Rules,
under the section Chains of Implicit Rules, to learn about intermediate
files.  Make will delete any intermediate files it created during the
build.  Also, that section will describe what constitutes an
intermediate file, and that a file mentioned in the makefile, even as a
dependency, will disqualify it as an intermediate file.

Finally, it will describe the .INTERMEDIATE special target and how to
use it to convince make that something is an intermediate file even if
it is explicitly mentioned.

Also, there are references to this in the manual indices under both
"intermediate files" and "removal of target files", etc.

Have fun!

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
Re: gnu make & RCS question
#429
Author: georgek
Date: Tue, 09 Mar 1999 00:00
184 lines
5186 bytes
In article <p5k8ws319l.fsf@baynetworks.com>,
Paul D. Smith <psmith@baynetworks.com> wrote:
>%% georgek@iluvatar.rsc.raytheon.com writes:
>
[details of problem snipped..]
>  g> some of them once they're done. I can get gmake to check out *.c
>  g> and *.h files and delete the *.c files once it's done with them,
>  g> but I can't get it to delete the *.h files when it's done. I'm
>  g> guessing that having the *.h files listed in the dependencies is
>  g> somehow keeping the *.h files from being considered intermediate
>  g> files like the .c files.
>
>Exactly correct.  See the GNU make manual chapter on Implicit Rules,
>under the section Chains of Implicit Rules, to learn about intermediate

[useful comments snipped...]

Hi Paul,

   Thanks for your response.

   I read the manual (you mean the "info" pages, right?) and I'm still
missing something. It might be easier to discuss this in context of an
example (see example files appended). The effect I'm trying for is to
have gnu make delete the files that it checked out of RCS: not ones
that already existed. Unfortunately, the .INTERMEDIATE target will
cause the file to be treated as intermediate (and deleted) regardless
of whether make checked it out or just found it there. (Which is
close, but not quite what I'm after.)

  The example that follows is a small Makefile for a linux system. I get
the same behavior on linux as sgi. In this example I'm trying to
treat the *.c and *.h files symmetrically (as far as naming them as
dependencies to the final program) but I can't get make to treat them
symmetrically: *.c files get removed, *.h files get left behind. So
can you tell me what I'm missing?

(Note: since I'm cutting and pasting the tabs in the Makefile will
 probably get turned back into spaces.)

Thanks!

gpk
                ------------------------------

   In the example that follows I have:

$ ls -lR
total 3
-rw-rw-r--   1 gpk      gpk           590 Mar  5 13:39 Makefile
drwxrwxr-x   2 gpk      gpk          1024 Feb 27 09:21 RCS
drwxrwxr-x   2 gpk      gpk          1024 Feb 27 08:48 bin

RCS:
total 3
-r--r--r--   1 gpk      gpk           289 Feb 27 09:05 code.c,v
-r--r--r--   1 gpk      gpk           532 Feb 27 09:21 code.d,v
-r--r--r--   1 gpk      gpk           202 Feb 27 09:05 code.h,v

bin:
total 0

          Invoking make...

$ make
co  RCS/code.h,v code.h
RCS/code.h,v  -->  code.h
revision 1.1
done
co  RCS/code.c,v code.c
RCS/code.c,v  -->  code.c
revision 1.1
done
cc -Wall -ansi -c -I..  -MD  code.c
cc  code.o  -o hello
rm code.c

  So code.c gets removed, but not code.h leaving:

Makefile  RCS       bin       code.d    code.h   code.o    hello


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

Makefile contains:


SHELL= /bin/csh

MKDEPFILE = Make.depend
MKDEPOPT   = -MD


TARGET = hello


BINDIR = bin

VPATH = ..

SRCS =  code.c
HDRS = code.h

OBJS = $(SRCS:.c=.o)


CFLAGS  = -Wall -ansi -c -I..  $(MKDEPOPT) #  -g

LDFLAGS = # -g -s
LIBS =  -lc


all:  $(TARGET)

$(TARGET): ${OBJS}
        cc $(LDFLAGS) $(OBJS) -o $@

.c.o:
        cc $(CFLAGS) $<

$(OBJS): $(HDRS)

install : ${BINDIR}/${TARGET}

${BINDIR}/${TARGET} : ${TARGET}
        rm -f ${BINDIR}/${TARGET}
        cp ${TARGET} ${BINDIR}


clean :
        -rm -f *.o core a.out $(TARGET) *~* *.bak

cleandepends: clean
        rm -f $(MKDEPFILE)
        touch  $(MKDEPFILE)

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


code.c contains:

#include <stdio.h>

#include "code.h"


int main (void)
{
 fprintf(stderr, "hello %s", HELLO);
 return (0);
}



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

code.h contains:

#define HELLO "hello"


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

code.d contains:


code.o: code.c /usr/include/stdio.h /usr/include/libio.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/gnu/stubs.h /usr/include/_G_config.h \
 /usr/include/gnu/types.h \
 /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/include/stddef.h \
 /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/include/stdarg.h \
 /usr/include/stdio_lim.h code.h

(standard one generated by the compiler)

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

 I get the same behavior if I use the code.d file that's generated on
 linux or if I use the Make.depend file that's generated on SGI Irix
 6.5 in place of explicitly naming the header file in the Makefile
 proper.

 What am I missing?
Re: gnu make & RCS question
#430
Author: Paul D. Smith
Date: Fri, 12 Mar 1999 00:00
34 lines
2502 bytes
%% georgek@iluvatar.rsc.raytheon.com writes:

  g>    I read the manual (you mean the "info" pages, right?)

Yes.  Well, of course the original is the make.texinfo file, and texinfo
can be turned into many different output formats, including PostScript
and HTML, in addition to "info", but... yes :).

  g> and I'm still missing something. It might be easier to discuss this
  g> in context of an example (see example files appended). The effect
  g> I'm trying for is to have gnu make delete the files that it checked
  g> out of RCS: not ones that already existed. Unfortunately, the
  g> .INTERMEDIATE target will cause the file to be treated as
  g> intermediate (and deleted) regardless of whether make checked it
  g> out or just found it there.

Ouch.  You're right.

This is a bug in GNU make.  It seems that when the .SECONDARY feature
was added in GNU make 3.75 it broke a lot of the functionality of
.INTERMEDIATE (and .SECONDARY didn't work correctly either).  Oddly
enough, no one's noticed them before now.

I've so far fixed two .INTERMEDIATE/.SECONDARY bugs for the next release
of GNU make; this will make a third (once I fix it ;).  Sigh.

Well, you could drop back to GNU make 3.74 :-/.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
Re: gnu make & RCS question
#431
Author: Paul D. Smith
Date: Mon, 15 Mar 1999 00:00
28 lines
2247 bytes
%% georgek@iluvatar.rsc.raytheon.com writes:

  g>    I read the manual (you mean the "info" pages, right?) and I'm still
  g> missing something. It might be easier to discuss this in context of an
  g> example (see example files appended). The effect I'm trying for is to
  g> have gnu make delete the files that it checked out of RCS: not ones
  g> that already existed. Unfortunately, the .INTERMEDIATE target will
  g> cause the file to be treated as intermediate (and deleted) regardless
  g> of whether make checked it out or just found it there. (Which is
  g> close, but not quite what I'm after.)

Previously I wrote that this worked correctly in GNU make 3.74 and was
since broken: that's completely untrue.

In 3.74, neither the .INTERMEDIATE nor .SECONDARY special targets
existed :-/.  Oh well.

Rather irksome that these aren't listed in the NEWS file for 3.75, where
they appear to have been introduced, but there you go.

So, I can only conclude they _never_ worked correctly :).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
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