summaryrefslogtreecommitdiff
path: root/perl/make-perl-makefiles
blob: 8a9648720b141a3e20ff38a796ec6cba84e6b73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl


open(I, "Makefile.subs.pl");
@stuff = <I>;

foreach my $i (@ARGV) {
    print "updating $i\n";
    open(I, $i);
    open(O,">$i.new");
    while(<I>) {
	# start replacement here
	last if /common subroutines -- DO NOT EDIT/;
	print O;
    }
    print O "# common subroutines -- DO NOT EDIT.\n";
    print O "# They are imported from the Makefile.subs.pl file\n";
    print O @stuff;
    close(I);
    close(O);
    rename($i,"$i.bak");
    rename("$i.new", "$i");
}