#!/usr/bin/perl -w
eval
{
require
5.006 };
if
($@) {
die
"I need perl version 5.6 or newer. If you have it installed somewhere
already, run this installation procedure
with
that perl binary, e.g.,
perl5.10.0 config.pl
If you don't have a recent version of perl installed (what kind of
system
are
you on?), get the latest from www.perl.com and install it.
";
}
if
($] == 5.006) {
print
"**************** You're running perl 5.6.0. *************************
perl 5.6.0
has
a bug which can cause makepp to behave in a bizarre fashion.
This bug is not encountered in every makefile, so you might be ok. But it
would be safer to upgrade to another version of perl (e.g., 5.8.0 does
not seem to have the problem).\n";
}
elsif
($] == 5.006001) {
print
"**************** You're running perl 5.6.1. *************************
perl 5.6.1 fails on some architectures and works just fine on others.
If you encounter weird problems
with
makepp, or
if
the tests fail,
consider upgrading your version of perl.\n";
}
my
$prefix
=
"/usr/local"
;
my
$findbin
=
"none"
;
my
$makefile
=
'.'
;
my
(
$bindir
,
$datadir
,
$mandir
,
$htmldir
);
Mpp::Text::getopts
[
qw(p prefix)
, \
$prefix
, 1],
[
qw(b bindir)
, \
$bindir
, 1],
[
qw(h htmldir)
, \
$htmldir
, 1],
[
qw(m mandir)
, \
$mandir
, 1],
[
qw(d datadir)
, \
$datadir
, 1],
[
qw(f findbin)
, \
$findbin
, 1],
[
undef
,
'makefile'
, \
$makefile
, 1],
splice
@Mpp::Text::common_opts
;
$makefile
.=
'/Makefile'
if
-d
$makefile
;
$bindir
||=
"$prefix/bin"
;
$datadir
||=
"$prefix/share/makepp"
;
$htmldir
||=
"$prefix/share/makepp/html"
;
$mandir
||=
"$prefix/man"
;
foreach
(
$bindir
,
$datadir
,
$htmldir
) {
s@~/
@$ENV
{HOME}/@;
}
our
$VERSION
;
open
MAKEFILE,
'>'
,
$makefile
or
die
"$0: can't write $makefile--$!\n"
;
my
$perl
= PERL;
s/\$/\$\$/g
for
$perl
,
$bindir
,
$datadir
,
$findbin
,
$mandir
,
$htmldir
,
$VERSION
;
print
MAKEFILE "PERL =
$perl
BINDIR =
$bindir
DATADIR =
$datadir
FINDBIN =
$findbin
MANDIR =
$mandir
HTMLDIR =
$htmldir
VERSION = makepp-
$VERSION
\n";
print
MAKEFILE
q[
all: test
test: .test_done
.test_done: *.pm Mpp/*.pm Mpp/Signature/*.pm Mpp/Scanner/*.pm Mpp/CommandParser/*.pm Mpp/Lexer/*.pm makepp \
t/*.test t/run_tests.pl
cd t && PERL=$(PERL) $(PERL) run_tests.pl --hint
touch $@
testall: .testall_done
.testall_done: *.pm Mpp/*.pm Mpp/Signature/*.pm Mpp/Scanner/*.pm Mpp/CommandParser/*.pm Mpp/Lexer/*.pm makepp \
t/*.test t/*/*.test t/run_tests.pl
cd t && PERL=$(PERL) $(PERL) run_tests.pl --hint *.test */*.test
touch $@
distribution: $(VERSION).tar.gz
$(VERSION).tar.gz: README INSTALL LICENSE VERSION makepp.lsm ChangeLog \
makepp recursive_makepp makeppclean \
Mpp/*.pm Mpp/Signature/*.pm Mpp/Scanner/*.pm \
Mpp/BuildCheck/*.pm Mpp/CommandParser/*.pm Mpp/Lexer/*.pm *.mk *.pm \
pod/*.pod \
t/*.test t/*/*.test t/run_tests.pl \
config.pl configure install.pl makepp_build_cache_control
rm -rf $(VERSION)
./configure # Reset Makefile.
mkdir $(VERSION) \
$(VERSION)/pod $(VERSION)/t \
$(VERSION)/Mpp $(VERSION)/Mpp/Signature $(VERSION)/Mpp/Scanner \
$(VERSION)/Mpp/CommandParser $(VERSION)/Mpp/Lexer
for file in $^; do cp $$file $(VERSION)/$$file; done
GZIP=-9 tar --create --gzip --file $@ $(VERSION)
cd $(VERSION) && make test # Make sure it all runs.
rm -rf $(VERSION)
install: all
$(PERL) install.pl $(BINDIR) $(DATADIR) $(MANDIR) $(HTMLDIR) $(FINDBIN) $(DESTDIR)
.PHONY: all distribution install test testall
]
;