🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.misc
Article #429

Re: gnu make & RCS question

#429
From: 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?
Technical Details
Message-ID: <7c39bi$oal@news.rsc.raytheon.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7bcq1a$ja6@news.rsc.raytheon.com> <p5k8ws319l.fsf@baynetworks.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109f73,5151d4f27c5a166e
X-Google-Attributes: gid109f73,public
X-Google-Thread: 100159,5151d4f27c5a166e
X-Google-Attributes: gid100159,public
From: georgek@iluvatar.rsc.raytheon.com
Subject: Re: gnu make & RCS question
Date: 1999/03/09
Message-ID: <7c39bi$oal@news.rsc.raytheon.com>
X-Deja-AN: 452975876
References: <7bcq1a$ja6@news.rsc.raytheon.com> <p5k8ws319l.fsf@baynetworks.com>
Organization: Raytheon Systems Company
Reply-To: georgek@iluvatar.rsc.raytheon.com
Newsgroups: comp.sys.sgi.misc,gnu.utils.help
Originator: georgek@iluvatar.rsc.raytheon.com