include Make.conf

export INSTALL_DIR
export INSTALL_PATH
# slightly modified phplib
PHPLIB_FILES=auth.php session.php

SUB_DIRS=po

FILES = admin.php upgrade.php base.sql index.html \
	$(PHPLIB_FILES) \
	loginform.ihtml \
	photos.php remindpassword.php slooze.php \
	slooze_ct_sql.php slooze_render.php query.php \
	tof_auth.php tof_session.php \
	picture.php timer.php \
	pdf.php phppdflib/*.php phppdflib/*.kern \
	render/*.php \
	actions/*.php \
	*.css \
	*.js \
	*.png \
	db_pgsql.php ct_sql.php page.php session.php auth.php \
	forbidden.jpg

INSTALL_FILES=*.php *.ihtml *.css *.png *.jpg *.js render actions phppdflib

.PHONY : clean archive install po tag

archive:
	cvs -q export -r v`echo $(VERSION) | tr . _` tof; \
	TMP_DIR=tof-$(VERSION); \
	ARCHIVE=tof-$(VERSION).tar.gz; \
	mv tof $$TMP_DIR; \
	tar zcf $$ARCHIVE $$TMP_DIR; \
	rm -rf $$TMP_DIR

install: preinstall
	tar c --exclude-from=install-exclude $(INSTALL_FILES) | (cd $(INSTALL_DIR); tar x)
	if [ ! -e $(INSTALL_DIR)/config.php ]; then cp config.php $(INSTALL_DIR); fi
	for d in $(SUB_DIRS); do $(MAKE) -C $$d install; done

preinstall:
	@test -d $(INSTALL_DIR) || ( echo "$(INSTALL_DIR) does not exists"; false )

install-ssh: .install-ssh
	for d in $(SUB_DIRS); do $(MAKE) -C $$d install-ssh; done

.install-ssh:
	rsync -rl -e ssh --exclude-from=install-exclude $(INSTALL_FILES) $(INSTALL_PATH)

po:
	$(MAKE) -C po

# Build TAGS file
TAGS:
	etags *.php phppdflib/*.php

# tag CVS repository with current version number
tag:
	cvs tag -F v`echo $(VERSION) | tr . _`;

clean:
	rm -f *~
