|
Revision 90
(checked in by ben, 8 years ago)
|
Remove redundant line.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/usr/bin/perl -w |
|---|
| 2 |
|
|---|
| 3 |
use strict; |
|---|
| 4 |
|
|---|
| 5 |
use Carp; |
|---|
| 6 |
|
|---|
| 7 |
our %Subst; |
|---|
| 8 |
|
|---|
| 9 |
my %Args=( |
|---|
| 10 |
'--use-dmalloc' => sub { |
|---|
| 11 |
$Subst{DM_FLAGS}='-I/usr/local/include -DDMALLOC'; |
|---|
| 12 |
$Subst{DM_LIB}='/usr/local/lib/libdmalloc.a'; |
|---|
| 13 |
}, |
|---|
| 14 |
); |
|---|
| 15 |
|
|---|
| 16 |
while(my $arg=shift) { |
|---|
| 17 |
my $code=$Args{$arg}; |
|---|
| 18 |
croak "Don't understand: $arg" if !defined $code; |
|---|
| 19 |
&$code(); |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
my $os=`uname -s`; |
|---|
| 23 |
|
|---|
| 24 |
open(D,'>.depend') || croak "Can't create .depend"; |
|---|
| 25 |
close D; |
|---|
| 26 |
|
|---|
| 27 |
open(T,'Makefile.template') || croak "Can't open Makefile.template: $!"; |
|---|
| 28 |
open(M,'>Makefile') || croak "Can't create Makefile: $!"; |
|---|
| 29 |
|
|---|
| 30 |
print M "# generated by configure from Makefile.template. Don't edit.\n\n"; |
|---|
| 31 |
|
|---|
| 32 |
while(my $line=<T>) { |
|---|
| 33 |
print M subst($line); |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
close M; |
|---|
| 37 |
close T; |
|---|
| 38 |
|
|---|
| 39 |
system 'make clean' || exit; |
|---|
| 40 |
system 'make force_depend' || exit; |
|---|
| 41 |
|
|---|
| 42 |
sub subst { |
|---|
| 43 |
my $line=shift; |
|---|
| 44 |
|
|---|
| 45 |
while(my($k,$v)=each %Subst) { |
|---|
| 46 |
$line =~ s/\%$k\%/$v/g; |
|---|
| 47 |
} |
|---|
| 48 |
$line =~ s/\%.+?\%//g; |
|---|
| 49 |
return $line; |
|---|
| 50 |
} |
|---|