2023-05-01 17:33:11 +02:00
|
|
|
BUILD_DIR ?= build
|
|
|
|
EXPORT_DIR ?= public
|
|
|
|
BUILD_STAMP_HUGO = $(BUILD_DIR)/.stamp-hugo
|
|
|
|
BUILD_STAMP_THEME = $(BUILD_DIR)/.stamp-theme
|
|
|
|
SOURCE_DIRS = content data resources static
|
|
|
|
THEME_DIR ?= themes/hugo-geekdoc
|
|
|
|
BUILD_DEPS = config.toml $(shell find $(wildcard $(SOURCE_DIRS)) -type f)
|
|
|
|
HUGO_OPTS ?= --destination=$(EXPORT_DIR)
|
|
|
|
|
|
|
|
UPLOAD_SSH_HOST = hosting.sao
|
|
|
|
UPLOAD_TARGET_DIRECTORY = /data/webserver/hilfe.systemausfall.org/public
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@echo "Mögliche Ziele:"
|
|
|
|
@echo " build - Webseite erzeugen"
|
|
|
|
@echo " build-theme - Theme-Assets erzeugen"
|
|
|
|
@echo " upload - erzeugte Webseite hochladen"
|
|
|
|
@echo
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: $(BUILD_STAMP_HUGO)
|
|
|
|
|
|
|
|
$(BUILD_STAMP_HUGO): $(BUILD_DEPS) $(BUILD_STAMP_THEME) Makefile
|
2023-05-08 09:50:14 +02:00
|
|
|
@mkdir -p "$(dir $@)"
|
2023-05-01 17:33:11 +02:00
|
|
|
@HUGO_ENV=production hugo $(HUGO_OPTS)
|
|
|
|
@touch "$@"
|
|
|
|
|
|
|
|
.PHONY: build-theme
|
|
|
|
build-theme: $(BUILD_STAMP_THEME)
|
|
|
|
|
|
|
|
$(BUILD_STAMP_THEME):
|
2023-05-08 09:50:14 +02:00
|
|
|
@mkdir -p "$(dir $@)"
|
2023-05-01 17:33:11 +02:00
|
|
|
cd "$(THEME_DIR)" \
|
|
|
|
&& npm install \
|
|
|
|
&& npm run build
|
|
|
|
touch "$@"
|
|
|
|
|
|
|
|
.PHONY: upload
|
|
|
|
upload: $(BUILD_STAMP_HUGO)
|
|
|
|
@rsync -ax --delete \
|
|
|
|
"$(EXPORT_DIR)/" \
|
|
|
|
"$(UPLOAD_SSH_HOST):$(UPLOAD_TARGET_DIRECTORY)/"
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
$(RM) -r "$(BUILD_DIR)"
|