/Makefile

https://github.com/sanyaade/sqlitejdbc · Makefile · 67 lines · 40 code · 11 blank · 16 comment · 1 complexity · cf039c14a69126b9c9f8a73fc4eec5be MD5 · raw file

  1. # Makefile for the native SQLite JDBC Driver
  2. #
  3. # No auto-goop. Just try typing 'make'. You should get two interesting files:
  4. # build/TARGET_OS/LIBNAME
  5. # build/sqlitejdbc-vXXX-native.jar
  6. #
  7. # To combine these, type:
  8. # cd build
  9. # mv LIBNAME linux-x86.lib (or win-x86.lib, freebsd-ppc.lib, mac.lib, etc)
  10. # java uf sqlitejdbc-vXXX-native.jar linux-x86.lib
  11. #
  12. # The first is the native library, the second is the java support files.
  13. # Generating the more complete sqlitejdbc-vXXX.jar requires building the
  14. # NestedVM source, which requires running a Linux machine, and looking at
  15. # the other make files.
  16. #
  17. include Makefile.common
  18. default: test
  19. test: native $(test_classes)
  20. $(JAVA) -Djava.library.path=build/$(target) \
  21. -cp "build/$(sqlitejdbc)-native.jar$(sep)build$(sep)$(libjunit)" \
  22. org.junit.runner.JUnitCore $(tests)
  23. native: build/$(sqlitejdbc)-native.jar build/$(target)/$(LIBNAME)
  24. build/$(sqlitejdbc)-native.jar: $(native_classes)
  25. cd build && jar cf $(sqlitejdbc)-native.jar $(java_classlist)
  26. build/$(target)/$(LIBNAME): build/$(sqlite)-$(target)/sqlite3.o build/org/sqlite/NativeDB.class
  27. @mkdir -p build/$(target)
  28. $(JAVAH) -classpath build -jni -o build/NativeDB.h org.sqlite.NativeDB
  29. $(CC) $(CFLAGS) -c -o build/$(target)/NativeDB.o \
  30. src/org/sqlite/NativeDB.c
  31. $(CC) $(CFLAGS) $(LINKFLAGS) -o build/$(target)/$(LIBNAME) \
  32. build/$(target)/NativeDB.o build/$(sqlite)-$(target)/*.o
  33. $(STRIP) build/$(target)/$(LIBNAME)
  34. build/$(sqlite)-%/sqlite3.o: dl/$(sqlite)-amal.zip
  35. @mkdir -p build/$(sqlite)-$*
  36. unzip -qo dl/$(sqlite)-amal.zip -d build/$(sqlite)-$*
  37. perl -pi -e "s/sqlite3_api;/sqlite3_api = 0;/g" \
  38. build/$(sqlite)-$*/sqlite3ext.h
  39. (cd build/$(sqlite)-$*; $(CC) -o sqlite3.o -c $(CFLAGS) \
  40. -DSQLITE_ENABLE_COLUMN_METADATA \
  41. -DSQLITE_ENABLE_FTS3 \
  42. -DSQLITE_THREADSAFE=1 \
  43. sqlite3.c)
  44. build/org/%.class: src/org/%.java
  45. @mkdir -p build
  46. $(JAVAC) -source 1.2 -target 1.2 -sourcepath src -d build $<
  47. build/test/%.class: src/test/%.java
  48. @mkdir -p build
  49. $(JAVAC) -target 1.5 -classpath "build$(sep)$(libjunit)" \
  50. -sourcepath src/test -d build $<
  51. dl/$(sqlite)-amal.zip:
  52. @mkdir -p dl
  53. curl -odl/$(sqlite)-amal.zip \
  54. http://www.sqlite.org/sqlite-amalgamation-$(subst .,_,$(sqlite_version)).zip
  55. clean:
  56. rm -rf build dist