Module: sip-router
Branch: master
Commit: 1f36a7beaaac6eacdc5bebd76e0830aba9af7f55
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1f36a7b…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Oct 1 18:32:34 2009 +0200
sr: add 'make dbschema' target, compatibility to kamailio
---
Makefile | 6 +++++
lib/srdb1/schema/Makefile | 47 +++++++++++++++++++++++----------------------
2 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/Makefile b/Makefile
index dfe5ea3..3a399a6 100644
--- a/Makefile
+++ b/Makefile
@@ -949,3 +949,9 @@ clean_cfg clean-cfg:
.PHONY: clean_modules_cfg clean-modules-cfg
clean_modules_cfg clean-modules-cfg:
rm -f modules.lst
+
+.PHONY: dbschema
+dbschema:
+ -@echo "Build database schemas"
+ $(MAKE) -C lib/srdb1/schema
+ -@echo "Done"
diff --git a/lib/srdb1/schema/Makefile b/lib/srdb1/schema/Makefile
index 05cbae1..354bb4e 100644
--- a/lib/srdb1/schema/Makefile
+++ b/lib/srdb1/schema/Makefile
@@ -5,8 +5,9 @@
# Kamailio database descriptions for modules
TABLES := $(patsubst kamailio-%.xml,%,$(wildcard kamailio-*.xml))
-ROOT=../..
-STYLESHEETS=$(ROOT)/doc/dbschema/xsl
+ROOT=../../../
+STYLESHEETS=$(ROOT)/doc/stylesheets/dbschema_k/xsl
+SCHEME=$(ROOT)/tools/kamctl/
# Stylesheet used to generate MySQL database schema
MYSQL_XSL = $(STYLESHEETS)/mysql.xsl
@@ -42,7 +43,7 @@ VALIDATE = 0
VERBOSE = 0
# XML Catalog used to resolve entities
-CATALOG = $(ROOT)/doc/dbschema/catalog.xml
+CATALOG = $(ROOT)/docbook/catalog.xml
XSLTPROC = /usr/bin/xsltproc
XSLTPROC_FLAGS = --xinclude
@@ -61,56 +62,56 @@ all: mysql postgres dbtext db_berkeley docbook oracle #modules dbdoc
mysql:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/scripts/mysql" \
+ --stringparam dir "$(SCHEME)/mysql" \
--stringparam prefix "$$FILE-" \
--stringparam db "mysql" \
$(MYSQL_XSL) kamailio-"$$FILE".xml ; \
done
mysql_clean:
- -@rm -f $(ROOT)/scripts/mysql/*
+ -@rm -f $(SCHEME)/mysql/*
.PHONY: postgres postgres_clean
postgres:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/scripts/postgres" \
+ --stringparam dir "$(SCHEME)/postgres" \
--stringparam prefix "$$FILE-" \
--stringparam db "postgres" \
$(POSTGRES_XSL) kamailio-"$$FILE".xml ; \
done
postgres_clean:
- -@rm -f $(ROOT)/scripts/postgres/*
+ -@rm -f $(SCHEME)/postgres/*
.PHONY: oracle oracle_clean
oracle:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/scripts/oracle" \
+ --stringparam dir "$(SCHEME)/oracle" \
--stringparam prefix "$$FILE-" \
--stringparam db "oracle" \
$(ORACLE_XSL) kamailio-"$$FILE".xml ; \
done
oracle_clean:
- -@rm -f $(ROOT)/scripts/oracle/*.sql
+ -@rm -f $(SCHEME)/oracle/*.sql
.PHONY: dbtext dbtext_clean
dbtext:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/scripts/dbtext/kamailio" \
+ --stringparam dir "$(SCHEME)/dbtext/kamailio" \
--stringparam prefix "" \
--stringparam db "dbtext" \
$(DBTEXT_XSL) kamailio-"$$FILE".xml ; \
done
TMPFILE=`mktemp -t kamailio-test.XXXXXXXXXX`
# small hack to create the version table entries, this is here easier as with XSL
- for FILE in $(wildcard $(ROOT)/scripts/dbtext/kamailio/*) ; do \
+ for FILE in $(wildcard $(SCHEME)/dbtext/kamailio/*) ; do \
if [ -f "$$FILE" ]; then \
- if [ "$$FILE" != "$(ROOT)/scripts/dbtext/kamailio/version" ];
then \
- tail -n 1 "$$FILE" >>
"$(ROOT)/scripts/dbtext/kamailio/version" ; \
+ if [ "$$FILE" != "$(SCHEME)/dbtext/kamailio/version" ]; then \
+ tail -n 1 "$$FILE" >> "$(SCHEME)/dbtext/kamailio/version" ;
\
head -n 1 "$$FILE" > $TMPFILE ; \
cp $TMPFILE "$$FILE" ; \
fi ; \
@@ -119,23 +120,23 @@ dbtext:
rm -f $TMPFILE
dbtext_clean:
- -@rm -f $(ROOT)/scripts/dbtext/kamailio/*
+ -@rm -f $(SCHEME)/dbtext/kamailio/*
.PHONY: db_berkeley db_berkeley_clean
db_berkeley:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/scripts/db_berkeley/kamailio" \
+ --stringparam dir "$(SCHEME)/db_berkeley/kamailio" \
--stringparam prefix "" \
--stringparam db "db_berkeley" \
$(DB_BERKELEY_XSL) kamailio-"$$FILE".xml ; \
done
TMPFILE=`mktemp -t kamailio-test.XXXXXXXXXX`
# small hack to create the version table entries, this is here easier as with XSL
- for FILE in $(wildcard $(ROOT)/scripts/db_berkeley/kamailio/*) ; do \
+ for FILE in $(wildcard $(SCHEME)/db_berkeley/kamailio/*) ; do \
if [ -f "$$FILE" ]; then \
- if [ "$$FILE" != "$(ROOT)/scripts/db_berkeley/kamailio/version"
]; then \
- tail -n 2 "$$FILE" >>
"$(ROOT)/scripts/db_berkeley/kamailio/version" ; \
+ if [ "$$FILE" != "$(SCHEME)/db_berkeley/kamailio/version" ]; then
\
+ tail -n 2 "$$FILE" >>
"$(SCHEME)/db_berkeley/kamailio/version" ; \
head -n 10 "$$FILE" > $TMPFILE ; \
cp $TMPFILE "$$FILE" ; \
fi ; \
@@ -144,7 +145,7 @@ db_berkeley:
rm -f $TMPFILE
db_berkeley_clean:
- -@rm -f $(ROOT)/scripts/db_berkeley/kamailio/*
+ -@rm -f $(SCHEME)/db_berkeley/kamailio/*
.PHONY: docbook docbook_clean
@@ -168,7 +169,7 @@ docbook:
echo " <!ENTITY % docentities SYSTEM \"../entities.xml\">
%docentities;" >> "$(ROOT)/doc/database/tables.sgml" ; \
echo "]>" >> "$(ROOT)/doc/database/tables.sgml"
# add bookinfo
- cat "$(ROOT)/doc/dbschema/bookinfo.xml" >>
"$(ROOT)/doc/database/tables.sgml"
+ cat "$(ROOT)/doc/stylesheets/dbschema_k/bookinfo.xml" >>
"$(ROOT)/doc/database/tables.sgml"
# actually include the entities
for FILE in $(wildcard $(ROOT)/doc/database/*.xml); do \
echo " &`basename "$$FILE" | sed -e 's#_#-#g'`"
>> "$(ROOT)/doc/database/tables.sgml" ; \
@@ -183,7 +184,7 @@ docbook_clean:
modules:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/modules/$$FILE/" \
+ --stringparam dir "$(ROOT)/modules_k/$$FILE/" \
--stringparam prefix "$$FILE" \
--stringparam db "modules" \
$(MODULES_H_XSL) kamailio-"$$FILE".xml ; \
@@ -191,7 +192,7 @@ modules:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/modules/$$FILE/" \
+ --stringparam dir "$(ROOT)/modules_k/$$FILE/" \
--stringparam prefix "$$FILE" \
--stringparam db "modules" \
$(MODULES_C_XSL) kamailio-"$$FILE".xml ; \
@@ -206,7 +207,7 @@ modules_clean:
dbdoc:
for FILE in $(TABLES); do \
XML_CATALOG_FILES=$(CATALOG) $(XSLTPROC) $(XSLTPROC_FLAGS) \
- --stringparam dir "$(ROOT)/modules/$$FILE/doc/" \
+ --stringparam dir "$(ROOT)/modules_k/$$FILE/doc/" \
--stringparam prefix "$$FILE" \
--stringparam db "modules" \
$(DBDOC_XSL) kamailio-"$$FILE".xml ; \