dded error checking to scripts
[vlendec/samba-autobuild/.git] / packaging / SGI / makefile.pl
1 #!/usr/bin/perl
2
3 # This perl script creates the SGI specific Makefile. 
4 # The BASEDIR is set to /usr/samba, MANDIR is set to /usr/share/man, and
5 # the lines are uncommented for the requested OS version. If no version
6 # is specified, IRIX 6 is used.
7
8 if (!@ARGV) {
9   $OSver = "6";
10 }
11 else {
12   $OSver = $ARGV[0];
13 }
14
15 open(MAKEIN,"../../source/Makefile") || die "Unable to open source Makefile\n";
16 open(MAKEOUT,">Makefile") || die "Unable to open Makefile for output\n";
17 while (<MAKEIN>) {
18     if (/^BASEDIR =/) {
19         print MAKEOUT "BASEDIR = /usr/samba\n";
20     }
21     elsif (/^MANDIR =/) {
22         print MAKEOUT "MANDIR = /usr/share/man\n";
23     }
24     elsif (/^# FOR SGI IRIX $OSver/) {
25         print MAKEOUT;
26         $a = <MAKEIN>;
27         print MAKEOUT $a;
28         ($a = <MAKEIN>) =~ s/^# //;
29         print MAKEOUT $a;
30         ($a = <MAKEIN>) =~ s/^# //;
31         print MAKEOUT $a;
32         ($a = <MAKEIN>) =~ s/^# //;
33         print MAKEOUT $a;
34     }
35     else {
36         print MAKEOUT;
37     }
38 }