root/XerialJ/trunk/sqlite-jdbc/sqlitejdbc/Makefile.nested

Revision 3597, 2.2 kB (checked in by leo, 2 years ago)

Applied a patch provided by Flavio Sugimoto

Line 
1include Makefile.common
2
3nestedvm_version := 2009-08-09
4nestedvm := nestedvm-$(nestedvm_version)
5
6default: test
7
8test: build/org/sqlite/SQLite.class
9
10$(nestedvm)/%:
11        $(MAKE) -C $(nestedvm) $*
12
13dl/$(nestedvm).tgz:
14        @mkdir -p dl
15        cp ../archive/$(nestedvm).tgz $@
16#       curl -odl/$(nestedvm).tgz http://nestedvm.ibex.org/dist/$(nestedvm).tgz
17
18dl/$(sqlite)-amal.zip:
19        @mkdir -p dl
20        curl -odl/$(sqlite)-amal.zip \
21        http://www.sqlite.org/sqlite-amalgamation-$(subst .,_,$(sqlite_version)).zip
22
23$(nestedvm)/Makefile: dl/$(nestedvm).tgz
24        tar xfz dl/$(nestedvm).tgz
25
26
27build/SQLite.mips: $(nestedvm)/Makefile $(nestedvm)/env.sh dl/$(sqlite)-amal.zip
28        @mkdir -p build
29        @mkdir -p build/$(sqlite)-nestedvm
30        unzip -qo dl/$(sqlite)-amal.zip -d build/$(sqlite)-nestedvm
31        cp ../src/main/java/org/sqlite/Nested*.c build/$(sqlite)-nestedvm
32        perl -pi -e "s/sqlite3_api;/sqlite3_api = 0;/g" \
33            build/$(sqlite)-nestedvm/sqlite3ext.h
34        # we need a dummy main
35        echo 'int main() { return 0; }' >> build/$(sqlite)-nestedvm/sqlite3.c
36        # remove utimes
37        perl -npe '$$_ =~ s/utimes.*//g;' -i build/$(sqlite)-nestedvm/sqlite3.c
38        # insert a code for loading extension functions
39        perl -pi -e "s/^opendb_out:/  if(!db->mallocFailed && rc==SQLITE_OK){ rc = RegisterExtensionFunctions(db); }\nopendb_out:/;" \
40            build/$(sqlite)-nestedvm/sqlite3.c
41        cat ext/*.c >> build/$(sqlite)-nestedvm/sqlite3.c
42        (. ./$(nestedvm)/env.sh; cd build/$(sqlite)-nestedvm; \
43        $$CC -c $$CFLAGS -I. -o sqlite3.o \
44            -DSQLITE_THREADSAFE=0 \
45                -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
46            -DSQLITE_ENABLE_COLUMN_METADATA \
47            -DSQLITE_CORE \
48            -DSQLITE_ENABLE_FTS3 \
49                -DSQLITE_ENABLE_RTREE \
50                -DSQLITE_OMIT_LOAD_EXTENSION \
51                sqlite3.c; \
52        $$CC -c $$CFLAGS -o NestedDB.o Nested*.c)
53        ./$(nestedvm)/upstream/install/bin/mips-unknown-elf-gcc \
54                -march=mips1 --static \
55                -o $@ build/$(sqlite)-nestedvm/sqlite3.o \
56                              build/$(sqlite)-nestedvm/NestedDB.o -lm -lc
57
58build/org/sqlite/SQLite.class: build/SQLite.mips
59        java -cp $(nestedvm)/build$(sep)$(nestedvm)/upstream/build/classgen/build \
60            org.ibex.nestedvm.Compiler \
61            -outformat class -d build -o unixRuntime \
62            org.sqlite.SQLite build/SQLite.mips
63
64clean:
65        rm -rf build
66        rm -rf dist
Note: See TracBrowser for help on using the browser.