2 # user-definable settings:
8 # etags (GNU Emacs 21.4.x)
9 ETAGS_21_5=$(shell etags --version|egrep "Ctags 5.[67]")
10 ifeq ("$(ETAGS_21_5)", "")
11 ETAGS_STDIN = /usr/bin/etags -
13 # new etags (GNU Emacs 21.5.x)
14 ETAGS_STDIN = /usr/bin/etags -L -
17 ifeq ("$(VERSION)", "")
18 TARDIST = ../phpwiki.tar.bz2
20 TARDIST = ../phpwiki-$(VERSION).tar.bz2
22 DB_SQLITE_DBFILE = /tmp/phpwiki-sqlite.db
24 # ****************************************************************************
25 # get db params from config/config.ini
28 DATABASE_TYPE := $(shell config/make-dbhelper.pl -v=DATABASE_TYPE config/config.ini)
30 ifeq (${DATABASE_TYPE},SQL)
33 ifeq (${DATABASE_TYPE},ADODB)
38 ifeq (${PROCESS_DSN},1)
39 # get db params from config/config.ini DATABASE_DSN setting (only if SQL or ADODB)
40 DATABASE_DSN := $(shell config/make-dbhelper.pl -v=DATABASE_DSN config/config.ini)
42 DB_DBTYPE := $(word 1,${DATABASE_DSN})
44 DB_DB := $(word 2,${DATABASE_DSN})
46 DB_USER := $(word 3,${DATABASE_DSN})
48 DB_PASS := $(word 4,${DATABASE_DSN})
49 #Todo: read optional DBADMIN_USER and DBADMIN_PASS settings from config.ini
50 DBADMIN_OPTS=-u$(DBADMIN_USER) -p$(DBADMIN_PASS)
52 DB_DBTYPE=${DATABASE_TYPE}
55 # ****************************************************************************
56 PHP_SRC := $(wildcard *.php ./lib/*.php ./lib/WikiDB/*.php ./lib/plugin/*.php)
58 .PHONY: all install locale mysql pqsql sqlite dbtest install-config dist
63 if [ -f $@ ]; then /bin/mv -f $@ $@~; fi
65 /usr/bin/find . \( -type d -regex '\(^\./lib/pear\)\|\(^\./lib/WikiDB/adodb\)\|\(^\./lib/nusoap\)\|\(^\./lib/fpdf\)\|\(^\./locale/.*/LC_MESSAGES\)' \) -prune -o -type f -name \*.php | grep .php | $(ETAGS_STDIN)
68 if [ -f $@ ]; then /usr/bin/mv -f $@ $@~; fi
69 /usr/bin/find . -name \*.php -o -name \*.tmpl | $(ETAGS_STDIN) --langmap="HTML:.tmpl" -f $@
70 # older etags needed this:
71 # /usr/bin/find . -type f -name \*.php -o -name \*.tmpl | etags - -o $@
77 install: install-config install-database
79 install-config: config/config.ini
81 config/config.ini: config/config-dist.ini
82 cp config/config-dist.ini $@
83 echo "You must edit config/config.ini, at least set the ADMIN_PASSWD"
86 # helpers for database installation
87 install-database: ${DB_DBTYPE}
93 # maybe setup permissions
97 echo DATABASE_TYPE=${DATABASE_TYPE} DB_DBTYPE=${DB_DBTYPE} DB_DB=$(DB_DB) DB_USER=${DB_USER} DB_PASS=${DB_PASS} DBADMIN_OPTS=$(DBADMIN_OPTS)
99 # initialize the database
100 # TODO: compare /var/mysql/data/$(DB_DB) timestamp against schemas/mysql.sql
102 mysqladmin $(DB_OPTS) create $(DB_DB)
103 mysql $(DB_OPTS) -e "GRANT select,insert,update,delete,lock tables ON $(DB_DB).* \
104 TO $(DB_USER)@localhost IDENTIFIED BY '$(DB_PASS)';"
105 mysql $(DB_OPTS) $(DB_DB) < schemas/mysql-initialize.sql
107 # initialize the database
112 createuser -D -A -P $(DB_USER)
114 createuser -D -A $(DB_USER)
116 psql $(DB_DB) -f schemas/psql-initialize.sql
119 # initialize the database
120 sqlite: $(DB_SQLITE_DBFILE)
121 sqlite $(DB_SQLITE_DBFILE) < schemas/sqlite-initialize.sql
123 # update the database
124 ${DB_SQLITE_DBFILE}: schemas/sqlite.sql
125 echo ".dump" | sqlite ${DB_SQLITE_DBFILE} > dump.sql
126 mv ${DB_SQLITE_DBFILE} ${DB_SQLITE_DBFILE}.old
127 sqlite $(DB_SQLITE_DBFILE) < dump.sql
133 tar cfj $(TARDIST) --exclude=CVS \
134 --exclude=config.ini \
142 --exclude=TAGS.full \
143 --exclude='*.tar.bz2' \