title: Linux kernel makefile cscope target
body: <p>When I generate Linux kernel cscope database by issuing <code>make cscope</code> I get database file along with  a list of files with <strong>relative</strong> path. This is a problem for me because later on when I attach that external kernel's database in vim editor from whatever directory but kernel's I can easily search for specific symbol <strong>BUT</strong> I can't open file that symbol is contained in.</p>
  
  <p>I've written the next bash script</p>
  
  <pre><code>#!/bin/bash
  
  SNAME="$0"
  SNAME=${SNAME##*/}
  
  function usage()
  {
      echo Generate Linux kernel cscope database
      echo "Usage: $SNAME [PATH]"
      echo -n "You must provide this script with an ABSOLUTE path of your "
      echo "kernel's root directory"
  }
  
  if [[ -z "$1" ]]; then
      usage
      exit -1
  fi
  
  KDIR="$1"
  
  echo -n "Collecting a list of files... "
  if find "$KDIR" -path "${KDIR}/arch/*" ! -path "${KDIR}/arch/x86*" -prune -o \
          -path "${KDIR}/include/asm-*" \
          ! -path "${KDIR}/include/asm-generic*" \
          ! -path "${KDIR}/include/asm-x86*" -prune -o \
          -path "${KDIR}/tmp*" -prune -o \
          -path "${KDIR}/Documentation*" -prune -o \
          -path "${KDIR}/scripts*" -prune -o \
          -name "*.[chxsS]" -print &gt; cscope.files; then
      echo done
  else
      echo failed
  fi
  
  echo -n "Building cscope database... "
  cscope -k -qb &amp;&amp; echo done || echo failed
  </code></pre>
  
  <p>that collects all files I need (x86/x86_64 architecture) using <strong>absolute</strong> path and then I successfully build cscope database manually. But I think it must be some easier way to accomplish this. Maybe some Makefile's target like <code>make cscope_abs</code> or <code>make cscope_ext</code> that I have not found yet.</p>
  
  <p>Any suggestions?</p>