Subject: toolchain/33835: cscope targets don't build on fc 5 crossbuild
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Bucky Katz <bucky@picovex.com>
List: netbsd-bugs
Date: 06/27/2006 00:10:00
>Number:         33835
>Category:       toolchain
>Synopsis:       cscope targets don't build on fc 5 crossbuild
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 27 00:10:00 +0000 2006
>Originator:     Bucky Katz
>Release:        NetBSD 3.99.20
>Organization:
picovex
>Environment:
Linux Crossdevelopment on Fedora Core 5
>Description:
        cscope targets don't build on fc 5 crossbuild
        the cscope.files target relies on tr commands that don't execute
        properly on the fedora core 5 version of tr

>How-To-Repeat:
	checkout the NetBSD 3.0 current tree
        try to make cscope.files.
>Fix:
Index: netbsd_quilt/src/sys/conf/Makefile.kern.inc
===================================================================
--- netbsd_quilt.orig/src/sys/conf/Makefile.kern.inc
+++ netbsd_quilt/src/sys/conf/Makefile.kern.inc
@@ -388,21 +388,29 @@
 	@echo "see $S/kern/Makefile for tags"
 .endif
 
-EXTRA_CLEAN+= cscope.out cscope.tmp
-.if !target(cscope.out)
-cscope.out: Makefile depend
+EXTRA_CLEAN+= cscope.files cscope.out cscope.tmp
+.if !target(cscope.files)
+cscope.files: Makefile depend
 	${_MKTARGET_CREATE}
 	@sed 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend | \
-	tr -s ' ' '\n' | sed 's|^\([^.\\]\)|lib/kern/\1|;s|^../../||;' > \
-	cscope.tmp
+	tr -s ' ' '\n' | sed 's|^../../||;' > cscope.tmp
 	@sed 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend | \
-	tr -s ' ' '\n' | sed 's|^\([^.\\]\)|lib/compat/\1|;s|^../../||;' >> \
-	cscope.tmp
-	@echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \
-	${CSCOPE} -k -i - -b `echo ${INCLUDES} | sed s/-nostdinc//`
+	tr -s ' ' '\n' | sed 's|^../../||;' >> cscope.tmp
+	@sed 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' .depend | \
+	tr -s ' ' '\n' | sed 's|^../../||;' >> cscope.tmp
+	@echo ${SRCS} >> cscope.tmp
+	@echo ${INCLUDES} | sed s/-nostdinc// >> cscope.tmp
+	@echo "-k" > cscope.files
+	@cat cscope.tmp | tr -s ' ' '\n' | sort -u >> cscope.files
+	@rm cscope.tmp
+.endif
+
+.if !target(cscope.out)
+cscope.out: cscope.files
+	${CSCOPE} -b
 #	cscope doesn't write cscope.out if it's uptodate, so ensure
 #	make doesn't keep calling cscope when not needed.
-	@rm -f cscope.tmp; touch cscope.out
+	@touch cscope.out
 .endif
 
 .if !target(cscope)