PACKAGE_NAME=dcacheVoms2Gplasma
####################################################################
# Distribution Makefile
####################################################################
topdir=`pwd`/dist
ifeq ($(runprefix),"")
runprefix=$(prefix)
endif
name=$(shell echo ${runprefix} | sed -e 's/\//\\\//g')
.PHONY: configure install clean

all: configure

####################################################################
# Prepare
####################################################################

jam:
	echo jam

prepare:
	rm -f *~ src/*~ 
	@mkdir -p build/
	

####################################################################
# Configure
####################################################################

configure: 
	@echo "No configuration required, use either 'make install' or 'make rpm'."

####################################################################
# Compile
####################################################################

compile: 
	@echo "No compiling required, use either 'make install' or 'make rpm'."

####################################################################
# Install
####################################################################

	
install: 
	@echo installing ...
	@mkdir -p $(prefix)/sbin
	@mkdir -p $(prefix)/etc
	@install -m 0755 dcacheVoms2Gplasma.py $(prefix)/sbin/dcacheVoms2Gplasma.py
	@install -m 0644 dcacheVoms2Gplasma.conf.example $(prefix)/etc/dcacheVoms2Gplasma.conf.example
	
####################################################################
# Documentation
####################################################################

doc: man html

man: prepare

html: prepare

web: html

####################################################################
# Install Doc
####################################################################

install-doc: doc
	@echo installing  docs...

####################################################################
# Build Distribution
####################################################################

dist: prepare 
	tar --gzip --exclude=*CVS* --exclude=build -cf build/$(PACKAGE_NAME).src.tgz *

rpm: clean dist
	@mkdir -p $(topdir)/SOURCES \
	$(topdir)/SPECS \
	$(topdir)/BUILD \
	$(topdir)/RPMS $(topdir)/SRPMS
	@rpmbuild --define  "_topdir $(topdir)" -ta build/$(PACKAGE_NAME).src.tgz 

clean::
	rm -f *~ src/*bak etc/*~ doc/*~ src/*~ $(PACKAGE_NAME).src.tgz 
	rm -rf build 

