#  The Haskell Ports Library: documentation makefile
#
#  Author : Manuel M. T. Chakravarty
#  Created: 16 June 2000
#
#  Version $Revision: 1.2 $ from $Date: 2000/10/05 05:40:50 $
#
#  Copyright (c) 2000 Manuel M. T. Chakravarty
#
#  This file is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This file is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  = DOCU =====================================================================

# must be first
#
default: all

# slurp in the common definitions (the TOP definition is not nice yet)
#
TOP=..

include $(TOP)/mk/config.mk $(TOP)/mk/common.mk

# install dirs
#
SGMLDIR=$(pkgdocdir)/sgml
HTMLDIR=$(pkgdocdir)/html
TXTDIR =$(pkgdocdir)/txt

# build targets
#

.PHONY: all
all: ports.html ports.txt

ports.html: ports.sgml
	sgml2html ports.sgml

ports.txt: ports.sgml
	sgml2txt ports.sgml

# install target (sgml, html & txt)
#

.PHONY: install
install:
	$(INSTALL) -d $(SGMLDIR)
	@for f in *.sgml; do\
	  echo $(INSTALL_DATA) $$f $(SGMLDIR)/$$f;\
	  $(INSTALL_DATA) $$f $(SGMLDIR)/$$f;\
	done

	$(INSTALL) -d $(HTMLDIR)
	@for f in *.html; do\
	  echo $(INSTALL_DATA) $$f $(HTMLDIR)/$$f;\
	  $(INSTALL_DATA) $$f $(HTMLDIR)/$$f;\
	done

	$(INSTALL) -d $(TXTDIR)
	@for f in *.txt; do\
	  echo $(INSTALL_DATA) $$f $(TXTDIR)/$$f;\
	  $(INSTALL_DATA) $$f $(TXTDIR)/$$f;\
	done

# auxiliary targets
#
.PHONY: clean
clean:
	-$(RM) *.html *.txt
