Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2017 05:42:27 +0000 (UTC)
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323637 - head/share/mk
Message-ID:  <201709160542.v8G5gROb084552@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sjg
Date: Sat Sep 16 05:42:27 2017
New Revision: 323637
URL: https://svnweb.freebsd.org/changeset/base/323637

Log:
  Use OBJS_SRCS_FILTER to control setting OBJS from SRCS
  
  Some makefiles do reachover builds.
  In some cases it is convenient to list subdirs of the distribution
  in SRCS.
  
  It is not very convenient, or always even desirable to have corresponding
  subdirs in .OBJDIR, so OBJS_SRCS_FILTER allows the makefile to choose.
  The default value 'R' matches existing practice.
  
  But a makefile can set OBJS_SRCS_FILTER= T (the R gets added by
  bsd.init.mk) to avoid the need for subdirs in .OBJDIR
  
  Differential Revision:	https://reviews.freebsd.org/D12218
  Reviewed by:	bdrewery

Modified:
  head/share/mk/bsd.dep.mk
  head/share/mk/bsd.init.mk
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.prog.mk

Modified: head/share/mk/bsd.dep.mk
==============================================================================
--- head/share/mk/bsd.dep.mk	Sat Sep 16 03:54:20 2017	(r323636)
+++ head/share/mk/bsd.dep.mk	Sat Sep 16 05:42:27 2017	(r323637)
@@ -101,7 +101,7 @@ _SKIP_DEPEND=	1
 CLEANFILES?=
 
 .for _S in ${SRCS:N*.[dhly]}
-OBJS_DEPEND_GUESS.${_S:R}.o+=	${_S}
+OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.o+=	${_S}
 .endfor
 
 # Lexical analyzers
@@ -180,7 +180,7 @@ DEPEND_MP?=	-MP
 DEPEND_FILTER=	C,/,_,g
 DEPENDSRCS=	${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
 .if !empty(DEPENDSRCS)
-DEPENDOBJS+=	${DEPENDSRCS:R:S,$,.o,}
+DEPENDOBJS+=	${DEPENDSRCS:${OBJS_SRCS_FILTER:ts:}:S,$,.o,}
 .endif
 DEPENDFILES_OBJS=	${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
 .if defined(_SKIP_DEPEND)

Modified: head/share/mk/bsd.init.mk
==============================================================================
--- head/share/mk/bsd.init.mk	Sat Sep 16 03:54:20 2017	(r323636)
+++ head/share/mk/bsd.init.mk	Sat Sep 16 05:42:27 2017	(r323637)
@@ -16,6 +16,10 @@ __<bsd.init.mk>__:
 .include <bsd.own.mk>
 .MAIN: all
 
+# This is used in bsd.{dep,lib,prog}.mk as ${OBJS_SRCS_FILTER:ts:}
+# Some makefiles may want T as well to avoid nested objdirs.
+OBJS_SRCS_FILTER+= R
+
 # Handle INSTALL_AS_USER here to maximize the chance that
 # it has final authority over fooOWN and fooGRP.
 .if ${MK_INSTALL_AS_USER} != "no"

Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk	Sat Sep 16 03:54:20 2017	(r323636)
+++ head/share/mk/bsd.lib.mk	Sat Sep 16 05:42:27 2017	(r323637)
@@ -168,7 +168,7 @@ LDFLAGS+=	-Wl,--version-script=${VERSION_MAP}
 .endif
 
 .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
-OBJS+=		${SRCS:N*.h:R:S/$/.o/}
+OBJS+=		${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
 CLEANFILES+=	${OBJS} ${STATICOBJS}
 .endif
 
@@ -437,13 +437,13 @@ lint: ${SRCS:M*.c}
 .if defined(LIB) && !empty(LIB)
 OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
 .for _S in ${SRCS:N*.[hly]}
-OBJS_DEPEND_GUESS.${_S:R}.po+=	${_S}
+OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+=	${_S}
 .endfor
 .endif
 .if defined(SHLIB_NAME) || \
     defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
 .for _S in ${SRCS:N*.[hly]}
-OBJS_DEPEND_GUESS.${_S:R}.pico+=	${_S}
+OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+=	${_S}
 .endfor
 .endif
 

Modified: head/share/mk/bsd.prog.mk
==============================================================================
--- head/share/mk/bsd.prog.mk	Sat Sep 16 03:54:20 2017	(r323636)
+++ head/share/mk/bsd.prog.mk	Sat Sep 16 05:42:27 2017	(r323637)
@@ -85,7 +85,7 @@ PROGNAME?=	${PROG}
 
 .if defined(SRCS)
 
-OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
+OBJS+=  ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/g}
 
 .if target(beforelinking)
 beforelinking: ${OBJS}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709160542.v8G5gROb084552>