Commit | Line | Data |
d50cb536 |
1 | #!/usr/bin/perl |
2 | |
3 | $JPL_SRC = ".."; |
4 | |
5 | use Config; |
6 | |
7 | eval `$JPL_SRC/setvars -perl`; |
8 | |
9 | if ($^O eq 'linux') { |
10 | $flags = "-Dbool=char"; # avoid builtin bool altogether |
11 | $libs = "-lc -lm -ldl"; |
b83c0eaa |
12 | } else { |
d50cb536 |
13 | $flags = ""; |
14 | $libs = "-lc -lm -ldl"; |
15 | } |
16 | |
b83c0eaa |
17 | # Needed for JNI. |
18 | if ($^O eq 'solaris') { |
19 | $libs .= " -lthread"; |
20 | } |
21 | |
d50cb536 |
22 | open(MAKEFILE, ">Makefile"); |
23 | |
24 | print MAKEFILE <<"SUBS"; |
25 | WHAT = PerlInterpreter |
26 | JAVA_HOME = $ENV{JAVA_HOME} |
27 | JPL_HOME = $ENV{JPL_HOME} |
28 | ARCHNAME = $Config{archname} |
29 | PERLARCHDIR = $Config{archlib} |
30 | CC = $Config{cc} |
31 | FLAGS = $Config{cccdlflags} $Config{ccdlflags} $Config{lddlflags} $flags |
32 | INCL = -I\$(PERLARCHDIR)/CORE \\ |
33 | -I\$(JAVA_HOME)/include \\ |
34 | -I\$(JAVA_HOME)/include/$^O \\ |
35 | -I\$(JAVA_HOME)/include/genunix |
36 | LIBS = $libs |
37 | |
38 | SUBS |
39 | |
40 | |
41 | print MAKEFILE <<'NOSUBS'; |
42 | .SUFFIXES: .java .class |
43 | |
44 | .java.class: |
45 | javac $*.java |
46 | |
47 | .class.h: |
48 | javah -jni $* |
49 | |
50 | all: PerlInterpreter.class libPerlInterpreter.so |
51 | |
52 | PerlInterpreter.class: PerlInterpreter.java |
53 | |
54 | PerlInterpreter.h: PerlInterpreter.class |
55 | |
56 | libPerlInterpreter.so: PerlInterpreter.c PerlInterpreter.h |
57 | $(CC) $(FLAGS) $(INCL) PerlInterpreter.c \ |
58 | $(PERLARCHDIR)/auto/DynaLoader/DynaLoader.a \ |
59 | $(LIBS) \ |
60 | -o libPerlInterpreter.so |
61 | |
62 | test: |
63 | |
64 | install: all |
65 | mkdir -p $(JPL_HOME)/lib/$(ARCHNAME) |
66 | cp libPerlInterpreter.so $(JPL_HOME)/lib/$(ARCHNAME) |
67 | cp $(WHAT).class $(JPL_HOME)/lib |
68 | |
69 | clean: |
70 | rm -f libPerlInterpreter.so |
71 | rm -f PerlInterpreter.class |
72 | NOSUBS |
73 | |
74 | close MAKEFILE; |