#############################################################################
# default: generate all
all:	mined help manual mnemodoc


#############################################################################
# generation
mined:
	if egrep -e "^printf" -e "^#define debug" src/*.c; then false; fi
	if tail -1 src/keymaps.cfg | egrep '^#Ful'; then true; else false; fi
	./makemined

help:
	cd src; make help

mnemodoc:
	cd src; make mnemodoc

manual:
	cd man; make


#############################################################################
# installation
install:
	./makemined install


#############################################################################
# source distribution and private archives
archive:	all
	./makearch +

distribution:	all
	echo DOS version - make alone
	./makearch


#############################################################################
# specific distribution packages
packages:	cygwin

VER=$(shell sed -e 's,^[^0-9]*,,' -e 's,[^0-9][^0-9]*,.,g' -e q VERSION )

cygwin:	mined-$(VER).tar.gz cygwinbin cygwinsrc

cygwinsrc:
	gunzip -c mined-$(VER).tar.gz | bzip2 -c > release/mined/mined-$(VER)-src.tar.bz2

cygwinbin:
	cp -f src/cyg/mined.exe release/mined/bin/
	cp -f mined.hlp release/mined/usr/share/info/
	cp -f man/mined.1 release/mined/usr/share/man/man1/
	cd release/mined; tar -cf mined-$(VER).tar bin usr
	cd release/mined; rm -f mined-$(VER).tar.bz2
	cd release/mined; bzip2 mined-$(VER).tar

mined-$(VER).tar.gz:
	make distribution


#############################################################################
# NetBSD pkgsrc entry
description:	DESCR

DESCR:	doc/overview.html makefile
	sed -e '1,/<h.>Introduction/ d' -e '/<h.>/,$$ d' -e 's,<li>,	,' -e 's,<br>,	,' -e '/^<.*>$$/ d' -e 's,<.*>,,g' doc/overview.html > DESCR


#############################################################################
# end
