4 # user-definable settings:
9 # etags (GNU Emacs 21.4.x)
10 ETAGS_21_5=$(shell etags --version|egrep "Ctags 5.[6789]")
11 ifeq ("$(ETAGS_21_5)", "")
12 ETAGS_STDIN = /usr/bin/etags -
14 # new etags (GNU Emacs 21.5.x)
15 ETAGS_STDIN = /usr/bin/etags -L -
18 VERSION=$(shell admin/dump-version.pl)
20 ifeq ("$(VERSION)", "")
21 TARDIST = phpwiki.tar.bz2
23 TARDIST = phpwiki-$(VERSION).tar.bz2
25 DB_SQLITE_DBFILE = /tmp/phpwiki-sqlite.db
27 # ****************************************************************************
28 # get db params from config/config.ini
31 DATABASE_TYPE := $(shell config/make-dbhelper.pl -v=DATABASE_TYPE config/config.ini)
33 ifeq (${DATABASE_TYPE},SQL)
36 ifeq (${DATABASE_TYPE},ADODB)
41 ifeq (${PROCESS_DSN},1)
42 # get db params from config/config.ini DATABASE_DSN setting (only if SQL or ADODB)
43 DATABASE_DSN := $(shell config/make-dbhelper.pl -v=DATABASE_DSN config/config.ini)
45 DB_DBTYPE := $(word 1,${DATABASE_DSN})
47 DB_DB := $(word 2,${DATABASE_DSN})
49 DB_USER := $(word 3,${DATABASE_DSN})
51 DB_PASS := $(word 4,${DATABASE_DSN})
52 #Todo: read optional DBADMIN_USER and DBADMIN_PASS settings from config.ini
53 DBADMIN_OPTS=-u$(DBADMIN_USER) -p$(DBADMIN_PASS)
55 DB_DBTYPE=${DATABASE_TYPE}
58 # ****************************************************************************
59 PHP_SRC := $(wildcard *.php ./lib/*.php ./lib/WikiDB/*.php ./lib/plugin/*.php)
61 .PHONY: all install locale mysql pqsql sqlite dbtest install-config dist
66 if [ -f $@ ]; then /bin/mv -f $@ $@~; fi
68 /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)
71 if [ -f $@ ]; then /usr/bin/mv -f $@ $@~; fi
72 /usr/bin/find . -name \*.php -o -name \*.tmpl | $(ETAGS_STDIN) --langmap="HTML:.tmpl" -f $@
73 # older etags needed this:
74 # /usr/bin/find . -type f -name \*.php -o -name \*.tmpl | etags - -o $@
84 install: install-config install-database themes
86 install-config: config/config.ini
88 config/config.ini: config/config-dist.ini
89 cp config/config-dist.ini $@
90 echo "You must edit config/config.ini, at least set the ADMIN_PASSWD"
93 # helpers for database installation
94 install-database: ${DB_DBTYPE}
100 # maybe setup permissions
104 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)
106 # initialize the database
107 # TODO: compare /var/mysql/data/$(DB_DB) timestamp against schemas/mysql.sql
109 mysqladmin $(DB_OPTS) create $(DB_DB)
110 mysql $(DB_OPTS) -e "GRANT select,insert,update,delete,lock tables ON $(DB_DB).* \
111 TO $(DB_USER)@localhost IDENTIFIED BY '$(DB_PASS)';"
112 mysql $(DB_OPTS) $(DB_DB) < schemas/mysql-initialize.sql
114 # initialize the database
119 createuser -D -A -P $(DB_USER)
121 createuser -D -A $(DB_USER)
123 psql $(DB_DB) -f schemas/psql-initialize.sql
126 # initialize the database
127 sqlite: $(DB_SQLITE_DBFILE)
128 sqlite $(DB_SQLITE_DBFILE) < schemas/sqlite-initialize.sql
130 # update the database
131 ${DB_SQLITE_DBFILE}: schemas/sqlite.sql
132 echo ".dump" | sqlite ${DB_SQLITE_DBFILE} > dump.sql
133 mv ${DB_SQLITE_DBFILE} ${DB_SQLITE_DBFILE}.old
134 sqlite $(DB_SQLITE_DBFILE) < dump.sql
138 cvstar: ../$(TARDIST)
141 ../$(TARDIST) : $(PHP_SRC)
142 tar cfj $(TARDIST) --exclude=CVS \
143 --exclude=config.ini \
151 --exclude=TAGS.full \
152 --exclude='*.tar.bz2' \
155 $(TARDIST) : $(PHP_SRC)
156 svn list -R | egrep -v "/\$" | tar cfj $(TARDIST)