# $PostgresPy: dist/Makefile,v 1.13 2004/07/21 23:52:55 flaw Exp $
#
# † Instrument:
#     Copyright 2004, rhid development, All Rights Reserved.
#     
#     Usage of the works is permitted provided that this
#     instrument is retained with the works, so that any entity
#     that uses the works is notified of this instrument.
#     
#     DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
#     
#     [2004, Fair License; rhid.com/fair]
#     
##
# Fetch via anonymous CVS
CVSTAG = HEAD
CVSMETH = pserver
CVSUSER = anonymous
CVSPASS = anonymous
CVSAUTH = $(CVSMETH):$(CVSUSER):$(CVSPASS)
CVSPATH = /usr/local/cvsroot/postgrespy
CVSHOST = gborg.postgresql.org
CVSROOT = :$(CVSAUTH)@$(CVSHOST):$(CVSPATH)
CVS = cvs -d $(CVSROOT)

COFLAGS = -A -R -f -r $(CVSTAG)
CO = $(CVS) co $(COFLAGS)

.PHONY: all clean distclean fetch update update_dist

all: fetch configure
	./configure

configure:
	./configure.ac
	rm -rf autom4te.cache

if/:
	$(CO) if

pl/:
	$(CO) pl

doc/:
	$(CO) doc

test/:
	$(CO) test

update_dist:
	$(CVS) update -l -A -d

update:
	$(CO) if
	$(CO) pl
	$(CO) doc
	$(CO) test

fetch: if/ pl/ doc/

xhtml/:
	$(MAKE) -C doc xhtml
	mv doc/xhtml ./

man/:
	$(MAKE) -C doc man
	mv doc/man ./

docs: doc/ xhtml/ man/
	$(MAKE) -C doc clean

clean_docs:
	rm -rf man xhtml

clean:
	$(MAKE) -C test clean
	if/setup.py clean -a
	rm -rf autom4te.cache build
	rm -f configure config.status config.log GNUmakefile

distclean: clean clean_docs
	rm -rf if pl doc test


IF_VERSION != cat 2>&- if/VERSION || echo 0
PL_VERSION != cat 2>&- pl/VERSION || echo 0
PKGNAME = plpy-$(IF_VERSION).$(PL_VERSION)

release: fetch docs clean configure
	cp -R . ../$(PKGNAME)
	tar -C .. --totals -cf ../$(PKGNAME).tar $(PKGNAME)
	rm -rf ../$(PKGNAME)
