# Makefile.in for Fugu

prefix=@prefix@
exec_prefix=@exec_prefix@

FUGUVERSION=@FUGUVERSION@
FUGUBINDIR=$(exec_prefix)/bin
FUGUSHARELIBDIR=$(prefix)/lib/fugu-$(FUGUVERSION)
FUGULIBDIR=$(exec_prefix)/lib/fugu-$(FUGUVERSION)
PYTHON=@PYTHON@

PYGALE_FILES=pygale.py __init__.py authcache.py gale_pack.py gale_env.py \
	prettypuff.py sign.py unicode.py engine.py asyncurl.py userinfo.py \
	ROOT.py gale_const.py version.py
OPENSSL_SO=opensslc.so
OPENSSL_FILES=__init__.py bn.py err.py evp.py log.py \
	rand.py rsa.py wrap.py
FUGU_SUPPORT_FILES=buttonbar.py puffdisp.py fugu-icon.xbm ui.py \
	pygalesetup.py search.py ScrolledText.py thumbcache.py connection.py \
	config.py DefaultConfig.py HistoryCombo.py

all:
	cd py-openssl; $(PYTHON) setup.py build --build-lib $(PWD)
	@echo "-------------------------------------------------------------"
	@echo 'Compilation complete.  Now do a make install.'
	@echo

clean:
	cd py-openssl; $(PYTHON) setup.py clean
	rm -rf openssl
	rm -f config.status config.log config.cache

install:
	@echo "Installing OpenSSL modules"
	if [ ! -d ${FUGULIBDIR}/openssl ]; then \
		./install-sh -d ${FUGULIBDIR}/openssl; \
	fi
	./install-sh -c openssl/${OPENSSL_SO} \
		${FUGULIBDIR}/openssl/${OPENSSL_SO}
	@for file in ${OPENSSL_FILES}; \
	do \
		echo $$file; \
		./install-sh -c openssl/$$file \
			${FUGULIBDIR}/openssl/$$file; \
	done
	
	@echo "Installing PyGale modules"
	if [ ! -d ${FUGUSHARELIBDIR}/pygale ]; then \
		./install-sh -d ${FUGUSHARELIBDIR}/pygale; \
	fi
	@for file in ${PYGALE_FILES}; \
	do \
		echo $$file;\
		./install-sh -c pygale/$$file ${FUGUSHARELIBDIR}/pygale/$$file; \
	done

	@echo "Installing Fugu"
	./install-sh -c fugu.py -m 0755 ${FUGUBINDIR}/fugu
	./install-sh -c pygale-config.py -m 0755 ${FUGUBINDIR}/pygale-config
	@for file in ${FUGU_SUPPORT_FILES}; \
	do \
		echo $$file; \
		./install-sh -c $$file ${FUGUSHARELIBDIR}/$$file; \
	done

	@echo "Byte-compiling Python sources"
	${PYTHON} -c 'import compileall; compileall.compile_dir("${FUGULIBDIR}")'
	${PYTHON} -c 'import compileall; compileall.compile_dir("${FUGUSHARELIBDIR}")'

	@echo '------------------------------------------------------------'
	@echo 'Installation completed.'
	@echo 'Run "fugu" to begin.'
	@echo

