diff --git a/sys/compat/common/Makefile b/sys/compat/common/Makefile index 3bd05b01b8ae..7a8cddc5de2c 100644 --- a/sys/compat/common/Makefile +++ b/sys/compat/common/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.28 2002/04/29 09:53:39 mrg Exp $ +# $NetBSD: Makefile,v 1.29 2002/06/18 23:46:53 wrstuden Exp $ LIB= compat NOPIC= # defined @@ -46,3 +46,6 @@ libinstall:: .include .undef DESTDIR .include + +showsources: ${SRCS} + @echo ${.ALLSRC} diff --git a/sys/conf/Makefile.kern.inc b/sys/conf/Makefile.kern.inc index 54ba628db787..3946bb676603 100644 --- a/sys/conf/Makefile.kern.inc +++ b/sys/conf/Makefile.kern.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.kern.inc,v 1.16 2002/06/17 20:31:26 wrstuden Exp $ +# $NetBSD: Makefile.kern.inc,v 1.17 2002/06/18 23:46:52 wrstuden Exp $ # # This file contains common `MI' targets and definitions and it is included # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}. There are @@ -286,10 +286,26 @@ tags: EXTRA_CLEAN+= cscope.out .if !target(cscope.out) +# +# This target is tricky. We want to include source files from the different +# kernel libraries in the output, but to get them requires calling +# make in those directories. We'd rather not call make in those directories +# if we don't have to, so we make cscope.out in two steps. +# The first step calls make on this makefile to evaluate the second +# make target. It *also* passes ` ` evaluated variables on the command +# line to the second make. These ` ` evaluated variables run make in +# the library directories, and thus provide the sources from the libs. +# cscope.out: Makefile @echo Building cscope.out source database - @echo ${SRCS} | ${CSCOPE} -k -i - -b \ - `echo ${INCLUDES} | sed s/-nostdinc//` + @${MAKE} LIBKERNSRC="`${KERNMAKE} showsources`" \ + LIBCOMPATSRC="`${COMPATMAKE} showsources`" cscope.out1 + +.PHONY: cscope.out1 +cscope.out1: + @echo ${SRCS} ${LIBKERNSRC:S|^|${KERNDST}/|} \ + ${LIBCOMPATSRC:S|^|${COMPATDST}/|} \ + | ${CSCOPE} -k -i - -b `echo ${INCLUDES} | sed s/-nostdinc//` # cscope doesn't write cscope.out if it's uptodate, so ensure # make doesn't keep calling cscope when not needed. @touch cscope.out @@ -305,9 +321,20 @@ EXTRA_CLEAN+= ID .PHONY: mkid mkid: ID -ID: Makefile +ID: Makefile depend +# Same dance as cscope.out/cscope.out1 @echo Building mkid database - @${MKID} ${SRCS} + @${MAKE} LIBKERNSRC="`${KERNMAKE} showsources`" \ + LIBCOMPATSRC="`${COMPATMAKE} showsources`" \ + LIBKERNDEPEND="`sed 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' lib/kern//.depend | tr ' ' '\n' | sort -u`" \ + LIBCOMPDEPEND="`sed 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' lib/compat/.depend | tr ' ' '\n' | sort -u`" ID1 + +.PHONY: ID1 +ID1: + @${MKID} ${SRCS} ${LIBKERNSRC:S|^|${KERNDST}/|} \ + ${LIBCOMPATSRC:S|^|${COMPATDST}/|} \ + ${LIBKERNDEPEND:S|^../../||} ${LIBCOMPDEPEND:S|^../../||} \ + `sed 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' .depend | tr ' ' '\n' | sort -u` .endif ## diff --git a/sys/lib/libkern/Makefile b/sys/lib/libkern/Makefile index a41d7e5c47b2..463fd2ba1144 100644 --- a/sys/lib/libkern/Makefile +++ b/sys/lib/libkern/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.64 2002/05/28 10:09:24 itojun Exp $ +# $NetBSD: Makefile,v 1.65 2002/06/18 23:46:53 wrstuden Exp $ LIB= kern NOPIC= # defined @@ -89,3 +89,6 @@ lib${LIB}.po:: ${POBJS} @echo building profiled ${LIB} library @rm -f lib${LIB}.po @${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}` + +showsources: ${SRCS} + @echo ${.ALLSRC}