Subject: bin/7293: flex++ makefile support
To: None <gnats-bugs@gnats.netbsd.org>
From: Patrick Welche,SCC,ext.35710, <prlw1@newn.cam.ac.uk>
List: netbsd-bugs
Date: 03/30/1999 18:29:47
>Number:         7293
>Category:       bin
>Synopsis:       flex++ makefile support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 30 09:35:01 1999
>Last-Modified:
>Originator:     Patrick Welche
>Organization:
	
>Release:        Mon Mar 29 14:02:07 1999
>Environment:
System: NetBSD 1.3K/i386


>Description:
Just thought it would be nice to able to have a makefile containing eg.

PROG=   pms
SRCS=   scan.ll
LDADD+= -lstdc++ -ll
.include <bsd.prog.mk>

to generate a c++ scanner.
1) Who knows whethere ll is a good choice of suffix?
2) I am not sure how to test it thoroughly.
3) Who knows whether it is worth having?
All I can say, is it seems to work, though due to a ?deficiency? in
?src/usr.bin/lex/flex.skl?, I do need to include
static void *yy_flex_realloc( void *ptr, yy_size_t size );
static void yy_flex_free( void *ptr );
static void *yy_flex_alloc( yy_size_t size );
in the .ll file, but that's a different problem.
>How-To-Repeat:
	
>Fix:
*** /usr/share/mk/sys.mk.orig	Tue Mar 30 17:33:43 1999
--- /usr/share/mk/sys.mk	Tue Mar 30 17:41:21 1999
***************
*** 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 .C .F .f .r .y .l .ll .cl .p .h .sh .m4
  
  .LIBS:		.a
  
***************
*** 61,66 ****
--- 61,69 ----
  LFLAGS?=
  LEX.l?=		${LEX} ${LFLAGS}
  
+ LEXXX?=		flex++
+ LEXXX.ll?=	${LEXXX} ${LFLAGS}
+ 
  LD?=		ld
  LDFLAGS?=
  
***************
*** 187,192 ****
--- 190,207 ----
  	${LEX.l} ${.IMPSRC}
  	${COMPILE.c} -o ${.TARGET} lex.yy.c 
  	rm -f lex.yy.c
+ 
+ # Flex++
+ .ll:	${LEXXX.ll} ${.IMPSRC}
+ 	${LINK.c} -o ${.TARGET} lex.yy.cc ${LDLIBS} -ll
+ 	rm -f lex.yy.cc
+ .ll.cc:
+ 	${LEXXX.ll} ${.IMPSRC}
+ 	mv lex.yy.cc ${.TARGET}
+ .ll.o:
+ 	${LEXXX.ll} ${.IMPSRC}
+ 	${COMPILE.cc} -o ${.TARGET} lex.yy.cc
+ 	rm -f lex.yy.cc
  
  # Yacc
  .y:
>Audit-Trail:
>Unformatted: