Re: patch: make share/mk support for yacc files better behaved
On Sun, 09 Jul 2017 15:38:18 +0200, Marc Espie wrote: > On Sun, Jul 09, 2017 at 07:30:30AM -0600, Todd C. Miller wrote: > > On Sun, 09 Jul 2017 10:40:43 +0200, Marc Espie wrote: > > > > > After a full bulk, no parts of xenocara are affected and just five ports. > > > > Those are all ports that include bsd.*.mk in their Makefiles, right? > > If so, it doesn't seem like a big deal. > > Yep. It's not a big deal. Look at the patches, I often cleaned the Makefile > along to remove extra stuff. OK, that's what I thought. Since we "own" bsd.*.mk there's no reason not to do this. - todd
Re: patch: make share/mk support for yacc files better behaved
On Sun, Jul 09, 2017 at 07:30:30AM -0600, Todd C. Miller wrote: > On Sun, 09 Jul 2017 10:40:43 +0200, Marc Espie wrote: > > > After a full bulk, no parts of xenocara are affected and just five ports. > > Those are all ports that include bsd.*.mk in their Makefiles, right? > If so, it doesn't seem like a big deal. Yep. It's not a big deal. Look at the patches, I often cleaned the Makefile along to remove extra stuff.
Re: patch: make share/mk support for yacc files better behaved
On Sun, 09 Jul 2017 10:40:43 +0200, Marc Espie wrote: > After a full bulk, no parts of xenocara are affected and just five ports. Those are all ports that include bsd.*.mk in their Makefiles, right? If so, it doesn't seem like a big deal. -todd
Re: patch: make share/mk support for yacc files better behaved
On Fri, Jul 07, 2017 at 09:23:30PM +0200, Marc Espie wrote: > This is a collaboration of sort with FreeBSD. > > To me very specific, working on fixing depends made me look at fixing yacc > support, and at the same time, I looked at FreeBSD, and they did this > already (with different code, our share/mk are wildly divergent), so this > comforted me this was doable and probably not too painful. > > So far so good. It has surprisingly little impact on base. > I'm currently building xenocara as well, and intend to put this thru > a ports build as well. > > What this does: > - change the .y -> .c rule for bsd.prog.mk/bsd.lib.mk (thru bsd.sys.mk) > > so that it does .y -> .c/.h, thus changing the name of the generated .h file > > - add an explicit dependency (+ the same rule, more or less) in bsd.dep.mk > so that the .c and .h are tied correctly, and so that the .h is cleaned > as well. > > > What this does not: > - change the default rule in sys.mk for yacc files, because that would break > posix compatibility, and impact way more software we don't have a direct > interest in maintaining. > > Impact: surprisingly few programs. A lot of other stuff actually has ad-hoc > rules that could probably be cleansed afterwards. > > > Considering how much of a headache, having the framework do something sane > by default, even if this involves changing a few files, seems like a good > thing to me... > > After running that build, I think it's reaching the stage where I'm actually > asking for review and okays. > > Index: games/atc/lex.l > === > RCS file: /build/data/openbsd/cvs/src/games/atc/lex.l,v > retrieving revision 1.4 > diff -u -p -r1.4 lex.l > --- games/atc/lex.l 27 Oct 2009 23:59:23 - 1.4 > +++ games/atc/lex.l 7 Jul 2017 11:15:08 - > @@ -43,7 +43,7 @@ > * For more info on this and all of my stuff, mail edja...@berkeley.edu. > */ > > -#include "y.tab.h" > +#include "grammar.h" > > extern int line; > > Index: sbin/wsconsctl/map_scan.l > === > RCS file: /build/data/openbsd/cvs/src/sbin/wsconsctl/map_scan.l,v > retrieving revision 1.6 > diff -u -p -r1.6 map_scan.l > --- sbin/wsconsctl/map_scan.l 19 Nov 2015 19:48:27 - 1.6 > +++ sbin/wsconsctl/map_scan.l 7 Jul 2017 11:05:29 - > @@ -39,7 +39,7 @@ > #include > #include > #include "wsconsctl.h" > -#include "y.tab.h" > +#include "map_parse.h" > > void > map_scan_setinput(char *str) > Index: share/mk/bsd.dep.mk > === > RCS file: /build/data/openbsd/cvs/src/share/mk/bsd.dep.mk,v > retrieving revision 1.20 > diff -u -p -r1.20 bsd.dep.mk > --- share/mk/bsd.dep.mk 5 Jul 2017 13:30:01 - 1.20 > +++ share/mk/bsd.dep.mk 7 Jul 2017 11:04:37 - > @@ -38,6 +38,17 @@ tags: > ${i:R:S/$/.o/} ${i:R:S/$/.po/} ${i:R:S/$/.so/} ${i:R:S/$/.do/}: $i > .endfor > > +# give us better rules for yacc > + > +.if ${YFLAGS:M-d} > +# loop may not trigger > +. for f in ${SRCS:M*.y} > +${f:.y=.c} ${f:.y=.h}: $f > + ${YACC.y} -o ${f:.y=.c} ${.IMPSRC} > +. endfor > +CLEANFILES += ${SRCS:M*.y:.y=.h} > +.endif > + > CLEANFILES += ${DEPS} .depend > > BUILDFIRST ?= > Index: share/mk/bsd.sys.mk > === > RCS file: /build/data/openbsd/cvs/src/share/mk/bsd.sys.mk,v > retrieving revision 1.12 > diff -u -p -r1.12 bsd.sys.mk > --- share/mk/bsd.sys.mk 5 Jul 2017 13:31:40 - 1.12 > +++ share/mk/bsd.sys.mk 7 Jul 2017 10:32:40 - > @@ -10,18 +10,5 @@ CPPFLAGS+= -nostdinc -idirafter ${DESTDI > CXXFLAGS+= -idirafter ${DESTDIR}/usr/include/g++ > .endif > > -.if defined(PARALLEL) > -# Yacc > -.y: > - ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} > - ${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS} > - rm -f ${.TARGET:R}.tab.c > .y.c: > - ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} > - mv ${.TARGET:R}.tab.c ${.TARGET} > -.y.o: > - ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} > - ${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c > - rm -f ${.TARGET:R}.tab.c > - if test -f ${.TARGET:R}.d; then sed -i -e > 's,${.TARGET:R}.tab.c,${.IMPSRC},' ${.TARGET:R}.d; fi > -.endif > + ${YACC.y} -o ${.TARGET} ${.IMPSRC} > Index: usr.bin/m4/Makefile > === > RCS file: /build/data/openbsd/cvs/src/usr.bin/m4/Makefile,v > retrieving revision 1.15 > diff -u -p -r1.15 Makefile > --- usr.bin/m4/Makefile 4 Jul 2017 08:39:57 - 1.15 > +++ usr.bin/m4/Makefile 7 Jul 2017 11:13:24 - > @@ -14,11 +14,4 @@ DPADD= ${LIBM} ${LIBUTIL} > SRCS=eval.c expr.c look.c main.c misc.c gnum4.c trace.c tokenizer.l > parser.y > MAN= m4.1 > > -parser.c parser.h: parser.y > - ${YACC} -o parser.c -d ${.ALLSRC} > - > -tokenizer.o: parser.h > - > -CLEANFILES+=parser.c
patch: make share/mk support for yacc files better behaved
This is a collaboration of sort with FreeBSD. To me very specific, working on fixing depends made me look at fixing yacc support, and at the same time, I looked at FreeBSD, and they did this already (with different code, our share/mk are wildly divergent), so this comforted me this was doable and probably not too painful. So far so good. It has surprisingly little impact on base. I'm currently building xenocara as well, and intend to put this thru a ports build as well. What this does: - change the .y -> .c rule for bsd.prog.mk/bsd.lib.mk (thru bsd.sys.mk) so that it does .y -> .c/.h, thus changing the name of the generated .h file - add an explicit dependency (+ the same rule, more or less) in bsd.dep.mk so that the .c and .h are tied correctly, and so that the .h is cleaned as well. What this does not: - change the default rule in sys.mk for yacc files, because that would break posix compatibility, and impact way more software we don't have a direct interest in maintaining. Impact: surprisingly few programs. A lot of other stuff actually has ad-hoc rules that could probably be cleansed afterwards. Considering how much of a headache, having the framework do something sane by default, even if this involves changing a few files, seems like a good thing to me... After running that build, I think it's reaching the stage where I'm actually asking for review and okays. Index: games/atc/lex.l === RCS file: /build/data/openbsd/cvs/src/games/atc/lex.l,v retrieving revision 1.4 diff -u -p -r1.4 lex.l --- games/atc/lex.l 27 Oct 2009 23:59:23 - 1.4 +++ games/atc/lex.l 7 Jul 2017 11:15:08 - @@ -43,7 +43,7 @@ * For more info on this and all of my stuff, mail edja...@berkeley.edu. */ -#include "y.tab.h" +#include "grammar.h" extern int line; Index: sbin/wsconsctl/map_scan.l === RCS file: /build/data/openbsd/cvs/src/sbin/wsconsctl/map_scan.l,v retrieving revision 1.6 diff -u -p -r1.6 map_scan.l --- sbin/wsconsctl/map_scan.l 19 Nov 2015 19:48:27 - 1.6 +++ sbin/wsconsctl/map_scan.l 7 Jul 2017 11:05:29 - @@ -39,7 +39,7 @@ #include #include #include "wsconsctl.h" -#include "y.tab.h" +#include "map_parse.h" void map_scan_setinput(char *str) Index: share/mk/bsd.dep.mk === RCS file: /build/data/openbsd/cvs/src/share/mk/bsd.dep.mk,v retrieving revision 1.20 diff -u -p -r1.20 bsd.dep.mk --- share/mk/bsd.dep.mk 5 Jul 2017 13:30:01 - 1.20 +++ share/mk/bsd.dep.mk 7 Jul 2017 11:04:37 - @@ -38,6 +38,17 @@ tags: ${i:R:S/$/.o/} ${i:R:S/$/.po/} ${i:R:S/$/.so/} ${i:R:S/$/.do/}: $i .endfor +# give us better rules for yacc + +.if ${YFLAGS:M-d} +# loop may not trigger +. for f in ${SRCS:M*.y} +${f:.y=.c} ${f:.y=.h}: $f + ${YACC.y} -o ${f:.y=.c} ${.IMPSRC} +. endfor +CLEANFILES += ${SRCS:M*.y:.y=.h} +.endif + CLEANFILES += ${DEPS} .depend BUILDFIRST ?= Index: share/mk/bsd.sys.mk === RCS file: /build/data/openbsd/cvs/src/share/mk/bsd.sys.mk,v retrieving revision 1.12 diff -u -p -r1.12 bsd.sys.mk --- share/mk/bsd.sys.mk 5 Jul 2017 13:31:40 - 1.12 +++ share/mk/bsd.sys.mk 7 Jul 2017 10:32:40 - @@ -10,18 +10,5 @@ CPPFLAGS+= -nostdinc -idirafter ${DESTDI CXXFLAGS+= -idirafter ${DESTDIR}/usr/include/g++ .endif -.if defined(PARALLEL) -# Yacc -.y: - ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} - ${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS} - rm -f ${.TARGET:R}.tab.c .y.c: - ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} - mv ${.TARGET:R}.tab.c ${.TARGET} -.y.o: - ${YACC.y} -b ${.TARGET:R} ${.IMPSRC} - ${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c - rm -f ${.TARGET:R}.tab.c - if test -f ${.TARGET:R}.d; then sed -i -e 's,${.TARGET:R}.tab.c,${.IMPSRC},' ${.TARGET:R}.d; fi -.endif + ${YACC.y} -o ${.TARGET} ${.IMPSRC} Index: usr.bin/m4/Makefile === RCS file: /build/data/openbsd/cvs/src/usr.bin/m4/Makefile,v retrieving revision 1.15 diff -u -p -r1.15 Makefile --- usr.bin/m4/Makefile 4 Jul 2017 08:39:57 - 1.15 +++ usr.bin/m4/Makefile 7 Jul 2017 11:13:24 - @@ -14,11 +14,4 @@ DPADD= ${LIBM} ${LIBUTIL} SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c tokenizer.l parser.y MAN= m4.1 -parser.c parser.h: parser.y - ${YACC} -o parser.c -d ${.ALLSRC} - -tokenizer.o: parser.h - -CLEANFILES+=parser.c parser.h tokenizer.o - .include Index: usr.bin/rdist/Makefile === RCS file: /build/data/openbsd/cvs/src/usr.bin/rdist/Makefile,v retrieving revision 1.19 diff -u -p -r1.19 Makefile --- usr.bin/rdist/Makefile 12 Jul 2014 03:32:00 - 1.19 +++ usr.bin/rdist/Makefile