# install http files into this directory
HTTPDIR=/tmp/zblog
# give all files to this owner after copy
OWNER != id -u
# give all files to this group after copy
GROUP != id -g
# set this mode on all directories
DIRMODE = 554
# set this mode on all files
FILEMODE = 444

.PHONY: clean install

all: clean build

build:
	hugo

clean:
	-rm -r public/*

install:
	rsync --delete -r public/ $(HTTPDIR)/
	find $(HTTPDIR) ! -path $(HTTPDIR) -type d -exec chmod $(DIRMODE) {} +
	find $(HTTPDIR) ! -path $(HTTPDIR) -type f -exec chmod $(FILEMODE) {} +
	chown -R $(OWNER):$(GROUP) $(HTTPDIR)/
