blob: 624869fa43326783317fdf58bec39a0df24b913c (
plain)
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
|
# Commands to use
# for linux or freebsd or probably cygwin:
CC = gcc
RM = rm -f
JAVA = java
JAVAC = javac
JAVAH = javah
# Shared object prefix and suffix
# for linux:
LIB = lib
DOTSO = .so
# for windows or cygwin:
# LIB =
# DOTSO = .dll
# Source files
SOURCES = regex/regcomp.c regex/regerror.c regex/regexec.c regex/regfree.c \
treexpr.c
JNISOURCES = $(SOURCES) GrokHtml.c
# libxml2 flags
XMLINCL = $(shell xml2-config --cflags)
XMLLIBS = $(shell xml2-config --libs)
# java flags
# for linux using SUN jdk15:
# JAVAINCL = -I/opt/jdk-1.5.0/include -I/opt/jdk-1.5.0/include/linux
# for linux using sablevm:
JAVAINCL = -I/usr/include/sablevm
# for freebsd using jdk15 from portage:
# JAVAINCL = -I/usr/local/jdk1.5.0/include -I/usr/local/jdk1.5.0/include/freebsd
INCL = -I./regex $(XMLINCL)
LIBS = $(XMLLIBS)
CFLAGS += -O2 -Wall
all: $(LIB)GrokHtml$(DOTSO) $(LIB)treexpr$(DOTSO)
GrokHtml.h: GrokHtml.class
$(JAVAH) -classpath . -jni -o $@ GrokHtml
GrokHtml.class: GrokHtml.java
$(JAVAC) $<
TestIt.class: TestIt.java
$(JAVAC) $<
$(LIB)GrokHtml$(DOTSO): $(JNISOURCES) GrokHtml.h
$(CC) $(LIBS) $(CFLAGS) $(INCL) $(JAVAINCL) -shared -o $@ $(JNISOURCES)
$(LIB)treexpr$(DOTSO): $(SOURCES)
$(CC) $(LIBS) $(CFLAGS) $(INCL) -shared -o $@ $(SOURCES)
test: $(LIB)GrokHtml$(DOTSO) TestIt.class
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):. $(JAVA) TestIt
clean:
$(RM) $(LIB)GrokHtml$(DOTSO)
$(RM) $(LIB)treexpr$(DOTSO)
$(RM) GrokHtml.h
$(RM) *.class
|