aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 589cbfa0175430f9c404107da8ef0e210abc0005 (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
# 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 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) $(JAVAINCL)
LIBS = $(XMLLIBS)
CFLAGS += -O2 -Wall

all: $(LIB)GrokHtml$(DOTSO)

GrokHtml.h: GrokHtml.class
	$(JAVAH) -classpath . -jni -o $@ GrokHtml

GrokHtml.class: GrokHtml.java
	$(JAVAC) $<

TestIt.class: TestIt.java
	$(JAVAC) $<

$(LIB)GrokHtml$(DOTSO): $(SOURCES) GrokHtml.h
	$(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) GrokHtml.h
	$(RM) *.class