SV_DIR=/home/moa/projects/savane
SV_CONF=/etc/savannah
SV_CONF_INTERACTIVE=yes
SV_BIN=/usr/local/bin
PERL_INC=/usr/local/lib/site_perl
INSTALLNLSDIR=/usr/share/locale
SV_URLROOT=/savannah
SV_DB=mysql
SV_DB_NAME=savannah
SV_DB_CMD=mysql
SV_DB_OPTIONS=
MM_CGI_DIR=
WWW_SERVER_USER=www-data
 
#PERL_INC = /usr/local/lib/site_perl
SV_CONF_DEFAULT=/etc/savannah/local.inc
CONTAIN_SV_CONF = Savannah.pm

SUBMODULES = $(shell ls Savannah/*pm)

update-path:
	make reset-path
# Need to discuss if this path should be totally configurable or if
# $prefix/etc/savannah is acceptable where prefix = / || /usr || /usr/local
#	cat $(CONTAIN_SV_CONF) | sed s@^our.*conffile.*@our\ \$$conffile\ \=\ \"$(SV_CONF)/local.inc.pl\"\;@g > tmp
#	mv -f tmp $(CONTAIN_SV_CONF)


reset-path:
# Need to discuss if this path should be totally configurable or if
# $prefix/etc/savannah is acceptable where prefix = / || /usr || /usr/local
#	cat $(CONTAIN_SV_CONF) | sed s@^our.*conffile.*@our\ \$$conffile\ \=\ \"$(SV_CONF)/local.inc.pl\"\;@g > tmp
#	mv -f tmp $(CONTAIN_SV_CONF)

update-exports:
# How can we update our @EXPORT in a easy way? Do not know, so we do it
# this way, in the meantime.
# This command is supposed to be ran after addition of new subs.
	for module in $(SUBMODULES); do \
		cat $$module | grep ^sub | sed s/^sub\ //g  | sed s/\ \{.*//g | sed s/$$^//g | tr "\n" " " > tmpsub ; \
		cat $$module | sed s/^our\ \@EXPORT.*/our\ \@EXPORT\ \=\ qw\("`cat tmpsub`"\)\;/g > tmp ; \
		mv -f tmp $$module ; \
	done
	rm -f tmp*

install:
	if [ ! -e $(PERL_INC) ]; then mkdir -p $(PERL_INC) ; fi
	install Savannah.pm $(PERL_INC)
	cp -rf Savannah $(PERL_INC)

uninstall:
	rm -rf $(PERL_INC)/Savannah.pm $(PERL_INC)/Savannah

clean:
	rm -f Makefile
	if [ -x /usr/bin/darius-mrclean ]; then /usr/bin/darius-mrclean . ; fi
