1 # Makefile for the native SQLite JDBC Driver
3 # Tested on Mac OS X, Linux and Windows/Cygwin. This file generates a jar file
4 # and native jnilib/so/dll library that provides an SQLite JDBC driver.
6 # Author: David Crawshaw, 2007
7 # License: New BSD (see LICENSE file)
9 # No auto-goop. Just try typin 'make'.
12 include Makefile.common
16 dl/$(sqlite)-amal.zip:
18 curl -odl/$(sqlite)-amal.zip \
19 http://www.sqlite.org/sqlite-amalgamation-$(subst .,_,$(sqlite_version)).zip
21 build/$(sqlite)-%/sqlite3.o: dl/$(sqlite)-amal.zip
22 @mkdir -p build/$(sqlite)-$*
23 unzip -qo dl/$(sqlite)-amal.zip -d build/$(sqlite)-$*
24 perl -pi -e "s/sqlite3_api;/sqlite3_api = 0;/g" \
25 build/$(sqlite)-$*/sqlite3ext.h
26 (cd build/$(sqlite)-$*; $(CC) -o sqlite3.o -c $(CFLAGS) \
27 -DSQLITE_ENABLE_COLUMN_METADATA \
29 -DSQLITE_ENABLE_FTS3 \
30 -DSQLITE_OMIT_LOAD_EXTENSION sqlite3.c)
32 build/org/%.class: src/org/%.java
34 javac -source 1.2 -target 1.2 -sourcepath src -d build $<
36 build/test/%.class: src/test/%.java
38 javac -target 1.5 -classpath "$(libs)" -sourcepath src/test -d build $<
40 native: build/$(sqlite)-$(target)/sqlite3.o $(native_classes)
41 @mkdir -p build/$(target)
42 javah -classpath build -jni -o build/NativeDB.h org.sqlite.NativeDB
43 cd build && jar cf $(sqlitejdbc)-native.jar $(java_classlist)
44 $(CC) $(CFLAGS) -c -o build/$(target)/NativeDB.o \
45 src/org/sqlite/NativeDB.c
46 $(CC) $(CFLAGS) $(LINKFLAGS) -o build/$(target)/$(LIBNAME) \
47 build/$(target)/NativeDB.o build/$(sqlite)-$(target)/*.o
48 $(STRIP) build/$(target)/$(LIBNAME)
50 dist/$(sqlitejdbc)-$(target).tgz: native
52 tar cfz dist/$(sqlitejdbc)-$(target).tgz README \
53 -C build $(sqlitejdbc)-native.jar -C $(target) $(LIBNAME)
55 test: native $(test_classes)
56 java -Djava.library.path=build/$(target) \
57 -cp "build/$(sqlitejdbc)-native.jar$(sep)$(libs)" \
58 org.junit.runner.JUnitCore $(tests)