3 # user-definable settings:
8 # etags (GNU Emacs 21.4.x)
9 ETAGS_21_5=$(shell etags --version|egrep "Ctags 5.[6789]")
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 VERSION=$(shell admin/dump-version.pl)
19 ifeq ("$(VERSION)", "")
20 TARDIST = phpwiki.tar.bz2
22 TARDIST = phpwiki-$(VERSION).tar.bz2
24 DB_SQLITE_DBFILE = /tmp/phpwiki-sqlite.db
26 # ****************************************************************************
27 # get db params from config/config.ini
30 DATABASE_TYPE := $(shell config/make-dbhelper.pl -v=DATABASE_TYPE config/config.ini)
32 ifeq (${DATABASE_TYPE},SQL)
35 ifeq (${DATABASE_TYPE},ADODB)
40 ifeq (${PROCESS_DSN},1)
41 # get db params from config/config.ini DATABASE_DSN setting (only if SQL or ADODB)
42 DATABASE_DSN := $(shell config/make-dbhelper.pl -v=DATABASE_DSN config/config.ini)
44 DB_DBTYPE := $(word 1,${DATABASE_DSN})
46 DB_DB := $(word 2,${DATABASE_DSN})
48 DB_USER := $(word 3,${DATABASE_DSN})
50 DB_PASS := $(word 4,${DATABASE_DSN})
51 #Todo: read optional DBADMIN_USER and DBADMIN_PASS settings from config.ini
52 DBADMIN_OPTS=-u$(DBADMIN_USER) -p$(DBADMIN_PASS)
54 DB_DBTYPE=${DATABASE_TYPE}
57 # ****************************************************************************
58 PHP_SRC := $(wildcard *.php ./lib/*.php ./lib/WikiDB/*.php ./lib/plugin/*.php)
60 .PHONY: all install locale mysql pqsql sqlite dbtest install-config dist
65 if [ -f $@ ]; then /bin/mv -f $@ $@~; fi
67 /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)
70 if [ -f $@ ]; then /usr/bin/mv -f $@ $@~; fi
71 /usr/bin/find . -name \*.php -o -name \*.tmpl | $(ETAGS_STDIN) --langmap="HTML:.tmpl" -f $@
72 # older etags needed this:
73 # /usr/bin/find . -type f -name \*.php -o -name \*.tmpl | etags - -o $@
83 install: install-config install-database themes
85 install-config: config/config.ini
87 config/config.ini: config/config-dist.ini
88 cp config/config-dist.ini $@
89 echo "You must edit config/config.ini, at least set the ADMIN_PASSWD"
92 # helpers for database installation
93 install-database: ${DB_DBTYPE}
99 # maybe setup permissions
103 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)
105 # initialize the database
106 # TODO: compare /var/mysql/data/$(DB_DB) timestamp against schemas/mysql.sql
108 mysqladmin $(DB_OPTS) create $(DB_DB)
109 mysql $(DB_OPTS) -e "GRANT select,insert,update,delete,lock tables ON $(DB_DB).* \
110 TO $(DB_USER)@localhost IDENTIFIED BY '$(DB_PASS)';"
111 mysql $(DB_OPTS) $(DB_DB) < schemas/mysql-initialize.sql
113 # initialize the database
118 createuser -D -A -P $(DB_USER)
120 createuser -D -A $(DB_USER)
122 psql $(DB_DB) -f schemas/psql-initialize.sql
125 # initialize the database
126 sqlite: $(DB_SQLITE_DBFILE)
127 sqlite $(DB_SQLITE_DBFILE) < schemas/sqlite-initialize.sql
129 # update the database
130 ${DB_SQLITE_DBFILE}: schemas/sqlite.sql
131 echo ".dump" | sqlite ${DB_SQLITE_DBFILE} > dump.sql
132 mv ${DB_SQLITE_DBFILE} ${DB_SQLITE_DBFILE}.old
133 sqlite $(DB_SQLITE_DBFILE) < dump.sql
137 cvstar: ../$(TARDIST)
140 ../$(TARDIST) : $(PHP_SRC)
141 tar cfj $(TARDIST) --exclude=CVS \
142 --exclude=config.ini \
150 --exclude=TAGS.full \
151 --exclude='*.tar.bz2' \
154 $(TARDIST) : $(PHP_SRC)
155 svn list -R | egrep -v "/\$" | tar cfj $(TARDIST)