Subject: kern/17384: cscope & mkid kernel make targets fail for compile outside /sys
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 06/25/2002 21:07:41
>Number:         17384
>Category:       kern
>Synopsis:       cscope & mkid kernel make targets fail for compile outside /sys
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 25 07:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Robert Elz
>Release:        NetBSD 1.6B  (-current 2002-06-25)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD delta.cs.mu.OZ.AU 1.5ZC NetBSD 1.5ZC (DELTA) #4: Mon May 27 23:17:55 ICT 2002 kre@delta.cs.mu.OZ.AU:/usr/src/sys.X/arch/i386/compile/DELTA i386
Architecture: i386
Machine: i386
>Description:
	The kernel build setup allows placing a kernel config file
	in /sys/arch/xxxx/conf/MYNAME with the corresponding kernel
	being build in /sys/arch/xxx/compile/MYNAME/.

	For that (I assume) the cscope & mkid targets work.

	The kernel build setup also allows placing a kernel config
	file in /any/where/at/all/CONFIG with the build being done
	in the same directory.

	In that case, the cscope & mkid targets fail (or more accurately,
	produce error messages and don't include everything)

>How-To-Repeat:
	mkdir /tmp/foobar
	cp /sys/arch/i386/conf/GENERIC /tmp/foobar/CONFIG
	cd /tmp/foobar
	config -s /sys -b /tmp/foobar
	make cscope

		[Aside: that isn't exactly the way I run it, so I have
		no guarantee that will reproduce the problem, though
		it should I think].

>Fix:
	The problem is that with this setup, the "make sourcefiles"
	that the cscope and mkid targets run in tgh elib & compat
	directories produce full path names, rather than relative
	ones (ie: /sys/... - more likely /usr/src/sys/... but that
	doesn't matter).

	The make variable substitution
		${LIBKERNSRC:S|^|${KERNDST}/|}
	where LIBKERNSRC contains full path names, makes a mess...

	I changed it to
		${LIBKERNSRC:C|^[^/]|${KERNDST}/&|}

	with the corresponding change for LIBCOMPATSRC of course, all
	duplicated for cscope & mkid, and it all seemed to work for me
	after that.   Whether it still works with a "conventional" kernel
	compile, I don't know (I like to keep my source trees pure, makes
	building source tarballs easier).
>Release-Note:
>Audit-Trail:
>Unformatted: