# Includes
-include include.mk

# deploy variables
DEPLOY_BIN?=rsync
DEPLOY_OPTS?=-avz --delete

BUILD_OPTS?=--gc --cleanDestinationDir
BUILD_DEST?=public

.PHONY: serve
serve:
	@hugo server -D --disableFastRender -v

.PHONY: build
build:
	@hugo -d $(BUILD_DEST) $(BUILD_OPTIONS)

.PHONY: clean
clean:
	@[ -d $(BUILD_DEST) ] && rm -rf $(BUILD_DEST)

.PHONY: deploy
deploy: build

ifeq ($(DEPLOY_SERVER),)
	$(error DEPLOY_SERVER is not defined)
endif
	[ -d $(BUILD_DEST) ] && $(DEPLOY_BIN) $(DEPLOY_OPTS) $(BUILD_DEST)/ $(DEPLOY_SERVER):$(DEPLOY_FOLDER)
