1 # gnu make (also with cygwin) version
4 # get db params from config/config.ini
5 DATABASE_DSN := $(shell config/make-dbhelper.pl config/config.ini)
7 DB_DB := $(word 1,${DATABASE_DSN})
9 DB_USER := $(word 2,${DATABASE_DSN})
11 DB_PASS := $(word 3,${DATABASE_DSN})
14 DB_SQLITE_DBFILE = /tmp/phpwiki-sqlite.db
15 # ****************************************************************************
16 PHP_SRC := $(wildcard *.php ./lib/*.php ./lib/WikiDB/*.php ./lib/plugin/*.php)
18 .PHONY: all locale mysql psql sqlite
24 if [ -f $@ ]; then /usr/bin/mv -f $@ $@~; fi
25 /usr/bin/find . \( -type d -regex '\(^\./lib/pear\)\|\(^\./lib/WikiDB/adodb\)\|\(^\./lib/nusoap\)\|\(^\./lib/fpdf\)\|\(^\./locale/.*/LC_MESSAGES\)' \) -prune -o -name \*.php | etags -L -
28 if [ -f $@ ]; then /usr/bin/mv -f $@ $@~; fi
29 /usr/bin/find . -name \*.php -o -name \*.tmpl | etags -L - --langmap="HTML:.tmpl" -f $@;
35 DB_OPTS=-u$(DB_ADMINUSER) -p$(DB_ADMINPASS)
38 echo DB_OPTS=$(DB_OPTS) DB_DB=$(DB_DB) DB_USER=${DB_USER} DB_PASS=${DB_PASS}
40 # initialize the database
42 mysqladmin $(DB_OPTS) create $(DB_DB)
43 mysql $(DB_OPTS) -e "GRANT select,insert,update,delete,lock tables ON $(DB_DB).* \
44 TO $(DB_USER)@localhost IDENTIFIED BY '$(DB_PASS)';"
45 mysql $(DB_OPTS) $(DB_DB) < schemas/mysql.sql
47 # initialize the database
52 createuser -D -A -P $(DB_USER)
54 createuser -D -A $(DB_USER)
56 psql $(DB_DB) -f schemas/psql.sql
59 # initialize the database
61 sqlite $(DB_SQLITE_DBFILE) < schemas/sqlite.sql
64 ${DB_SQLITE_DBFILE}: schemas/sqlite.sql
65 echo ".dump" | sqlite ${DB_SQLITE_DBFILE} > dump.sql
66 mv ${DB_SQLITE_DBFILE} ${DB_SQLITE_DBFILE}.old
67 sqlite $(DB_SQLITE_DBFILE) < dump.sql