SHELL       := @SHELL@

# Support out-of-tree builds
VPATH       := @srcdir@

prefix      := @prefix@
exec_prefix := @exec_prefix@
datarootdir := @datarootdir@
mandir      := @mandir@

INSTALL      := @INSTALL@
INSTALL_DATA := @INSTALL_DATA@

MAN1        := znc.1.gz znc-buildmod.1.gz

ifneq "$(V)" ""
VERBOSE=1
endif
ifeq "$(VERBOSE)" ""
Q=@
E=@echo
else
Q=
E=@\#
endif

all: $(MAN1)

%.1.gz: %.1 Makefile
	$(E) Packing man page $@...
	$(Q)gzip -9 <$< >$@

clean:
	-rm -f $(MAN1)

install: $(MAN1)
	test -d $(DESTDIR)$(mandir)/man1 || $(INSTALL) -d $(DESTDIR)$(mandir)/man1
	$(INSTALL_DATA) $(MAN1) $(DESTDIR)$(mandir)/man1

uninstall:
	for file in $(MAN1) ; do \
		rm $(DESTDIR)$(mandir)/man1/$$file || exit 1 ; \
	done
	rmdir $(DESTDIR)$(mandir)/man1
