Very long SRCS list with unusually long src/ prefix
Ruslan Ermilov
ru at freebsd.org
Fri Feb 6 08:21:59 PST 2004
On Sat, Feb 07, 2004 at 03:07:55AM +1100, Bruce Evans wrote:
> On Thu, 5 Feb 2004, M. Warner Losh wrote:
>
> > In message: <20040206030956.F11456 at gamplex.bde.org>
> > Bruce Evans <bde at 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=cc mkdep
> > : > xargs: CC=cc: No such file or directory
> > :
> > : $ echo foo.c | CC=cc xargs mkdep
> >
> > But MKDEPCMD is 'CC=cc mkdep', so the env is needed... Unless there's
> > a MKDEPCMD_ENV variable...
>
> I missed the mkdep in MKDEPCMD. MKDEPCMD is actually just mkdep in the
> usual case and "CC='${CC}' mkdep" in the ${CC} != "cc" case. Putting
> args in the macro for the command is mostly foot shooting here.
> Kernel makefiles handle this better.
>
This works slightly better:
%%%
Index: bsd.dep.mk
===================================================================
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]
#
+# MKDEPENV Environment for ${MKDEPCMD} [not set]
+#
# SRCS List of source files (c, c++, assembler)
#
# DPSRCS List of source files which are needed for generating
@@ -49,10 +51,11 @@
HTAGSFLAGS?=
.if ${CC} != "cc"
-MKDEPCMD?= CC='${CC}' mkdep
+MKDEPENV?= CC='${CC}'
.else
-MKDEPCMD?= mkdep
+MKDEPENV?=
.endif
+MKDEPCMD?= mkdep
DEPENDFILE?= .depend
# 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+= ${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
%%%
--
Ruslan Ermilov
FreeBSD committer
ru at FreeBSD.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040206/c9855da2/attachment.bin
More information about the freebsd-current
mailing list