1 # |
|
2 # |
|
3 # Makefile for building libLauncher.so |
|
4 # |
|
5 # To build libLauncher.so requires :- |
|
6 # JAVA_HOME environment variable |
|
7 # cc (Solaris) or gcc (Linux) on PATH |
|
8 # |
|
9 # The library is created in a architecture specific directory :- |
|
10 # |
|
11 # lib/solaris-sparc/libLauncher.so (Solaris/SPARC) |
|
12 # lib/solaris-i586/libLauncher.so (Solaris/x86) |
|
13 # lib/linux-i586/libLauncher.so (Linux/x86) |
|
14 |
|
15 ECHO = echo |
|
16 MKDIR = mkdir |
|
17 UNAME = uname |
|
18 |
|
19 uname := $(shell uname) |
|
20 |
|
21 ifeq ($(uname), SunOS) |
|
22 PLATFORM = solaris |
|
23 ISAINFO = isainfo |
|
24 ARCH_DATA_MODEL=64 |
|
25 ARCH := $(shell $(ISAINFO) -n) |
|
26 CC = cc |
|
27 LD = ld |
|
28 CFLAGS = -D_REENTRANT -D__solaris__ |
|
29 LDFLAGS_COMMON = -G |
|
30 EXTRA_LIBS = -lc |
|
31 CC += -m64 -Kpic |
|
32 endif |
|
33 |
|
34 ifeq ($(uname), Linux) |
|
35 PLATFORM = linux |
|
36 archExpr = case "`$(UNAME) -m`" in \ |
|
37 i[3-6]86) \ |
|
38 $(ECHO) i586 \ |
|
39 ;; \ |
|
40 sparc*) \ |
|
41 $(ECHO) sparc \ |
|
42 ;; \ |
|
43 *) \ |
|
44 $(UNAME) -m \ |
|
45 ;; \ |
|
46 esac |
|
47 ARCH := $(shell $(archExpr) ) |
|
48 CC = gcc |
|
49 CFLAGS = -fno-strict-aliasing -fPIC -W -Wall |
|
50 LD = ld |
|
51 LDFLAGS_COMMON = -shared |
|
52 EXTRA_LIBS = -lc |
|
53 endif |
|
54 |
|
55 LIBDIR=lib/$(PLATFORM)-$(ARCH) |
|
56 LAUNCHERLIB=$(LIBDIR)/libLauncher.so |
|
57 |
|
58 all: java_home $(LAUNCHERLIB) |
|
59 |
|
60 $(LAUNCHERLIB) : $(LIBDIR) $(LIBDIR)/Launcher.o |
|
61 $(LD) $(LDFLAGS_COMMON) -o $(LAUNCHERLIB) $(LIBDIR)/Launcher.o $(EXTRA_LIBS) |
|
62 |
|
63 $(LIBDIR): |
|
64 @$(MKDIR) -p $(LIBDIR) |
|
65 |
|
66 $(LIBDIR)/Launcher.o : Launcher.c \ |
|
67 Launcher.h |
|
68 $(CC) -c $(CFLAGS) -o $(LIBDIR)/Launcher.o \ |
|
69 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/$(PLATFORM) Launcher.c |
|
70 |
|
71 Launcher.class Launcher.h : Launcher.java |
|
72 $(JAVA_HOME)/bin/javac -h . Launcher.java |
|
73 |
|
74 java_home: |
|
75 ifndef JAVA_HOME |
|
76 @$(ECHO) "ERROR: Your JAVA_HOME environment variable is not set." |
|
77 exit 1 |
|
78 endif |
|
79 |
|