summaryrefslogtreecommitdiff
path: root/build-0.3/c/intel/dep
blob: ead761f3950e21ca7aff374e89c5f9a9e5fa784f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /usr/bin/env bash

# file      : build/c/intel/dep
# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC
# license   : GNU GPL v2; see accompanying LICENSE file

# Post-process generated dependency information.
#
# $1       current project's $(out_base)
# $2 - $N  optional .cpp-options files

out_base=$1
shift

files=$*

#echo $out_base
#echo $files

script=

function gen_script ()
{
  while [ "$1" ]; do
    prefix=$1
    shift

    path=$1
    shift

    # Besides unresolved paths also replace default installation
    # targets (/usr/include and /usr/local/include).
    #
    script="$script"\
"s \\ $prefix \\ $path$prefix g;"\
"s \\ /usr/include/$prefix \\ $path$prefix g;"\
"s \\ /usr/local/include/$prefix \\ $path$prefix g;"\
"s ^$prefix $path$prefix ;"\
"s ^/usr/include/$prefix $path$prefix ;"\
"s ^/usr/local/include/$prefix $path$prefix ;"
  done
}

if [ "$files" ]; then
  prefixes=`sed -e 's%^prefix: \(.*\)$%\1%' -e t -e d $files`
  gen_script $prefixes
fi

# The last part of the script translates all file names that don't start
# with / or . (that is, local generated files) to files in $out_base. Note
# that it is assumed that such files are never installed and therefore there
# is no way to get around the situation where this file is picket up from
# some other place (e.g., /usr/include).
#
epilogue="s% \([^/. \\\\]\)% $out_base/\1%g;s%^\([^/. ].*:\)%$out_base/\1%"

exec sed -e "$script$epilogue"