OSDN Git Service

git-svn-id: http://www.xerial.org/svn/project/XerialJ/trunk/sqlite-jdbc@3189 ae02f08e...
[xerial/sqlite-jdbc.git] / sqlitejdbc / Makefile.nested
1 include Makefile.common
2
3 nestedvm_version := 2007-06-30
4 nestedvm := nestedvm-$(nestedvm_version)
5
6 default: test
7
8 test: dist/$(sqlitejdbc)-pure.jar $(test_classes)
9         $(JAVA) -cp "dist/$(sqlitejdbc)-pure.jar$(sep)build$(sep)$(libjunit)" \
10             org.junit.runner.JUnitCore $(tests)
11
12 dist/$(sqlitejdbc)-pure.jar: build/org/sqlite/SQLite.class $(java_classes)
13         @mkdir -p dist
14         cd build && jar cf ../$@ \
15             org/sqlite/SQLite.class $(java_classlist) \
16             -C ../$(nestedvm)/build org/ibex
17
18 build/org/sqlite/%.class: ../src/main/java/org/sqlite/%.java
19         @mkdir -p build
20         $(JAVAC) -source 1.2 -target 1.2 -classpath "$(nestedvm)/build" \
21             -sourcepath ../src/main/java -d build $<
22
23 build/test/org/sqlite/%.class: ../src/test/java/org/sqlite/%.java
24         @mkdir -p build
25         $(JAVAC) -target 1.5 -classpath "build$(sep)$(libjunit)" \
26             -sourcepath ../src/test/java -d build/test $<
27
28 $(nestedvm)/%:
29         $(MAKE) -C $(nestedvm) $*
30
31 dl/$(nestedvm).tgz:
32         @mkdir -p dl
33         cp ../archive/$(nestedvm).tgz $@
34 #       curl -odl/$(nestedvm).tgz http://files.zentus.com/sqlitejdbc/$(nestedvm).tgz
35
36 dl/$(sqlite)-amal.zip:
37         @mkdir -p dl
38         curl -odl/$(sqlite)-amal.zip \
39         http://www.sqlite.org/sqlite-amalgamation-$(subst .,_,$(sqlite_version)).zip
40
41 $(nestedvm)/Makefile: dl/$(nestedvm).tgz
42         tar xfz dl/$(nestedvm).tgz
43
44
45 build/SQLite.mips: $(nestedvm)/Makefile $(nestedvm)/env.sh dl/$(sqlite)-amal.zip
46         @mkdir -p build
47         @mkdir -p build/$(sqlite)-nestedvm
48         unzip -qo dl/$(sqlite)-amal.zip -d build/$(sqlite)-nestedvm
49         cp ../src/main/java/org/sqlite/Nested*.c build/$(sqlite)-nestedvm
50         perl -pi -e "s/sqlite3_api;/sqlite3_api = 0;/g" \
51             build/$(sqlite)-nestedvm/sqlite3ext.h
52
53         # we need a dummy main
54         echo 'int main() { return 0; }' >> build/$(sqlite)-nestedvm/sqlite3.c
55         # remove utimes
56         perl -npe '$$_ =~ s/utimes.*//g;' -i build/$(sqlite)-nestedvm/sqlite3.c 
57
58         (. ./$(nestedvm)/env.sh; cd build/$(sqlite)-nestedvm; \
59         $$CC -c $$CFLAGS -Ilib/inc_mac -o sqlite3.o \
60             -DSQLITE_THREADSAFE=0 \
61                 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
62             -DSQLITE_ENABLE_COLUMN_METADATA \
63             -DSQLITE_CORE \
64             -DSQLITE_ENABLE_FTS3 \
65                 -DSQLITE_ENABLE_RTREE \
66                 sqlite3.c; \
67         $$CC -c $$CFLAGS -o NestedDB.o Nested*.c)
68
69         ./$(nestedvm)/upstream/install/bin/mips-unknown-elf-gcc \
70                 -march=mips1 --static -lc\
71                 -o $@ build/$(sqlite)-nestedvm/sqlite3.o \
72                               build/$(sqlite)-nestedvm/NestedDB.o
73
74 build/org/sqlite/SQLite.class: build/SQLite.mips
75         java -cp $(nestedvm)/build$(sep)$(nestedvm)/upstream/build/classgen/build \
76             org.ibex.nestedvm.Compiler \
77             -outformat class -d build -o unixRuntime \
78             org.sqlite.SQLite build/SQLite.mips
79
80 clean:
81         rm -rf build
82         rm -rf dist