File: Makefile.PL

package info (click to toggle)
freej 0.10git20080824-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 13,504 kB
  • ctags: 19,398
  • sloc: ansic: 135,255; cpp: 32,550; sh: 9,318; perl: 2,932; asm: 2,355; yacc: 1,178; makefile: 1,119; java: 136; lex: 94; python: 16
file content (67 lines) | stat: -rw-r--r-- 1,292 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use ExtUtils::MakeMaker;

use strict;
use Getopt::Std;

my (%foo, $jsdir, $inc, $libpath);

#m - build under mozilla tree
#d - specifies js build directory (with include/ and lib/ directories)
#c - build under charlie tree
getopts('mcd:', \%foo);

$jsdir = $foo{d};

$foo{'m'} = 1 unless $foo{c} || $foo{d}; #mozilla tree is the default

if ($foo{c}) {
    $inc = "-I$ENV{CHARLIE_HOME}/include";
    $libpath = "-L$ENV{CHARLIE_HOME}/lib";
}

if ($jsdir) {
    $inc = "-I$jsdir/include";
    $libpath = "-L$jsdir/lib -ljs";
}

my $tmpmk = <<'eof';
DEPTH=..
include ../config.mk

all:
	@echo '$(OBJDIR)'
eof

if ($foo{'m'}) {
    if ($^O eq "MSWin32") {
	$inc = "-I.. -I../Debug"; #I'm not sure
	$libpath = "-L../Debug";
    } else { #suppose unix, never Mac, gmake
	open FOO, ">tempmakefile";
	print FOO $tmpmk;
	close FOO;
	my $objdir = `gmake -f tempmakefile`;
	unlink "tempmakefile";
	$inc = "-I.. -I../$objdir";
	$libpath = "-L../$objdir";
    }
}

my %extras = ();
my $define;

if ($^O eq "MSWin32") {
    $define = "-DXP_PC";
    $extras{OBJECT} = '$(BASEEXT)$(OBJ_EXT) jsperl.obj';
} else {
    $define = '-DXP_UNIX';
}

WriteMakefile(NAME => 'JS',
	      DEFINE => $define,
	      INC => $inc,
	      LIBS => "$libpath -ljs",
	      VERSION_FROM => 'JS.pm',
	      %extras,);

__END__