Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Feb 2004 18:22:05 +0200
From:      Ruslan Ermilov <ru@freebsd.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@freebsd.org
Subject:   Re: Very long SRCS list with unusually long src/ prefix
Message-ID:  <20040206162205.GC29305@FreeBSD.org.ua>
In-Reply-To: <20040207023229.L872@gamplex.bde.org>
References:  <20040206012805.N8113@gamplex.bde.org> <20040205151425.GA18523@FreeBSD.org.ua> <20040206030956.F11456@gamplex.bde.org> <20040205.214341.11990356.imp@bsdimp.com> <20040207023229.L872@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Bu8it7iiRSEf40bY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Feb 07, 2004 at 03:07:55AM +1100, Bruce Evans wrote:
> On Thu, 5 Feb 2004, M. Warner Losh wrote:
>=20
> > In message: <20040206030956.F11456@gamplex.bde.org>
> >             Bruce Evans <bde@zeta.org.au> writes:
> > : > > % +	(cd ${.CURDIR}; ${MAKE} _mkdep_cS) | xargs env \
> > : > > % +	    ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
> > : > > % +	    ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*}
> > : > >
> > : > > make uses a real shell, so the env shouldn't be needed.
> > : > >
> > : > $ echo foo.c | xargs CC=3Dcc mkdep
> > : > xargs: CC=3Dcc: No such file or directory
> > :
> > : $ echo foo.c | CC=3Dcc xargs mkdep
> >
> > But MKDEPCMD is 'CC=3Dcc mkdep', so the env is needed...  Unless there's
> > a MKDEPCMD_ENV variable...
>=20
> I missed the mkdep in MKDEPCMD.  MKDEPCMD is actually just mkdep in the
> usual case and "CC=3D'${CC}' mkdep" in the ${CC} !=3D "cc" case.  Putting
> args in the macro for the command is mostly foot shooting here.
> Kernel makefiles handle this better.
>=20
This works slightly better:

%%%
Index: bsd.dep.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/share/mk/bsd.dep.mk,v
retrieving revision 1.45
diff -u -r1.45 bsd.dep.mk
--- bsd.dep.mk	27 Jan 2004 23:22:15 -0000	1.45
+++ bsd.dep.mk	6 Feb 2004 11:53:48 -0000
@@ -19,6 +19,8 @@
 #
 # MKDEPCMD	Makefile dependency list program [mkdep]
 #=20
+# MKDEPENV	Environment for ${MKDEPCMD} [not set]
+#=20
 # SRCS          List of source files (c, c++, assembler)
 #
 # DPSRCS	List of source files which are needed for generating
@@ -49,10 +51,11 @@
 HTAGSFLAGS?=3D
=20
 .if ${CC} !=3D "cc"
-MKDEPCMD?=3D	CC=3D'${CC}' mkdep
+MKDEPENV?=3D	CC=3D'${CC}'
 .else
-MKDEPCMD?=3D	mkdep
+MKDEPENV?=3D
 .endif
+MKDEPCMD?=3D	mkdep
 DEPENDFILE?=3D	.depend
=20
 # Keep `tags' here, before SRCS are mangled below for `depend'.
@@ -126,24 +129,35 @@
 # Different types of sources are compiled with slightly different flags.
 # Split up the sources, and filter out headers and non-applicable flags.
 DPSRCS+=3D ${SRCS}
+
+_mkdep_cS: ${DPSRCS:M*.[cS]:S/^/_mkdep_/}
+_mkdep_cc: ${DPSRCS:M*.cc:S/^/_mkdep_/} ${DPSRCS:M*.C:S/^/_mkdep_/} \
+    ${DPSRCS:M*.cpp:S/^/_mkdep_/} ${DPSRCS:M*.cxx:S/^/_mkdep_/}
+_mkdep_m: ${DPSRCS:M*.m:S/^/_mkdep_/}
+.for f in ${DPSRCS:M*.[cS]} ${DPSRCS:M*.cc} ${DPSRCS:M*.C} ${DPSRCS:M*.cpp=
} \
+    ${DPSRCS:M*.cxx} ${DPSRCS:M*.m}
+_mkdep_${f}: ${f}
+	@echo ${.ALLSRC}
+.endfor
+
 ${DEPENDFILE}: ${DPSRCS}
 	rm -f ${DEPENDFILE}
 .if !empty(DPSRCS:M*.[cS])
-	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
-	    ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} \
-	    ${.ALLSRC:M*.[cS]}
+	(cd ${.CURDIR}; ${MAKE} _mkdep_cS) | ${MKDEPENV} xargs \
+	    ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
+	    ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*}
 .endif
 .if !empty(DPSRCS:M*.cc) || !empty(DPSRCS:M*.C) || !empty(DPSRCS:M*.cpp) |=
| \
     !empty(DPSRCS:M*.cxx)
-	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
-	    ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} \
-	    ${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx}
+	(cd ${.CURDIR}; ${MAKE} _mkdep_cc) | ${MKDEPENV} xargs \
+	    ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
+	    ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*}
 .endif
 .if !empty(DPSRCS:M*.m)
-	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
+	(cd ${.CURDIR}; ${MAKE} _mkdep_m) | ${MKDEPENV} xargs \
+	    ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
 	    ${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} \
-	    ${OBJCFLAGS:M-Wno-import*} \
-	    ${.ALLSRC:M*.m}
+	    ${OBJCFLAGS:M-Wno-import*}
 .endif
 .if target(_EXTRADEPEND)
 _EXTRADEPEND: .USE
%%%

--=20
Ruslan Ermilov
FreeBSD committer
ru@FreeBSD.org

--Bu8it7iiRSEf40bY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAI78tUkv4P6juNwoRAmXMAJ4/2pKjDMDNwIcHTSxsij52y9gUhQCggz94
ukhTpTQepnLQb7asHPcEqjE=
=9AtM
-----END PGP SIGNATURE-----

--Bu8it7iiRSEf40bY--



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