#!/usr/bin/make
# This is the examplix Makefile
# $Id$
# Zur Erstellung des Debian-Pakets notwendig (make DESTDIR=/root/examplix)
DESTDIR=

# Installing from this Makefile
#====================================
# run in this dir:  sudo make install  



# Debian
#====================================

# Data
LIBDIR=$(DESTDIR)/var/lib/examplix

# Logs
LOGDIR=$(DESTDIR)/var/log/examplix

# Perl modules
PERLMOD=$(DESTDIR)/usr/share/perl5/Examplix

# Dokumentation
DOCDEBDIR=$(DESTDIR)/usr/share/doc

# Config
CONF=$(DESTDIR)/etc/examplix

# Developer
DEVELCONF=$(DESTDIR)/usr/share/examplix


help:
	@echo ' '
	@echo 'Most common options of this Makefile:'
	@echo '-------------------------------------'
	@echo ' '
	@echo '   make help'
	@echo '      show this help'
	@echo ' '
	@echo '   make install'
	@echo '      make an installation of files to the local debian system'
	@echo ' '
	@echo '   make deb'
	@echo '      create a debian package'
	@echo ' '

# build a package
deb:
	### deb
	@echo 'Did you do a dch -i ?'
	@sleep 8
	dpkg-buildpackage -tc -uc -us -sa -rfakeroot
	@echo ''
	@echo 'Do not forget to tag this version in cvs'
	@echo ''


clean: clean-debian

clean-debian:
	rm -rf  debian/examplix


install:
	### install examplix:
# some dirs

	# install user scripts
	@install -d $(DESTDIR)/usr/bin
	@install -oroot -groot --mode=0777 scripts/examplix $(DESTDIR)/usr/bin
	@install -oroot -groot --mode=0777 scripts/examplix-ldapsearch $(DESTDIR)/usr/bin
	@install -oroot -groot --mode=0777 scripts/atlantis-csv-filter-schueler $(DESTDIR)/usr/bin
	# install config
	@install -d $(CONF)
	@install -oroot -groot --mode=0600 config/examplix.conf $(CONF)
	# install config for developers
	@install -d -m755 -oroot -groot $(DEVELCONF)/devel
	@install -oroot -groot --mode=0644 config-devel/examplix-devel.conf $(DEVELCONF)/devel
	@install -oroot -groot --mode=0644 config-devel/translate.conf $(DEVELCONF)/devel
	# install modules
	@install -d -m755 -oroot -groot $(PERLMOD)
	@install -oroot -groot --mode=0644 modules/ExamplixConfig.pm $(PERLMOD)

