summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/configure10
-rw-r--r--tools/database/database.c29
-rw-r--r--tools/database/database.make54
3 files changed, 43 insertions, 50 deletions
diff --git a/tools/configure b/tools/configure
index b01d505c9a..aa787d3708 100755
--- a/tools/configure
+++ b/tools/configure
@@ -3530,6 +3530,7 @@ fi
toolset='';
t_cpu='';
GCCOPTS='';
+ rbdir='.'
extradefines="$extradefines -DDEBUG"
appsdir='$(ROOTDIR)/tools/checkwps';
output='checkwps.'${modelname};
@@ -3538,10 +3539,8 @@ fi
;;
[Dd])
uname=`uname`
- simcc "database"
+ simcc "database-sdl"
toolset='';
- t_cpu='';
- GCCOPTS='';
appsdir='$(ROOTDIR)/tools/database';
archosrom='';
@@ -3553,7 +3552,10 @@ fi
output='database.'${modelname};
;;
esac
-
+ # architecture, manufacturer and model for the target-tree build
+ t_cpu="hosted"
+ t_manufacturer="sdl"
+ t_model="database"
echo "Database tool build selected"
;;
[Ww])
diff --git a/tools/database/database.c b/tools/database/database.c
index 0f9304eb0a..30f1c39626 100644
--- a/tools/database/database.c
+++ b/tools/database/database.c
@@ -2,26 +2,37 @@
#include <stdbool.h>
#include <stdio.h>
+#include <errno.h>
#include <sys/stat.h>
+
+#include "config.h"
#include "tagcache.h"
+#include "dir.h"
+
+/* This is meant to be run on the root of the dap. it'll put the db files into
+ * a .rockbox subdir */
int main(int argc, char **argv)
{
+ (void)argc;
+ (void)argv;
+
+ errno = 0;
+ if (mkdir(ROCKBOX_DIR) == -1 && errno != EEXIST)
+ return 1;
+
+ /* / is actually ., will get translated in io.c
+ * (with the help of sim_root_dir below */
+ const char *paths[] = { "/", NULL };
tagcache_init();
- tagcache_build(".");
+ do_tagcache_build(paths);
tagcache_reverse_scan();
return 0;
}
-/* stub to avoid including all of apps/misc.c */
-bool file_exists(const char *file)
-{
- struct stat s;
- if (!stat(file, &s))
- return true;
- return false;
-}
+/* needed for io.c */
+const char *sim_root_dir = ".";
/* stubs to avoid including thread-sdl.c */
#include "kernel.h"
diff --git a/tools/database/database.make b/tools/database/database.make
index 49ad2ff9bc..89a4aa7d85 100644
--- a/tools/database/database.make
+++ b/tools/database/database.make
@@ -7,8 +7,7 @@
# $Id: checkwps.make 22680 2009-09-11 17:58:17Z gevaerts $
#
-DBDEFINES=-g -DDEBUG -D__PCTOOL__
-CFLAGS+=$(DBDEFINES)
+GCCOPTS += -g -DDEBUG -D__PCTOOL__ -DDBTOOL
createsrc = $(shell cat $(1) > $(3); echo "\#if CONFIG_CODEC == SWCODEC" >> $(3); \
echo $(2) | sed 's/ /\n/g' >> $(3); \
@@ -21,44 +20,25 @@ SRCFILE := $(call createsrc, $(TOOLSDIR)/database/SOURCES, \
$(METADATAS), \
$(TOOLSDIR)/database/SOURCES.build)
-SRC= $(call preprocess, $(SRCFILE))
+DATABASE_SRC = $(call preprocess, $(SRCFILE))
+DATABASE_OBJ = $(call c2obj,$(DATABASE_SRC))
-INCLUDES = -I$(ROOTDIR)/apps/gui \
- -I$(ROOTDIR)/firmware/export \
- -I$(ROOTDIR)/firmware/include \
- -I$(ROOTDIR)/apps \
- -I$(ROOTDIR)/apps/recorder \
- -I$(ROOTDIR)/lib/rbcodec \
- -I$(ROOTDIR)/lib/rbcodec/metadata \
- -I$(ROOTDIR)/lib/rbcodec/dsp \
- -I$(APPSDIR) \
- -I$(BUILDDIR) \
+OTHER_SRC += $(DATABASE_SRC)
-SIMINCLUDES += -I$(FIRMDIR)/target/hosted/sdl -I$(FIRMDIR)/target/hosted \
- -I$(ROOTDIR)/uisimulator/common -I$(FIRMDIR)/export -I$(BUILDDIR) -I$(APPSDIR)
+INCLUDES += -I$(ROOTDIR)/apps/gui \
+ -I$(ROOTDIR)/firmware/export \
+ -I$(ROOTDIR)/firmware/include \
+ -I$(ROOTDIR)/apps \
+ -I$(ROOTDIR)/apps/recorder \
+ -I$(ROOTDIR)/lib/rbcodec \
+ -I$(ROOTDIR)/lib/rbcodec/metadata \
+ -I$(ROOTDIR)/lib/rbcodec/dsp \
+ -I$(APPSDIR) \
+ -I$(BUILDDIR)
-# Makes mkdepfile happy
-GCCOPTS+=`$(SDLCONFIG) --cflags`
-OLDGCCOPTS:=$(GCCOPTS)
-GCCOPTS+=-D__PCTOOL__ -fno-builtin $(INCLUDES) $(SIMINCLUDES)
-
-LIBS=`$(SDLCONFIG) --libs` -lc
-ifneq ($(findstring MINGW,$(shell uname)),MINGW)
-LIBS += -ldl
-endif
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
-SIMFLAGS += $(SIMINCLUDES) $(DBDEFINES) -DHAVE_CONFIG_H $(OLDGCCOPTS) $(INCLUDES)
-
-$(BUILDDIR)/$(BINARY): $$(OBJ)
- @echo LD $(BINARY)
- $(SILENT)$(HOSTCC) $(SIMFLAGS) $(LIBS) -o $@ $+
-
-$(BUILDDIR)/tools/database/../../uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c
- $(SILENT)mkdir -p $(dir $@)
- $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@
-
-$(BUILDDIR)/tools/database/database.o: $(APPSDIR)/database.c
- $(SILENT)mkdir -p $(dir $@)
- $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@
+$(BUILDDIR)/$(BINARY): $$(DATABASE_OBJ)
+ $(call PRINTS,LD $(BINARY))
+ $(SILENT)$(HOSTCC) -o $@ $+