From 29901fcc760af5da084dd481d6bd48ee2366e9e5 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Fri, 8 May 1998 06:31:05 +0000 Subject: [PATCH] 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. --- share/mk/bsd.dep.mk | 41 ++++++++++++++++++++++++++++++++++++++++- share/mk/bsd.prog.mk | 39 +-------------------------------------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 040f14b4558b..b98666e5a727 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -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 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 diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 62cc324e2bee..12b380ea6b1d 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -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}