Contents of /trunk/mkinitrd-magellan/klibc/usr/dash/gendeps.pl
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 899 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 899 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | #!/usr/bin/perl |
2 | # |
3 | # Generate dependencies for *generated* header files. Generated |
4 | # header files have to use #include "foo.h" syntax. |
5 | # |
6 | |
7 | ($src, $obj, @build_headers) = @ARGV; |
8 | %build_headers = map { $_ => 1 } @build_headers; |
9 | |
10 | open(GENDEPS, "> $obj/.gendeps\0") |
11 | or die "$0: Cannot create $obj/.gendeps: $!\n"; |
12 | |
13 | opendir(DIR, $src) or die "$0: Cannot opendir $src: $!\n"; |
14 | while ( defined($file = readdir(DIR)) ) { |
15 | if ( $file =~ /^(.*)\.c$/ ) { |
16 | $basename = $1; |
17 | @hdrs = (); |
18 | open(FILE, "< $src/$file\0") |
19 | or die "$0: Cannot open $src/$file: $!\n"; |
20 | while ( defined($line = <FILE>) ) { |
21 | if ( $line =~ /^\s*\#\s*include\s+\"(.*)\"/ ) { |
22 | $header = $1; |
23 | |
24 | if ( $build_headers{$header} ) { |
25 | push(@hdrs, "\$(obj)/$header"); |
26 | } |
27 | } |
28 | } |
29 | close(FILE); |
30 | |
31 | if (scalar(@hdrs)) { |
32 | print GENDEPS "\$(obj)/$basename.o: ", join(' ', @hdrs), "\n"; |
33 | } |
34 | } |
35 | } |
36 | |
37 | closedir(DIR); |
38 | close(GENDEPS); |
Properties
Name | Value |
---|---|
svn:executable | * |