Re: [PATCH t/test.pl t/op/stat.t lib/Net/hostent.t] Unbail out
[p5sagit/p5-mst-13.2.git] / jpl / Test / Makefile.PL
CommitLineData
d50cb536 1#!/usr/bin/perl
2
3$JPL_HOME = $ENV{JPL_HOME}
4 or die "You have not run setvars to set your environment variables.\n" .
5 "See the JPL README file for more information.\n";
6
7use Config;
8
9eval `$JPL_HOME/setvars -perl`;
10
11chop($WHAT = `pwd`);
12$WHAT =~ s#.*/##;
13
14if ($^O eq 'linux') {
15 $flags = "-Dbool=char"; # avoid builtin bool altogether
16 $libs = "-lc -lm -ldl";
17}
18else {
19 $flags = "";
20 $libs = "-lc -lm -ldl";
21}
22chop($cwd = `pwd`);
23($jpldir = $cwd) =~ s#/[^/]*$##;
24
25open(MAKEFILE, ">Makefile");
26
27print MAKEFILE <<"SUBS";
28CC = $Config{cc}
29WHAT = $WHAT
30PERL = perl$]
31ARCHNAME = $Config{archname}
32JAVA_HOME = $ENV{JAVA_HOME}
33JPL_HOME = $ENV{JPL_HOME}
34PERLARCHDIR = $Config{archlib}
35FLAGS = $Config{cccdlflags} $Config{ccdlflags} $Config{lddlflags} $flags
36INCL = -I\$(PERLARCHDIR)/CORE \\
37 -I\$(JAVA_HOME)/include \\
38 -I\$(JAVA_HOME)/include/$^O \\
39 -I\$(JAVA_HOME)/include/genunix
40LIBS = $libs
41
42SUBS
43
44print MAKEFILE <<'NOSUBS';
45.SUFFIXES: .jpl .class
46
47.jpl.class:
48 $(PERL) -MJPL::Compile -e "file('$*.jpl')"
49
50all: $(WHAT).class lib$(WHAT).so
51
52debug: $(WHAT)_g.class lib$(WHAT)_g.so
53
54lib$(WHAT).so: $(WHAT).c $(JPL_HOME)/lib/$(ARCHNAME)/libPerlInterpreter.so
55 $(CC) $(FLAGS) $(INCL) $(WHAT).c \
56 $(PERLARCHDIR)/CORE/libperl.so \
57 $(JPL_HOME)/lib/$(ARCHNAME)/libPerlInterpreter.so \
58 $(LIBS) \
59 -o lib$(WHAT).so
60
61lib$(WHAT)_g.so: $(WHAT).c $(JPL_HOME)/lib/$(ARCHNAME)/libPerlInterpreter_g.so
62 $(CC) -g $(FLAGS) $(INCL) $(WHAT).c \
63 $(PERLARCHDIR)/CORE/libperl.so \
64 $(JPL_HOME)/lib/$(ARCHNAME)/libPerlInterpreter_g.so \
65 $(LIBS) \
66 -o lib$(WHAT)_g.so
67
68test:
69
70install: all
71 cp $(WHAT).class $(JPL_HOME)/lib
72 cp lib$(WHAT).so $(JPL_HOME)/lib/$(ARCHNAME)
73 cp $(WHAT).pl $(JPL_HOME)/perl
74
75clean:
76 rm -f $(WHAT).c $(WHAT).h \
77 $(WHAT)*.class $(WHAT)*.pl lib$(WHAT).so $(WHAT)*.java
78
79distclean: clean
80 rm -f Makefile
81
82NOSUBS
83
84close MAKEFILE;