Date: Thu, 11 Jun 1998 20:56:42 +1000 From: Bruce Evans <bde@zeta.org.au> To: bde@zeta.org.au, ianh@tortuga.com.au Cc: current@FreeBSD.ORG Subject: Re: src Makefile fix Message-ID: <199806111056.UAA03420@godzilla.zeta.org.au>
index | next in thread | raw e-mail
>> It would be better to make lex not depend on yacc -o (as it used to).
>>
>Perhaps a conditional dependence on "yacc -o". I'd like to be able to
>build -current of 2.2.5, or whatever release I have installed on my main
>machine. The included patch will require users of older systems to modify
>/etc/make.conf, while letting the the newer system continue as now.
>
>The problem is that it is ugly, and as time goes on, will become a barnacle
>that needs to be removed.
This makes the extra build step look non-ugly :-).
>ndex: bsd.dep.mk
>===================================================================
>RCS file: /home/freebsd/cvs/src/share/mk/bsd.dep.mk,v
>retrieving revision 1.25
>diff -c -r1.25 bsd.dep.mk
>*** bsd.dep.mk 1998/06/05 18:38:54 1.25
>--- bsd.dep.mk 1998/06/11 09:16:34
>***************
>*** 55,70 ****
> SRCS:= ${SRCS} y.tab.h
> CLEANFILES:= ${CLEANFILES} y.tab.c y.tab.h
> .elif ${YFLAGS:M-d} != ""
> .for _YH in ${_YC:S/.c/.h/}
> .ORDER: ${_YC} ${_YH}
> ${_YC} ${_YH}: ${_YSRC}
>! ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
> SRCS:= ${SRCS} ${_YH}
> CLEANFILES:= ${CLEANFILES} ${_YH}
> .endfor
> .else
> ${_YC}: ${_YSRC}
>! ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
> .endif
> .endfor
> .endfor
>--- 55,78 ----
> SRCS:= ${SRCS} y.tab.h
> CLEANFILES:= ${CLEANFILES} y.tab.c y.tab.h
> .elif ${YFLAGS:M-d} != ""
>+ YACCOPY ?= no
>+ .if ${YACCOPY} == no
>+ _YO_OPT = -o ${_YC}
>+ _YO_MV =
>+ .else
>+ _YO_OPT =
>+ _YO_MV = mv y.tab.c ${_YC}
>+ .endif
> .for _YH in ${_YC:S/.c/.h/}
> .ORDER: ${_YC} ${_YH}
> ${_YC} ${_YH}: ${_YSRC}
>! ${YACC} ${YFLAGS} ${_YO_OPT} ${.ALLSRC}; ${_YO_MV}
> SRCS:= ${SRCS} ${_YH}
> CLEANFILES:= ${CLEANFILES} ${_YH}
> .endfor
> .else
> ${_YC}: ${_YSRC}
>! ${YACC} ${YFLAGS} ${_YO_OPT} ${.ALLSRC}; ${_YO_MV}
> .endif
> .endfor
> .endfor
>
I don't see how this actually works - it doesn't rename y.tab.h. This
slightly broken version can be achieved using existing compatibility cruft
(y.tab.h in SRCS) instead of YACCOPY. -o is not used when the applcation
wants y.tab.h instead of foo.h created from foo.y since foo.h might
(and in practice, does) conflict with a source file. lex/Makefile can
explot this and rename (actually, copy) y.tab.h itself:
diff -c2 Makefile~ Makefile
*** Makefile~ Tue May 5 05:10:20 1998
--- Makefile Thu Jun 11 20:36:09 1998
***************
*** 15,20 ****
LINKS+= ${BINDIR}/lex ${BINDIR}/flex++
! SRCS= scan.c ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.y \
! skel.c sym.c tblcmp.c yylex.c
LFLAGS+= -is
CFLAGS+= -I. -I${.CURDIR}
--- 15,20 ----
LINKS+= ${BINDIR}/lex ${BINDIR}/flex++
! SRCS= scan.c ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.h \
! parse.y skel.c sym.c tblcmp.c y.tab.h yylex.c
LFLAGS+= -is
CFLAGS+= -I. -I${.CURDIR}
***************
*** 24,28 ****
MLINKS+= lex.1 lex++.1
! CLEANFILES= scan.c
.if !defined(NOLIB)
--- 24,31 ----
MLINKS+= lex.1 lex++.1
! CLEANFILES= parse.h scan.c
!
! parse.h: y.tab.h
! cp ${.ALLSRC} ${.TARGET}
.if !defined(NOLIB)
Bruce
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806111056.UAA03420>
