# This Makefile is a plain old hand written one; all configuration settings
# are included from $(ROOT)/Makefile.conf which is scconfig generated
ROOT=../..

include $(ROOT)/Makefile.conf
MAN1DIR=$(install_root)$(DESTDIR)$(PREFIX)/share/man/man1
LIBARCHDIR=$(LIBRND_LIBARCHDIR)
SCCBOX = $(LIBRND_PREFIX)/$(LIBARCHDIR)/librnd4/scconfig/sccbox

IN=camv-rnd.1.mml
OUT_HTML = camv-rnd.1.html
OUT_MAN1 = camv-rnd.1
OUT_LINT = camv-rnd.1.lint

OUTPUT = $(OUT_HTML) $(OUT_MAN1) index.html
MML = /usr/bin/mml

all: $(OUTPUT)

lint: $(OUT_LINT)

.SUFFIXES: .html .mml .lint

.mml.html: .mml_linkmap
	$(MML) -i copyright.mml -f html $<  > $@

.mml:
	$(MML) -i copyright.mml -f man $<  > $@

.mml_linkmap:
	$(MML) -i copyright.mml -f linkmap $(IN) > $@

index.html: $(IN)
	@echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' > $@
	@echo '<HTML><HEAD><meta http-equiv="Content-Type" content="text/html;charset=us-ascii"><TITLE>man page index - camv-rnd</TITLE></HEAD><BODY><UL>' >> $@
	$(MML) -i copyright.mml -f indexhtml $(IN) >> $@
	@echo "</UL></BODY></HTML>" >> $@

clean:

distclean:

genclean:
	rm $(OUTPUT) 2>/dev/null ; true

.mml.lint:
	$(MML) -i copyright.mml -f lint $<

install_dir:
	$(SCCBOX) mkdir -p "$(MAN1DIR)"

install_all:
	$(SCCBOX) $(HOW) "camv-rnd.1" "$(MAN1DIR)/camv-rnd.1"

install:
	$(MAKE) install_dir
	$(MAKE) install_all HOW="install -f"

linstall:
	$(MAKE) install_dir
	$(MAKE) install_all HOW="linstall -f"

uninstall:
	$(MAKE) install_all HOW="uninstall"


