Subject: Re: bsd.*.mk: ".cpp" not recognized as C++?
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
From: Frederick Bruckman <fb@enteract.com>
List: tech-toolchain
Date: 11/13/1999 06:00:23
On Sat, 13 Nov 1999, Hauke Fath wrote:

> while trying to build IBM's open-source Java compiler "jikes" on NetBSD, I
> found that BSD make does not recognize the wintel style C++ file extension
> "*.cpp" for a C++ source file. While I would not debate that .C looks much
> nicer ;) there are a lot of C++ sources with wintel origin  out there.
> 
> Would we want to add this, or is there any easy way of teaching the make
> system about equivalences ("treat .cpp like .C)?

As easy as this (follows). Alternatively, you could add ``.SUFFIXES: .cpp'',
followed by the rules, anywhere in the "jikes" Makefile.

Index: sys.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/sys.mk,v
retrieving revision 1.54
diff -c -r1.54 sys.mk
*** sys.mk	1999/03/10 14:06:14	1.54
--- sys.mk	1999/11/13 11:53:56
***************
*** 3,9 ****
  
  unix?=		We run NetBSD.
  
! .SUFFIXES: .out .a .ln .o .s .S .c .cc .C .F .f .r .y .l .cl .p .h .sh .m4
  
  .LIBS:		.a
  
--- 3,9 ----
  
  unix?=		We run NetBSD.
  
! .SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .C .F .f .r .y .l .cl .p .h .sh .m4
  
  .LIBS:		.a
  
***************
*** 106,111 ****
--- 106,120 ----
  .cc.o:
  	${COMPILE.cc} ${.IMPSRC}
  .cc.a:
+ 	${COMPILE.cc} ${.IMPSRC}
+ 	${AR} ${ARFLAGS} $@ $*.o
+ 	rm -f $*.o
+ 
+ .cpp:
+ 	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
+ .cpp.o:
+ 	${COMPILE.cc} ${.IMPSRC}
+ .cpp.a:
  	${COMPILE.cc} ${.IMPSRC}
  	${AR} ${ARFLAGS} $@ $*.o
  	rm -f $*.o