# Makefile.am for opennap-ng

#require automake 1.4
AUTOMAKE_OPTIONS = 1.4

BASE_SUBDIRS = src

SUBDIRS = $(BASE_SUBDIRS)
DIST_SUBDIRS = $(BASE_SUBDIRS)
EXTRA_DIST = debian/*		\
	rpm/opennap-ng.spec.in	\
	man/*			\
	doc/*			\
	autogen.sh		\
	win/*

DISTCLEANFILES = config.cache	\
	config.log		\
	debian/substvars	\
	debian/files		\
	build

distclean-local:
	rm -rf rpm/tmp
	rm -rf debian/tmp
	rm -rf autom4te.cache

MAINTAINERCLEANFILES = $(DISTCLEANFILES) \
	COPYING			\
	INSTALL			\
	config.guess		\
	config.sub		\
	depcomp			\
	install-sh		\
	missing			\
	mkinstalldirs		\
	configure		\
	aclocal.m4		\
	Makefile.in		\
	src/Makefile.in		\
	src/config.h.in

docsdir = $(datadir)/docs/opennap-ng
opennap_datadir = $(datadir)/opennap-ng

docs_DATA = \
	doc/CHARTA \
	doc/ChangeLog.drscholl \
	doc/ChangeLog.jondo \
	doc/ChangeLog.kaenguru \
	doc/FAQ \
	doc/TODO \
	doc/WHATSNEW \
	doc/napster-protocol.txt \
	doc/opennap-ng-0.49-manual.html \
	AUTHORS \
	COPYING \
	ChangeLog \
	NEWS \
	README

opennap_data_DATA = \
	doc/examples/opennap-block.txt \
	doc/examples/opennap-block-ban.txt \
	doc/examples/opennap-channels.txt \
	doc/examples/opennap-config.txt \
	doc/examples/opennap-filter.txt \
	doc/examples/opennap-motd.txt \
	doc/examples/opennap-servers.txt \
	doc/examples/opennap-users.txt

all-local:
	echo -e '\n+++ Compilation and linkage finished.'
	echo -e   '+++ Type "make install" to install the software.\n'
	echo -e   '+++ IMPORTANT: do not start the server without at least basic customization'
	echo -e   '+++ of the files opennap-config.txt and opennap-users.txt!'
	echo -e   '+++ See doc/opennap-ng-0.49-manual.html for complete quick start instructions.\n'


install-data-hook:
	echo -e '\n+++ Opennap NG binaries and data files have been installed.'
	echo -e   '+++ Before starting the server you MUST do the following:'
	echo -e   '+++ 1. customize your server configuration (file opennap-config.txt),'
	echo -e   '+++    set at least params like servername, IP address, ports, GotNap account.'
	echo -e   '+++    Newbies should prefer using the Opennap NG config tool (onngconf).'
	echo -e   '+++ 2. create Elite account (i.e. via doc/scripts/init-userdb.sh)'
	echo -e   '+++ See doc/opennap-ng-0.49-manual.html for complete quick start instructions.\n'

uninstall-hook:
	rmdir $(docsdir)
	rmdir $(opennap_datadir)

.SILENT: all-local install-data-hook

.PHONY: log snapshot deb rpm

log:
	rcs2log -h users.sourceforge.net | \
		sed 's;/cvsroot/opennap-ng/opennap-ng/;;g' > ChangeLog.new
	cat ChangeLog >> ChangeLog.new
	mv ChangeLog.new ChangeLog

snapshot:
	$(MAKE) -s dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"`

deb:
	fakeroot debian/rules binary

rpm:
	@[ -n "rpm/tmp" ] && rm -rf rpm/tmp
	@mkdir rpm/tmp rpm/tmp/SOURCES rpm/tmp/BUILD rpm/tmp/RPMS rpm/tmp/SRPMS
	$(MAKE) -s dist
	@mv $(PACKAGE)-$(VERSION).tar.gz rpm/tmp/SOURCES
	rpm -ba --quiet --clean rpm/$(PACKAGE).spec
	@echo "Your RPM's and SRPM's are baked and waiting in rpm/tmp/*"