#
VER = 1.0.7
# ( FYI `make versionbump` updates the manual page source file )
#
DISTFILES = \
  stalwart-bootstrap \
  stalwart-bootstrap.1.md \
  Makefile \
  README.md \


#
all:
	@echo Script has already been made

install: stalwart-bootstrap.1
	install -m 0755 -d $(DESTDIR)/usr/bin
	install -m 0755 -d $(DESTDIR)/usr/share/man/man1
	install -m 0755 stalwart-bootstrap $(DESTDIR)/usr/bin
	install -m 0644 stalwart-bootstrap.1 $(DESTDIR)/usr/share/man/man1

manual: stalwart-bootstrap.1

stalwart-bootstrap.1: stalwart-bootstrap.1.md
	@# Convertor of markdown source file to troff manual page might be missing
	@echo "To be overwritten in next step" > $@
	-pandoc $< --standalone --to man --output=$@

clean:
	rm  -f stalwart-bootstrap.1
	rm  -f stalwart-bootstrap-*.*.*.tar.gz
	rm -rf stalwart-bootstrap-*.*.*/

dist:
	@rm -rf stalwart-bootstrap-$(VER)
	mkdir stalwart-bootstrap-$(VER)
	cp --target-directory=stalwart-bootstrap-$(VER) $(DISTFILES)
	tar czf stalwart-bootstrap-$(VER).tar.gz stalwart-bootstrap-$(VER)

distabove: dist
	@# We might write permission in above folder, lets try
	mv stalwart-bootstrap-$(VER).tar.gz ..

versionbump:
	sed --in-place \
	-e 's/^\(footer: [a-z]\+-[a-z]\+\) .*/\1 $(VER)/' \
	-e 's/^\(date:\) \(.*\)/date: $(shell LANG=C date +"%e %B %Y")/' \
	stalwart-bootstrap.1.md

# l l
