62 lines
1.5 KiB
Makefile
62 lines
1.5 KiB
Makefile
# ΞSUS Website Build System
|
|
# Environment variables:
|
|
# ESUS_PUBLISH_HOST - target host for deployment
|
|
|
|
PANDOC = pandoc
|
|
SRC_DIR = src
|
|
STATIC_DIR = static
|
|
STAGING_DIR = staging
|
|
TEMPLATE = pandoc-template.html
|
|
|
|
# Default target
|
|
all: build
|
|
|
|
# Build HTML from markdown
|
|
build: $(STAGING_DIR)/index.html copy-static
|
|
|
|
# Create staging directory
|
|
$(STAGING_DIR):
|
|
mkdir -p $(STAGING_DIR)
|
|
|
|
# Convert markdown to HTML
|
|
$(STAGING_DIR)/index.html: $(SRC_DIR)/index.md $(TEMPLATE) | $(STAGING_DIR)
|
|
$(PANDOC) \
|
|
--from markdown \
|
|
--to html5 \
|
|
--template=$(TEMPLATE) \
|
|
--standalone \
|
|
--css=css/style.css \
|
|
--output=$@ \
|
|
$<
|
|
|
|
# Copy static files
|
|
copy-static: | $(STAGING_DIR)
|
|
cp -r $(STATIC_DIR)/* $(STAGING_DIR)/
|
|
|
|
# Clean staging directory
|
|
clean:
|
|
rm -rf $(STAGING_DIR)
|
|
|
|
# Upload to server (requires ESUS_PUBLISH_HOST environment variable)
|
|
upload: build
|
|
@if [ -z "$(ESUS_PUBLISH_HOST)" ]; then \
|
|
echo "Error: ESUS_PUBLISH_HOST environment variable not set"; \
|
|
exit 1; \
|
|
fi
|
|
rsync -avz --exclude='.*' --delete $(STAGING_DIR)/ $(ESUS_PUBLISH_HOST):/var/www/html/
|
|
|
|
# Development server (requires Python)
|
|
serve: build
|
|
@echo "Starting development server at http://localhost:8000"
|
|
cd $(STAGING_DIR) && python3 -m http.server 8000
|
|
|
|
# Watch for changes (requires inotify-tools)
|
|
watch:
|
|
@echo "Watching for changes..."
|
|
while inotifywait -e modify -r $(SRC_DIR) $(STATIC_DIR) $(TEMPLATE) 2>/dev/null; do \
|
|
make build; \
|
|
echo "Site rebuilt"; \
|
|
done
|
|
|
|
.PHONY: all build copy-static clean upload serve watch
|