cleans up Makefile a bit
authorDaniel <thefekete@gmail.com>
Tue, 23 Jun 2020 00:48:17 +0000 (02:48 +0200)
committerDaniel <thefekete@gmail.com>
Tue, 23 Jun 2020 00:48:17 +0000 (02:48 +0200)
Makefile

index 6b4db54..dfea4f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,28 +4,29 @@ L=img/
 
 all: $H
 
-build/:
-       mkdir -p $@
-
 build/%.html: %.md build/ Makefile
        { cat $<; echo; echo "<small><i>Last updated $$(date -u -d @$$(stat -c %Y $<))</i></small>"; } | markdown >$@
        cp -a $L build/
 
+build/:
+       mkdir -p $@
+
 view:
        xdg-open build/index.html
 
-publish: all
+publish: _not_dirty all _rsync
+
+clean:
+       rm -rfv build/
+
+_rsync: all
+       rsync -vha --delete build/ root@thefekete.net:/var/www/thefekete.net/
+
+_not_dirty:
        @git diff-index --quiet HEAD -- && test -z "$(git ls-files --others)" || ( \
                1>&2 echo "Index is dirty or there are uncommitted files!"; \
                git status; \
                exit 1; \
        )
-       rsync -vha --delete build/ root@thefekete.net:/var/www/thefekete.net/
-
-rsync: all
-       rsync -vha --delete build/ root@thefekete.net:/var/www/thefekete.net/
-
-clean:
-       rm -rfv build/
 
-.PHONY: all publish view clean
+.PHONY: all view publish clean _rsync _not_dirty