3 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
5 ## Use of this source code is governed by a BSD-style license
6 ## that can be found in the LICENSE file in the root of the source
7 ## tree. An additional intellectual property rights grant can be found
8 ## in the file PATENTS. All contributing project authors may
9 ## be found in the AUTHORS file in the root of the source tree.
15 echo "usage: $self [options] <srcfile>"
17 echo "Generate Makefile dependency information from assembly code source"
22 echo "Unknown option \"$1\"."
23 echo "See $0 --help for available options."
29 --build-pfx=*) pfx
="${optval}"
31 --depfile=*) out
="${optval}"
33 -I*) raw_inc_paths
="${raw_inc_paths} ${opt}"
34 inc_path
="${inc_path} ${opt#-I}"
38 *) [ -f "$opt" ] && srcfile
="$opt"
43 [ -n "$srcfile" ] || show_help
45 includes
=$
(egrep -i "include +\"?+[a-z0-9_/]+\.${sfx}" $srcfile |
46 perl
-p -e "s;.*?([a-z0-9_/]+.${sfx}).*;\1;")
47 #" restore editor state
48 for inc
in ${includes}; do
50 for idir
in ${inc_path}; do
51 [ -f "${idir}/${inc}" ] && found_inc_path="${idir}" && break
53 if [ -f `dirname $srcfile`/$inc ]; then
54 # Handle include files in the same directory as the source
55 $self --build-pfx=$pfx --depfile=$out ${raw_inc_paths} `dirname $srcfile`/$inc
56 elif [ -n "${found_inc_path}" ]; then
57 # Handle include files on the include path
58 $self --build-pfx=$pfx --depfile=$out ${raw_inc_paths} "${found_inc_path}/$inc"
60 # Handle generated includes in the build root (which may not exist yet)
61 echo ${out} ${out%d}o: "${pfx}${inc}"
64 echo ${out} ${out%d}o: $srcfile