Automatically create GNUmakerules and GNUmakevars if they don't exist.

Print usage if unknown option is given.
This commit is contained in:
hjp 2007-02-09 15:36:37 +00:00
parent 520a335ee6
commit 90cfb3a468
4 changed files with 39 additions and 5 deletions

View File

@ -23,4 +23,10 @@ customize: configure
$(BINDIR): $(BINDIR):
mkdir -p $@ mkdir -p $@
GNUmakevars: GNUmakevars.sh
sh ./$^ > $@
GNUmakerules: GNUmakerules.sh
sh ./$^ > $@
include GNUmakerules include GNUmakerules

5
agestat/GNUmakerules.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
echo "\$(BINDIR)/%: %"
echo -e "\tcp \$^ \$@"
echo "\$(MAN1DIR)/%: %"
echo -e "\tcp \$^ \$@"

15
agestat/GNUmakevars.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
prefix=${prefix:-/usr/local}
echo "BINDIR=$prefix/bin"
for i in "$prefix/share/man/man1" "$prefix/man/man1"
do
if [ -d "$i" -a -w "$i" ]
then
echo "MAN1DIR=$i"
break;
fi
done
echo
echo "all:"

View File

@ -1,6 +1,6 @@
#!@@@perl@@@ -w #!@@@perl@@@ -w
# #
# $Id: agestat.pl,v 1.7 2006-02-17 13:50:23 hjp Exp $ # $Id: agestat.pl,v 1.8 2007-02-09 15:36:37 hjp Exp $
# #
use strict; use strict;
@ -8,11 +8,16 @@ use File::stat;
use File::Find; use File::Find;
use Getopt::Long; use Getopt::Long;
sub usage {
print STDERR "Usage: $0 [-atime|-mtime] [-scale=(k|M)]\n";
exit 1;
}
my $now = time(); my $now = time();
my @bucket_max; my @bucket_max;
my %opts = (buckets => 'log2'); my %opts = (buckets => 'log2');
GetOptions(\%opts, "atime", "mtime", "scale=s", "buckets=s"); GetOptions(\%opts, "atime", "mtime", "scale=s", "buckets=s") or usage();
my $scale; my $scale;
if (!defined($opts{scale})) { if (!defined($opts{scale})) {
$scale = 1; $scale = 1;
@ -21,8 +26,7 @@ if (!defined($opts{scale})) {
} elsif ($opts{scale} eq 'M') { } elsif ($opts{scale} eq 'M') {
$scale = 1024*1024; $scale = 1024*1024;
} else { } else {
print STDERR "Usage: $0 [-atime|-mtime] [-scale=(k|M)]\n"; usage();
exit 1;
} }
if ($opts{buckets} eq "log2") { if ($opts{buckets} eq "log2") {
@ -102,7 +106,11 @@ for (my $i = 0; $i <= $#hist; $i++) {
} }
# $Log: agestat.pl,v $ # $Log: agestat.pl,v $
# Revision 1.7 2006-02-17 13:50:23 hjp # Revision 1.8 2007-02-09 15:36:37 hjp
# Automatically create GNUmakerules and GNUmakevars if they don't exist.
# Print usage if unknown option is given.
#
# Revision 1.7 2006/02/17 13:50:23 hjp
# Fixed error when oldest file was older than oldest bucket. # Fixed error when oldest file was older than oldest bucket.
# Realigned columns. # Realigned columns.
# #