| 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/%.class: src/org/%.java |
|---|
| 19 | @mkdir -p build |
|---|
| 20 | $(JAVAC) -source 1.2 -target 1.2 -classpath "$(nestedvm)/build" \ |
|---|
| 21 | -sourcepath src -d build $< |
|---|
| 22 | |
|---|
| 23 | build/test/%.class: src/test/%.java |
|---|
| 24 | @mkdir -p build |
|---|
| 25 | $(JAVAC) -target 1.5 -classpath "build$(sep)$(libjunit)" \ |
|---|
| 26 | -sourcepath src/test -d build $< |
|---|
| 27 | |
|---|
| 28 | $(nestedvm)/%: |
|---|
| 29 | $(MAKE) -C $(nestedvm) $* |
|---|
| 30 | |
|---|
| 31 | dl/$(nestedvm).tgz: |
|---|
| 32 | @mkdir -p dl |
|---|
| 33 | curl -odl/$(nestedvm).tgz http://files.zentus.com/sqlitejdbc/$(nestedvm).tgz |
|---|
| 34 | |
|---|
| 35 | dl/$(sqlite)-amal.zip: |
|---|
| 36 | @mkdir -p dl |
|---|
| 37 | curl -odl/$(sqlite)-amal.zip \ |
|---|
| 38 | http://www.sqlite.org/sqlite-amalgamation-$(subst .,_,$(sqlite_version)).zip |
|---|
| 39 | |
|---|
| 40 | $(nestedvm)/Makefile: dl/$(nestedvm).tgz |
|---|
| 41 | tar xfz dl/$(nestedvm).tgz |
|---|
| 42 | |
|---|
| 43 | build/SQLite.mips: $(nestedvm)/Makefile $(nestedvm)/env.sh dl/$(sqlite)-amal.zip |
|---|
| 44 | @mkdir -p build |
|---|
| 45 | @mkdir -p build/$(sqlite)-nestedvm |
|---|
| 46 | unzip -qo dl/$(sqlite)-amal.zip -d build/$(sqlite)-nestedvm |
|---|
| 47 | cp src/org/sqlite/Nested*.c build/$(sqlite)-nestedvm |
|---|
| 48 | perl -pi -e "s/sqlite3_api;/sqlite3_api = 0;/g" \ |
|---|
| 49 | build/$(sqlite)-nestedvm/sqlite3ext.h |
|---|
| 50 | |
|---|
| 51 | # we need a dummy main |
|---|
| 52 | echo 'int main() { return 0; }' >> build/$(sqlite)-nestedvm/sqlite3.c |
|---|
| 53 | |
|---|
| 54 | (. ./$(nestedvm)/env.sh; cd build/$(sqlite)-nestedvm; \ |
|---|
| 55 | $$CC -c $$CFLAGS -o sqlite3.o \ |
|---|
| 56 | -DSQLITE_THREADSAFE=0 \ |
|---|
| 57 | -DSQLITE_ENABLE_COLUMN_METADATA \ |
|---|
| 58 | -DSQLITE_CORE \ |
|---|
| 59 | -DSQLITE_ENABLE_FTS3 \ |
|---|
| 60 | -DSQLITE_OMIT_LOAD_EXTENSION \ |
|---|
| 61 | sqlite3.c; \ |
|---|
| 62 | $$CC -c $$CFLAGS -o NestedDB.o Nested*.c) |
|---|
| 63 | |
|---|
| 64 | ./$(nestedvm)/upstream/install/bin/mips-unknown-elf-gcc \ |
|---|
| 65 | -march=mips1 --static \ |
|---|
| 66 | -o $@ build/$(sqlite)-nestedvm/sqlite3.o \ |
|---|
| 67 | build/$(sqlite)-nestedvm/NestedDB.o |
|---|
| 68 | |
|---|
| 69 | build/org/sqlite/SQLite.class: build/SQLite.mips |
|---|
| 70 | java -cp $(nestedvm)/build$(sep)$(nestedvm)/upstream/build/classgen/build \ |
|---|
| 71 | org.ibex.nestedvm.Compiler \ |
|---|
| 72 | -outformat class -d build -o unixRuntime \ |
|---|
| 73 | org.sqlite.SQLite build/SQLite.mips |
|---|
| 74 | |
|---|
| 75 | clean: |
|---|
| 76 | rm -rf build |
|---|
| 77 | rm -rf dist |
|---|