Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 76 lines (65 sloc) 2.225 kb
693180c Small speedup
Sascha Schumann authored
1 # +----------------------------------------------------------------------+
ccfc46b - Happy new year and PHP 5 for rest of the files too..
foobar authored
2 # | PHP Version 5 |
693180c Small speedup
Sascha Schumann authored
3 # +----------------------------------------------------------------------+
5bd9322 bump year and license version
foobar authored
4 # | Copyright (c) 2000-2006 The PHP Group |
693180c Small speedup
Sascha Schumann authored
5 # +----------------------------------------------------------------------+
5bd9322 bump year and license version
foobar authored
6 # | This source file is subject to version 3.01 of the PHP license, |
693180c Small speedup
Sascha Schumann authored
7 # | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
8 # | available through the world-wide-web at the following url: |
5bd9322 bump year and license version
foobar authored
9 # | http://www.php.net/license/3_01.txt |
693180c Small speedup
Sascha Schumann authored
10 # | If you did not receive a copy of the PHP license and are unable to |
11 # | obtain it through the world-wide-web, please send a note to |
12 # | license@php.net so we can mail you a copy immediately. |
13 # +----------------------------------------------------------------------+
90613d2 Maintain headers.
Sebastian Bergmann authored
14 # | Author: Sascha Schumann <sascha@schumann.cx> |
693180c Small speedup
Sascha Schumann authored
15 # +----------------------------------------------------------------------+
16 #
17 # $Id$
18 #
19 # Usage:
20 #
21 # echo top_srcdir top_builddir srcdir CPP [CPP-ARGS] filenames | \
22 # awk -f mkdep.awk > dependencies
23
24
ba4ddf3 Create dependencies using an awk script. Works much nicer in vpath
Sascha Schumann authored
25 {
26 top_srcdir=$1
27 top_builddir=$2
28 srcdir=$3
29 cmd=$4
30
31 for (i = 5; i <= NF; i++) {
32 if (match($i, "^-[A-Z]") == 0)
33 break;
34 cmd=cmd " " $i
35 }
36
37 dif=i-1
38
39 for (; i <= NF; i++)
40 filenames[i-dif]=$i
41
42 no_files=NF-dif
43
44 for(i = 1; i <= no_files; i++) {
45 if (system("test -r " filenames[i]) != 0)
46 continue
47
48 target=filenames[i]
49 sub(srcdir "/", "", target)
50 target2=target
51 sub("\.(c|cpp)$", ".lo", target);
52 sub("\.(c|cpp)$", ".slo", target2);
53
54 for (e in used)
55 delete used[e]
56
57 cmdx=cmd " " filenames[i]
a8be2cf Speed it up by moving the two sub's into the main loop.
Sascha Schumann authored
58 done=0
ba4ddf3 Create dependencies using an awk script. Works much nicer in vpath
Sascha Schumann authored
59 while ((cmdx | getline) > 0) {
a8be2cf Speed it up by moving the two sub's into the main loop.
Sascha Schumann authored
60 if (match($0, "^# [0-9]* \".*\.h\"") != 0) {
693180c Small speedup
Sascha Schumann authored
61 if (sub(top_srcdir, "$(top_srcdir)", $3) == 0)
62 sub(top_builddir, "$(top_builddir)", $3)
a8be2cf Speed it up by moving the two sub's into the main loop.
Sascha Schumann authored
63 if (substr($3,2,1) != "/" && used[$3] != 1) {
64 if (done == 0)
693180c Small speedup
Sascha Schumann authored
65 printf(target " " target2 ":")
a8be2cf Speed it up by moving the two sub's into the main loop.
Sascha Schumann authored
66 done=1
693180c Small speedup
Sascha Schumann authored
67 printf(" \\\n\t" substr($3,2,length($3)-2))
a8be2cf Speed it up by moving the two sub's into the main loop.
Sascha Schumann authored
68 used[$3] = 1;
69 }
ba4ddf3 Create dependencies using an awk script. Works much nicer in vpath
Sascha Schumann authored
70 }
71 }
a8be2cf Speed it up by moving the two sub's into the main loop.
Sascha Schumann authored
72 if (done == 1)
693180c Small speedup
Sascha Schumann authored
73 print "\n"
ba4ddf3 Create dependencies using an awk script. Works much nicer in vpath
Sascha Schumann authored
74 }
75 }
Something went wrong with that request. Please try again.