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@
This commit is contained in:
espie 2017-07-09 14:04:50 +00:00
parent a81ec8f10f
commit b32aa91882
10 changed files with 28 additions and 38 deletions

View File

@ -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;

View File

@ -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 <limits.h>
#include <err.h>
#include "wsconsctl.h"
#include "y.tab.h"
#include "map_parse.h"
void
map_scan_setinput(char *str)

View File

@ -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 ?=

View File

@ -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}

View File

@ -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 <bsd.prog.mk>

View File

@ -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 <bsd.prog.mk>

View File

@ -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 <unistd.h>
#include "client.h"
#include "y.tab.h"
#include "gram.h"
/*
* Routines used in client mode to communicate with remove server.

View File

@ -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 <unistd.h>
#include "client.h"
#include "y.tab.h"
#include "gram.h"
/*
* Functions for rdist that do command (cmd) related activities.

View File

@ -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 <unistd.h>
#include "client.h"
#include "y.tab.h"
#include "gram.h"
/*

View File

@ -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 <string.h>
#include <unistd.h>
#include "config.h"
#include "y.tab.h"
#include "gram.h"
int yyline;
const char *yyfile;