Skip to content

Commit

Permalink
simple compile test target
Browse files Browse the repository at this point in the history
  • Loading branch information
eserte committed Feb 15, 2014
1 parent ee76214 commit 1960c0c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions SlayMakefile
Expand Up @@ -22,6 +22,40 @@
sub html_css { "http://search.cpan.org/s/style.css" }
}

{
sub is_in_path {
my($prog) = @_;
require File::Spec;
if (File::Spec->file_name_is_absolute($prog)) {
if ($^O eq 'MSWin32') {
return $prog if (-f $prog && -x $prog);
return "$prog.bat" if (-f "$prog.bat" && -x "$prog.bat");
return "$prog.com" if (-f "$prog.com" && -x "$prog.com");
return "$prog.exe" if (-f "$prog.exe" && -x "$prog.exe");
return "$prog.cmd" if (-f "$prog.cmd" && -x "$prog.cmd");
} else {
return $prog if -f $prog and -x $prog;
}
}
require Config;
%Config::Config = %Config::Config if 0; # cease -w
my $sep = $Config::Config{'path_sep'} || ':';
foreach (split(/$sep/o, $ENV{PATH})) {
if ($^O eq 'MSWin32') {
# maybe use $ENV{PATHEXT} like maybe_command in ExtUtils/MM_Win32.pm?
return "$_\\$prog" if (-f "$_\\$prog" && -x "$_\\$prog");
return "$_\\$prog.bat" if (-f "$_\\$prog.bat" && -x "$_\\$prog.bat");
return "$_\\$prog.com" if (-f "$_\\$prog.com" && -x "$_\\$prog.com");
return "$_\\$prog.exe" if (-f "$_\\$prog.exe" && -x "$_\\$prog.exe");
return "$_\\$prog.cmd" if (-f "$_\\$prog.cmd" && -x "$_\\$prog.cmd");
} else {
return "$_/$prog" if (-x "$_/$prog" && !-d "$_/$prog");
}
}
undef;
}
}


all: permissions

Expand All @@ -35,3 +69,18 @@ permissions:
cd scripts && chmod ugo+rx *
chmod ugo+rx scripts

test:
{
require Test::More;
import Test::More;
plan('no_plan');
my $perl = is_in_path('pistachio-perl');
if (!$perl) {
diag("pistachio-perl not found in PATH, fallback to standard perl");
$perl = $^X;
}
for my $script (<scripts/*>) {
system($perl, '-c', $script);
is($?, 0, "$script compiled OK");
}
}

0 comments on commit 1960c0c

Please sign in to comment.