]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/dev/drm/drm-subprocess.pl
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / sys / dev / drm / drm-subprocess.pl
1 # $FreeBSD$
2 #
3 # Props to Daniel Stone for starting this script for me.  I hate perl.
4
5 my $lastline = "";
6 my $foundopening = 0;
7 my $foundclosing = 0;
8
9 while (<>) {
10         $curline = $_;
11         if (!$foundopening) {
12                 if (/Copyright/) {
13                         $foundopening = 1;
14                         # print the previous line we buffered, but with /*-
15                         if ($lastline !~ /\/\*-/) {
16                                 $lastline =~ s/\/\*/\/\*-/;
17                         }
18                         print $lastline;
19                         # now, print the current line.
20                         print $curline;
21                 } else {
22                         # print the previous line and continue on
23                         print $lastline;
24                 }
25         } elsif ($foundopening && !$foundclosing && /\*\//) {
26                 # print the $FreeBSD$ bits after the end of the license block
27                 $foundclosing = 1;
28                 print;
29                 print "\n";
30                 print "#include <sys/cdefs.h>\n";
31                 print "__FBSDID(\"\$FreeBSD\$\");\n";
32         } elsif ($foundopening) {
33                 # Replace headers with the system's paths.  the headers we're
34                 # concerned with are drm*.h, *_drm.h and *_drv.h
35                 # 
36                 s/#include "(.*)_drv.h/#include "dev\/drm\/\1_drv.h/;
37                 s/#include "(.*)_drm.h/#include "dev\/drm\/\1_drm.h/;
38                 s/#include "mga_ucode.h/#include "dev\/drm\/mga_ucode.h/;
39                 s/#include "r300_reg.h/#include "dev\/drm\/r300_reg.h/;
40                 s/#include "radeon_microcode.h/#include "dev\/drm\/radeon_microcode.h/;
41                 s/#include "sis_ds.h/#include "dev\/drm\/sis_ds.h/;
42                 s/#include "drm/#include "dev\/drm\/drm/;
43                 print;
44         }
45         $lastline = $curline;
46 }
47
48 # if we never found the copyright header, then we're still a line behind.
49 if (!$foundopening) {
50         print $lastline;
51 }