# $Id: Makefile,v 1.7 2004/08/23 09:01:54 mcoolive Exp $

-include ../Makefile.common

SOURCES		:= $(filter %.xml, $(shell ls sources))

ifeq (${GEN_DOC}, yes)
MAN_PAGES	:= $(addprefix man/, ${SOURCES:.xml=.8})
HTML_PAGES	:= $(addprefix html/, ${SOURCES:.xml=.html})
else
MAN_PAGES	:= 
HTML_PAGES	:= 
endif # GEN_DOC = yes

.PHONY: all
all: man

.PHONY: man
man: ${MAN_PAGES}
${MAN_PAGES}: man/%.8: sources/%.xml
	xsltproc --nonet -o $@ ${MAN_STYLESHEET} $<

.PHONY: html
html: ${HTML_PAGES}
${HTML_PAGES}: html/%.html: sources/%.xml
	xsltproc --nonet -o $@ ${HTML_STYLESHEET} $<

.PHONY: install
install: man
	if [ -n "${MAN_PAGES}" ]; then \
		$(INSTALL) -d ${MANDIR}/man8; \
		cp ${MAN_PAGES} ${MANDIR}/man8; \
	fi

.PHONY: uninstall
uninstall:
	rm -f $(addprefix ${MANDIR}/man8/, ${MAN_PAGES})

.PHONY: clean
clean:
	rm -f ${MAN_PAGES} ${HTML_PAGES}

.PHONY: distclean
distclean: clean

#***************************************************************************
# $Log: Makefile,v $
# Revision 1.7  2004/08/23 09:01:54  mcoolive
# - --nonet option to force the use of local entities
#
# Revision 1.6  2004/08/09 22:08:34  mcoolive
# - add definitions of install and uninstall rules
# - if (GEN_DOC != yes) we do anything
#
# Revision 1.4  2004/08/07 12:33:42  Tux
# - removed stylesheets paths (moved to Makefile.common)
#
# Revision 1.3  2004/08/05 15:44:47  mcoolive
# - addition of a filter in the calculation of SOURCES
#   to be unaware of sub-directory "CVS".
#
# Revision 1.2   2004/08/03 mcoolive
# - Fix (source => sources). 
#
# Revision 1.1   2004/08/03 mcoolive
# - initial release
#
#***************************************************************************/
