# $Id: Makefile.in,v 1.6 1997/03/03 04:00:44 fritz Exp $
#
# Makefile for ISDN manpages
# (C) 1997 Fritz Elfert
#
#
SHELL			= /bin/sh
AWK				= @AWK@
SED				= @SED@
MANPAGES		= ttyI.4 isdninfo.4 isdn_audio.4 isdn_cause.7
INSTALL_MAN		= @INSTALL@ -o 0 -g 0 -m 0644
prefix			= @prefix@
ifeq (../.config,$(wildcard ../.config))
	include ../.config
	mandir			= $(CONFIG_MANDIR)
else
	mandir			= @mandir@
endif

%.4: %.man
	MANDATE=`grep CHECKIN $< | $(AWK) '{print $$4}'`; \
	$(SED) -e s%@MANDATE@%$$MANDATE%g $< > $@

%.7: %.man
	MANDATE=`grep CHECKIN $< | $(AWK) '{print $$4}'`; \
	$(SED) -e s%@MANDATE@%$$MANDATE%g $< > $@

%.8: %.man
	MANDATE=`grep CHECKIN $< | $(AWK) '{print $$4}'`; \
	$(SED) -e s%@MANDATE@%$$MANDATE%g $< > $@

all: $(MANPAGES)

config:
	@./configure

install:
	@for i in $(MANPAGES) ; do \
		MANSECT=`echo $$i | cut -d. -f2` ;\
		MANDIR=$(mandir)/man$$MANSECT ;\
		mkdir -p $$MANDIR ;\
		$(INSTALL_MAN) $$i $$MANDIR/$$i ;\
	done

uninstall:
	for i in $(MANPAGES) ; do \
		MANSECT=`echo $$i | cut -d. -f2` ;\
		MANDIR=$(mandir)/man$$MANSECT ;\
		rm -f $$MANDIR/$$i ;\
	done

clean:
	rm -f $(MANPAGES) *~

distclean: clean
	rm -f config.status config.cache config.log Makefile *.man
