Moved lex and yacc source handling from bsd.prog.mk to bsd.dep.mk

so that it applies to libraries (and lkms) as well as programs.
This commit is contained in:
Bruce Evans 1998-05-08 06:31:05 +00:00
parent 184fcab826
commit 29901fcc76
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=35838
2 changed files with 41 additions and 39 deletions

View File

@ -1,4 +1,4 @@
# $Id: bsd.dep.mk,v 1.19 1998/03/23 14:58:26 eivind Exp $
# $Id: bsd.dep.mk,v 1.20 1998/05/06 18:43:58 bde Exp $
#
# The include file <bsd.dep.mk> handles Makefile dependencies.
#
@ -74,6 +74,45 @@ afterdepend:
.endif
.endif
.if defined(SRCS)
CLEANFILES?=
.for _LSRC in ${SRCS:M*.l:N*/*}
.for _LC in ${_LSRC:S/.l/.c/}
${_LC}: ${_LSRC}
${LEX} -t ${LFLAGS} ${.ALLSRC} > ${.TARGET}
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
CLEANFILES:= ${CLEANFILES} ${_LC}
.endfor
.endfor
.for _YSRC in ${SRCS:M*.y:N*/*}
.for _YC in ${_YSRC:S/.y/.c/}
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
CLEANFILES:= ${CLEANFILES} ${_YC}
.if ${YFLAGS:M-d} != "" && ${SRCS:My.tab.h}
.ORDER: ${_YC} y.tab.h
${_YC} y.tab.h: ${_YSRC}
${YACC} ${YFLAGS} ${.ALLSRC}
cp y.tab.c ${_YC}
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
.endif
.if defined(NOTAGS)
tags:
.endif

View File

@ -1,5 +1,5 @@
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $Id: bsd.prog.mk,v 1.70 1998/05/05 03:59:27 bde Exp $
# $Id: bsd.prog.mk,v 1.71 1998/05/06 15:01:18 bde Exp $
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
@ -27,43 +27,6 @@ LDFLAGS+= -static
.if defined(PROG)
.if defined(SRCS)
CLEANFILES?=
.for _LSRC in ${SRCS:M*.l:N*/*}
.for _LC in ${_LSRC:S/.l/.c/}
${_LC}: ${_LSRC}
${LEX} -t ${LFLAGS} ${.ALLSRC} > ${.TARGET}
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
CLEANFILES:= ${CLEANFILES} ${_LC}
.endfor
.endfor
.for _YSRC in ${SRCS:M*.y:N*/*}
.for _YC in ${_YSRC:S/.y/.c/}
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
CLEANFILES:= ${CLEANFILES} ${_YC}
.if ${YFLAGS:M-d} != "" && ${SRCS:My.tab.h}
.ORDER: ${_YC} y.tab.h
${_YC} y.tab.h: ${_YSRC}
${YACC} ${YFLAGS} ${.ALLSRC}
cp y.tab.c ${_YC}
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
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
${PROG}: ${OBJS}