From d2ab14f649bef0d688c61caa445d79d8fb917774 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 20 Nov 2022 10:00:20 -0800 Subject: [PATCH] Parameterize the Makefile; add automatic importing of Nethack logfiles --- Makefile | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 030aa4c..4980149 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,30 @@ # Eryn Wells -DEPLOY_LOCATION=eryn@nutmeg.erynwells.me:/srv/www/erynwells.me/html +DEPLOY_USER=eryn +DEPLOY_HOSTNAME=nutmeg.erynwells.me +DEPLOY_PATH=/srv/www/erynwells.me/html +DEPLOY_LOCATION=$(DEPLOY_USER)@$(DEPLOY_HOSTNAME):$(DEPLOY_LOCATION) -.PHONY: site -site: +HOSTNAME=$(shell hostname -s) + +NETHACK_LOGFILE=$(shell nethack --showpaths | grep scoredir | sed 's/.*"\(.*\)".*/\1/g')/logfile +NETHACK_LOGFILE_DATA_FILE=data/nethack/logfile/$(HOSTNAME).json + +.PHONY: deploy clean + +site: public/index.html nethack + @echo "Building site" hugo -.PHONY: deploy deploy: site + @echo "Deploying to $(DEPLOY_LOCATION)" rsync -avz --no-times --no-perms --delete public/ $(DEPLOY_LOCATION) + +nethack: $(NETHACK_LOGFILE) +ifeq (,$(wildcard $<)) + @echo "Importing Nethack logfile from $(NETHACK_LOGFILE)" + scripts/import-nethack-logfile.py -o $(NETHACK_LOGFILE_DATA_FILE) $< +endif + +clean: + rm -rf public/