delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/20/23:15:15

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199605210250.AA110187034@relay1.geis.com>
Date: Tue, 21 May 96 02:45:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: 'make' problem

Reply to message 9139561    from MARTYNAS.KUNI on 05/20/96  7:40AM


>Everything worked ok. But when I renamed all .cc files to .cpp and changed
>all appearances of .cc in the makefile to .cpp (including .cc.o: ), make
>always goes to the link step, even when there are no .o files at all.
>Just now some idea struck me -- this must have something to do with
>.SUFFIXES, but I thought .cpp was confirmed to be a valid C++ source
>file extension, thus make should recognize it. GCC itself recognizes it,
>though dumps .cc extension to cc1plus. Anyway, I'll read more make docs
>and try the .SUFFIXES stuff at home, but right now if the problem is different
>and someone knows the solution, please let me know.

I think you simply need to put this line in the makefile:

.SUFFIXES: .cpp

to add .cpp to make's list of default suffix rules.  If it isn't in there, make
will
take a rule like:

.cpp.o :

as indicating a target of ".cpp.o", instead of the intended expansion.

BTW, if you read up in the make docs, you will see that that form of
declaring an implicit rule is obsolete.  You'd get much more reliable
results from make, and avoid having to alter .SUFFIXES, by using:

%.o : %.cpp

hth,

John

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019