all:
	@echo "Use 'make install' to install or 'make dist' to make a tar file."
	@echo "Add PREFIX=/path/to/my/dir to install under that directory."


PREFIX = /usr
DIR = $(shell ./safe -v | tr ' ' -)
TAR = $(DIR).tgz



install: safe safe.1 Makefile
	install safe $(PREFIX)/bin
	install -m 644 safe.1 $(PREFIX)/share/man/man1



dist: $(TAR)

$(TAR): safe safe.1 Makefile
	rm -rf $(DIR)
	mkdir $(DIR)
	cp $^ $(DIR)
	tar cvfz $@ $(DIR)
	rm -r $(DIR)



html: safe.html

safe.html: safe.1
	groff -T xhtml -man $< >$@



.PHONY: install dist all
