help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

phony targets and dependency files (*.d)


From: Alan Fitch
Subject: phony targets and dependency files (*.d)
Date: Tue, 6 Nov 2001 14:12:44 +0000

Dear Help-make, 
              I've got a make file which uses phony targets, and the
dependency creating files as described in info make.

Here is the file, it contains a Makefile, which includes a
Makefile.defs, as well as the dependency (*.d) files.

The problem is that the phony target ultraclean, always insists on
creating the *.d files if they don't exist.

I'm using gnu make 3.78.1 on Redhat 6.2 and Solaris 2.7 (behaviour is
the same on both operating systems).

In other words, if I say

make
make clean
make clean

it's fine, but if I say

make
make ultraclean
make ultraclean

it insists on re-creating the *.d files and then deleting them on the
second run of make ultraclean.

kind regards

Alan

(P.S. Some lines have got wrapped below)



Here's the makefile
===================

EXTRACFLAGS =
EXTRA_LIBS =
MODULE = run
SRCS = ram.cpp sorter.cpp main.cpp
 
OBJS = $(SRCS:.cpp=.o)
 
include ../Makefile.defs



Here's ../Makefile.defs
=======================

SYSTEMC = /apps/systemc

CC     = g++
OPT    = -O0
DEBUG  = -g

SYSDIR = -I$(SYSTEMC)/include -I$(SYSTEMC)/src

INCDIR = -I. -I.. $(SYSDIR)
LIBDIR = -L. -L.. -L$(SYSTEMC)/lib-$(TARGET_ARCH)


## Build with maximum gcc warning level
CFLAGS = -Wall $(DEBUG) $(OPT) $(EXTRACFLAGS)

LIBS   =  -lsystemc -lstdc++ -lm $(EXTRA_LIBS)

EXE    = $(MODULE).x

.SUFFIXES: .cc .cpp .o .x .d

.PHONY: clean ultraclean

%.d:%.cpp
        set -e; $(CC) $(CFLAGS) $(INCDIR)  -MM $< \
                                        | sed 's/\($*\)\.o[ :]*/\1.o $@
: /g' >
$@; \
                                        [ -s $@ ] || rm -f $@
 
$(EXE): $(OBJS) $(SYSTEMC)/lib-$(TARGET_ARCH)/libsystemc.a
        $(CC) $(CFLAGS) $(INCDIR) $(LIBDIR) -o $@ $(OBJS) $(LIBS) 2>&1 |
c++filt 
.cpp.o:
        $(CC) $(CFLAGS) $(INCDIR)  -c $<
 
.cc.o:
        $(CC) $(CFLAGS) $(INCDIR)  -c $<
 
clean:
        rm -f $(OBJS) *~ $(EXE) *.vcd *.wif *.isdb *.dmp
 
ultraclean: clean
        rm -f *.d
 
include $(SRCS:.cpp=.d)  
-- 
Alan Fitch
DOULOS Ltd.
Church Hatch, 22 Market Place, Ringwood, Hampshire BH24 1AW, United Kingdom
Tel: +44 1425 471223                           Email: address@hidden
Fax: +44 1425 471573                             Web: http://www.doulos.com

                   **********************************
                   **  Developing design know-how  **
                   **********************************

This e-mail and any  attachments are  confidential and Doulos Ltd. reserves
all rights of privilege in  respect thereof. It is intended for the  use of
the addressee only. If you are not the intended  recipient please delete it
from  your  system, any  use, disclosure, or copying  of this  document  is
unauthorised. The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.











reply via email to

[Prev in Thread] Current Thread [Next in Thread]