summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-05-06 15:01:18 +0000
committerbde <bde@FreeBSD.org>1998-05-06 15:01:18 +0000
commite6e7e77dcf340d3d5bcbf02362cbf5bd79d9e0d0 (patch)
tree7b1cbf00ffd6998293ffb63034588885ad4a33d6 /share
parent216aef2a426d62fec9a5f1b5dd37097707d9792f (diff)
downloadFreeBSD-src-e6e7e77dcf340d3d5bcbf02362cbf5bd79d9e0d0.zip
FreeBSD-src-e6e7e77dcf340d3d5bcbf02362cbf5bd79d9e0d0.tar.gz
Regress to generating foo.c from foo.y via y.tab.c for crufty applications
that want a y.tab.h file. This want must be specified by putting y.tab.h in SRCS (and defaulting to or putting -d in YFLAGS). This only works if there is only one yacc parser, of course. One improvement: copy y.tab.c to foo.c instead of renaming it, so that `#line...y.tab.c' statements in it refer to an existing file. Regress to not generating explicit rules for .l and .y sources containing slashes. This case is unusual and hard to handle properly. Don't generate an unused dependency when -d is not in YFLAGS.
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.prog.mk32
1 files changed, 20 insertions, 12 deletions
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index ff96a3a..62cc324 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.69 1998/05/04 17:43:46 bde Exp $
+# $Id: bsd.prog.mk,v 1.70 1998/05/05 03:59:27 bde Exp $
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
@@ -29,7 +29,7 @@ LDFLAGS+= -static
CLEANFILES?=
-.for _LSRC in ${SRCS:M*.l}
+.for _LSRC in ${SRCS:M*.l:N*/*}
.for _LC in ${_LSRC:S/.l/.c/}
${_LC}: ${_LSRC}
${LEX} -t ${LFLAGS} ${.ALLSRC} > ${.TARGET}
@@ -38,21 +38,29 @@ CLEANFILES:= ${CLEANFILES} ${_LC}
.endfor
.endfor
-.for _YSRC in ${SRCS:M*.y}
+.for _YSRC in ${SRCS:M*.y:N*/*}
.for _YC in ${_YSRC:S/.y/.c/}
-.for _YH in ${_YSRC:S/.y/.h/}
-.ORDER: ${_YC} ${_YH}
-${_YC} ${_YH}: ${_YSRC}
- ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
CLEANFILES:= ${CLEANFILES} ${_YC}
-.if ${YFLAGS:M-d} != ""
-y.tab.h: ${_YH}
- ln -sf ${_YH} ${.TARGET}
+.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} ${_YH} y.tab.h
-.endif
+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
OpenPOWER on IntegriCloud