From b32aa918827a9305f276d569cc740a2d6df0c830 Mon Sep 17 00:00:00 2001 From: espie Date: Sun, 9 Jul 2017 14:04:50 +0000 Subject: [PATCH] have bsd.prog.mk/bsd.lib.mk generate .y -> .c/.h rules without intermediate files. This fixes up parallel builds in the default case. FreeBSD does something similar. okay millert@ --- games/atc/lex.l | 4 ++-- sbin/wsconsctl/map_scan.l | 4 ++-- share/mk/bsd.dep.mk | 13 ++++++++++++- share/mk/bsd.sys.mk | 17 ++--------------- usr.bin/m4/Makefile | 9 +-------- usr.bin/rdist/Makefile | 3 +-- usr.bin/rdist/client.c | 4 ++-- usr.bin/rdist/docmd.c | 4 ++-- usr.bin/rdist/rdist.c | 4 ++-- usr.sbin/config/scan.l | 4 ++-- 10 files changed, 28 insertions(+), 38 deletions(-) diff --git a/games/atc/lex.l b/games/atc/lex.l index f1cc2f64e77..655c4bdca3f 100644 --- a/games/atc/lex.l +++ b/games/atc/lex.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: lex.l,v 1.4 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: lex.l,v 1.5 2017/07/09 14:04:50 espie Exp $ */ /* $NetBSD: lex.l,v 1.3 1995/03/21 15:04:15 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ * For more info on this and all of my stuff, mail edjames@berkeley.edu. */ -#include "y.tab.h" +#include "grammar.h" extern int line; diff --git a/sbin/wsconsctl/map_scan.l b/sbin/wsconsctl/map_scan.l index a660b25dd89..40c793a9577 100644 --- a/sbin/wsconsctl/map_scan.l +++ b/sbin/wsconsctl/map_scan.l @@ -1,4 +1,4 @@ -/* $OpenBSD: map_scan.l,v 1.6 2015/11/19 19:48:27 tedu Exp $ */ +/* $OpenBSD: map_scan.l,v 1.7 2017/07/09 14:04:50 espie Exp $ */ /* $NetBSD: map_scan.l 1.1 1998/12/28 14:01:17 hannken Exp $ */ /*- @@ -39,7 +39,7 @@ #include #include #include "wsconsctl.h" -#include "y.tab.h" +#include "map_parse.h" void map_scan_setinput(char *str) diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 60d70e479ed..2cb6959470e 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.dep.mk,v 1.20 2017/07/05 13:30:01 espie Exp $ +# $OpenBSD: bsd.dep.mk,v 1.21 2017/07/09 14:04:50 espie Exp $ # $NetBSD: bsd.dep.mk,v 1.12 1995/09/27 01:15:09 christos Exp $ .if !target(depend) @@ -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 ?= diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index c6be303b5a5..62647237d2b 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.sys.mk,v 1.12 2017/07/05 13:31:40 espie Exp $ +# $OpenBSD: bsd.sys.mk,v 1.13 2017/07/09 14:04:50 espie Exp $ # $NetBSD: bsd.sys.mk,v 1.2 1995/12/13 01:25:07 cgd Exp $ # # Overrides used for OpenBSD source tree builds. @@ -10,18 +10,5 @@ CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include 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} diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index 75e0562a5f9..acef57584f3 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2017/07/04 08:39:57 espie Exp $ +# $OpenBSD: Makefile,v 1.16 2017/07/09 14:04:50 espie Exp $ # -DEXTENDED # if you want the paste & spaste macros. @@ -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 diff --git a/usr.bin/rdist/Makefile b/usr.bin/rdist/Makefile index 19b1dc630b4..b1f2ee3c9a5 100644 --- a/usr.bin/rdist/Makefile +++ b/usr.bin/rdist/Makefile @@ -1,11 +1,10 @@ -# $OpenBSD: Makefile,v 1.19 2014/07/12 03:32:00 guenther Exp $ +# $OpenBSD: Makefile,v 1.20 2017/07/09 14:04:50 espie Exp $ PROG= rdist CFLAGS+=-I. -I${.CURDIR} SRCS= gram.y child.c client.c common.c distopt.c docmd.c expand.c \ isexec.c lookup.c message.c rdist.c -CLEANFILES+=gram.c y.tab.h WARNINGS=yes .include diff --git a/usr.bin/rdist/client.c b/usr.bin/rdist/client.c index a4336e12f85..56a491e798d 100644 --- a/usr.bin/rdist/client.c +++ b/usr.bin/rdist/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.35 2015/12/09 19:39:10 mmcc Exp $ */ +/* $OpenBSD: client.c,v 1.36 2017/07/09 14:04:50 espie Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -39,7 +39,7 @@ #include #include "client.h" -#include "y.tab.h" +#include "gram.h" /* * Routines used in client mode to communicate with remove server. diff --git a/usr.bin/rdist/docmd.c b/usr.bin/rdist/docmd.c index 0e92c7c3ea5..78823092d33 100644 --- a/usr.bin/rdist/docmd.c +++ b/usr.bin/rdist/docmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: docmd.c,v 1.32 2015/01/20 09:00:16 guenther Exp $ */ +/* $OpenBSD: docmd.c,v 1.33 2017/07/09 14:04:50 espie Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -39,7 +39,7 @@ #include #include "client.h" -#include "y.tab.h" +#include "gram.h" /* * Functions for rdist that do command (cmd) related activities. diff --git a/usr.bin/rdist/rdist.c b/usr.bin/rdist/rdist.c index fcdd61b00ed..ffa692b2f82 100644 --- a/usr.bin/rdist/rdist.c +++ b/usr.bin/rdist/rdist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rdist.c,v 1.30 2015/02/08 23:40:34 deraadt Exp $ */ +/* $OpenBSD: rdist.c,v 1.31 2017/07/09 14:04:50 espie Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -38,7 +38,7 @@ #include #include "client.h" -#include "y.tab.h" +#include "gram.h" /* diff --git a/usr.sbin/config/scan.l b/usr.sbin/config/scan.l index 0ccd743f8d4..6768b7c0d5a 100644 --- a/usr.sbin/config/scan.l +++ b/usr.sbin/config/scan.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scan.l,v 1.23 2015/11/19 19:48:27 tedu Exp $ */ +/* $OpenBSD: scan.l,v 1.24 2017/07/09 14:04:50 espie Exp $ */ /* $NetBSD: scan.l,v 1.13 1997/02/02 21:12:37 thorpej Exp $ */ /* @@ -48,7 +48,7 @@ #include #include #include "config.h" -#include "y.tab.h" +#include "gram.h" int yyline; const char *yyfile; -- 2.20.1