From 52a0f10607b46afbff06e71b025e0b4f089fc92b Mon Sep 17 00:00:00 2001 From: espie Date: Tue, 4 Jul 2017 00:59:11 +0000 Subject: [PATCH] let BUILDFIRST just build first, using the same trick guenther@ did in kernel Makefiles (thank you!), also add lex and yacc generated files to that list. Let those lex/yacc variables be defined for bsd.lib.mk as well. Complete the SRCS -> OBJS hints with the library dependency This should fix most dependency problems. Commit now, so that people can check if something else is still amiss. krw@ agrees --- share/mk/bsd.dep.mk | 14 ++++++++++---- share/mk/bsd.lib.mk | 9 +++++++-- share/mk/bsd.prog.mk | 6 +++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 43774cc8650..14ab062d025 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.dep.mk,v 1.18 2017/07/03 15:11:02 espie Exp $ +# $OpenBSD: bsd.dep.mk,v 1.19 2017/07/04 00:59:11 espie Exp $ # $NetBSD: bsd.dep.mk,v 1.12 1995/09/27 01:15:09 christos Exp $ .if !target(depend) @@ -31,12 +31,18 @@ tags: # explicitly tag most source files .for i in ${SRCS:N*.[hyl]:N*.sh} ${_LEXINTM} ${_YACCINTM} -${i:R:S/$/.o/}: $i +# assume libraries +${i:R:S/$/.o/} ${i:R:S/$/.po/} ${i:R:S/$/.so/} ${i:R:S/$/.do/}: $i .endfor CLEANFILES += ${DEPS} .depend + BUILDFIRST ?= BUILDAFTER ?= -.if !empty(BUILDFIRST) && !empty(BUILDAFTER) -${BUILDAFTER}: ${BUILDFIRST} +.if !empty(BUILDAFTER) +. for i in ${BUILDFIRST} ${_LEXINTM} ${_YACCINTM} +. if !exists($i) +${BUILDAFTER}: $i +. endif +. endfor .endif diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index d75c3d32146..b09ae64f225 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.lib.mk,v 1.86 2017/07/02 17:55:14 espie Exp $ +# $OpenBSD: bsd.lib.mk,v 1.87 2017/07/04 00:59:11 espie Exp $ # $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft Exp $ # @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 @@ -183,6 +183,10 @@ BUILDAFTER += ${_LIBS} OBJS+= ${SRCS:N*.h:R:S/$/.o/} DEPS+= ${OBJS:R:S/$/.d/} + +_LEXINTM?=${SRCS:M*.l:.l=.c} +_YACCINTM?=${SRCS:M*.y:.y=.c} + BUILDAFTER += ${OBJS} lib${LIB}.a: ${OBJS} @@ -245,7 +249,8 @@ ${DIST_LIB}: ${SELECTED_DOBJS} .if !target(clean) clean: _SUBDIRUSE - rm -f a.out [Ee]rrs mklog *.core ${CLEANFILES} + rm -f a.out [Ee]rrs mklog *.core y.tab.h \ + ${_LEXINTM} ${_YACCINTM} ${CLEANFILES} rm -f lib${LIB}.a ${OBJS} rm -f lib${LIB}_g.a ${GOBJS} rm -f lib${LIB}_p.a ${POBJS} diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index c86512e4409..bf852c2c62f 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.prog.mk,v 1.72 2017/07/01 14:41:54 espie Exp $ +# $OpenBSD: bsd.prog.mk,v 1.73 2017/07/04 00:59:11 espie Exp $ # $NetBSD: bsd.prog.mk,v 1.55 1996/04/08 21:19:26 jtc Exp $ # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 @@ -74,8 +74,8 @@ SRCS?= ${PROG}.c OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/} DEPS+= ${OBJS:R:S/$/.d/} -_LEXINTM+=${SRCS:M*.l:.l=.c} -_YACCINTM+=${SRCS:M*.y:.y=.c} +_LEXINTM?=${SRCS:M*.l:.l=.c} +_YACCINTM?=${SRCS:M*.y:.y=.c} . endif . if defined(OBJS) && !empty(OBJS) -- 2.20.1