help-make
[Top][All Lists]
Advanced

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

implicit rules for .cpp suffix


From: Martin Sebor
Subject: implicit rules for .cpp suffix
Date: Thu, 29 Sep 2005 19:34:56 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050716

In my makefile make sometimes invokes an implicit rule for a file with
the .cpp suffix, even though I have an explicit suffix rule defined for
.cpp and the .cpp suffix is not listed in the Catalogue of Implicit
Rules here:
http://www.gnu.org/software/make/manual/html_mono/make.html#SEC105

This doesn't appear to happen for all my .cpp files, just some of them.
Even worse, the rule make uses is %: %.cpp which doesn't work with the
way I set things up.

I have two questions:

1. Is the .cpp suffix on the default suffix list? (If so, is it a known
   documentation bug that it's not listed?)
2. What could be causing make to prefer the implicit suffix rule over
   an explicitly defined one for some files and not for others?

Thanks
Martin

PS My rules are here (I have no %: %.cpp rule):

%.o: %.cpp
        $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< $(TEEOPTS)

%: %.o
        $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(TEEOPTS)

And the make -d output for an example file that exhibits this behavior
is here:
...
Updating goal targets....
Considering target file `t'.
 File `t' does not exist.
 Looking for an implicit rule for `t'.
 Trying pattern rule with stem `t'.
 Trying implicit prerequisite `t.o'.
 Trying pattern rule with stem `t'.
 Trying implicit prerequisite `t.cpp'.
 Found an implicit rule for `t'.
  Considering target file `t.cpp'.
   Looking for an implicit rule for `t.cpp'.
   Trying pattern rule with stem `t.cpp'.
   Trying implicit prerequisite `t.cpp,v'.
   Trying pattern rule with stem `t.cpp'.
   Trying implicit prerequisite `RCS/t.cpp,v'.
   Trying pattern rule with stem `t.cpp'.
   Trying implicit prerequisite `RCS/t.cpp'.
   Trying pattern rule with stem `t.cpp'.
   Trying implicit prerequisite `s.t.cpp'.
   Trying pattern rule with stem `t.cpp'.
   Trying implicit prerequisite `SCCS/s.t.cpp'.
   No implicit rule found for `t.cpp'.
   Finished prerequisites of target file `t.cpp'.
  No need to remake target `t.cpp'.
 Finished prerequisites of target file `t'.
Must remake target `t'.




reply via email to

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