commit dc3364290fcb607b6c1c43e2ad0db9417bc3f674
parent 1adde9aa1c1fe4a1f6bffdecdc14e2992c406cfc
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 9 Dec 2020 11:59:05 +0100
Makefile: clean up output directory and put gopher contents into separate dir
Diffstat:
M | Makefile | | | 27 | +++++++++++---------------- |
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,31 +1,28 @@
default: generate
output = output/
+gopheroutput = gopheroutput/
generate:
mkdir -p $(output)
saait `ls -1r pages/*.cfg`
+ cp style.css print.css $(output)/
+ mkdir -p $(gopheroutput)
for f in pages/[0-9][0-9][0-9]*.txt; do \
title="$$(sed -n 's/^title.*=//p' "$${f%%.txt}.cfg" | tr a-z A-Z)"; \
out="$$(printf '%s' "$$f" | sed 's/[0-9][0-9][0-9]-//')"; \
- out="$(output)$${out##pages}"; \
- echo $$out; \
+ out="$(gopheroutput)$${out##pages}"; \
printf '# %s \n\n' "$$title" > "$$out"; \
cat "$$f" >> "$$out"; \
done
- sed -i 's,|\([A-z0-9-]*\)\.html|server|port,|/\1.txt|server|port,' $(output)/index.gph
+ sed 's,|\([A-z0-9-]*\)\.html|server|port,|/\1.txt|server|port,' \
+ $(output)/index.gph > $(gopheroutput)/index.gph
sed 's,https://adamsgaard.dk,gopher://adamsgaard.dk/0,g; \
s,text/html,text,g; \
s,\.html,\.txt,g' \
- $(output)/atom.xml > $(output)/atom-gopher.xml;
- cp style.css print.css $(output)/
- rsync -ra \
- $(output)/ \
- pages/*.txt \
- /var/gopher/
- rsync -ra \
- $(output)/atom-gopher.xml \
- /var/gopher/atom.xml
+ $(output)/atom.xml > $(gopheroutput)/atom.xml;
+ mv $(output)/*.gph $(gopheroutput)/
+ rsync -a $(gopheroutput)/ /var/gopher/
view:
$(BROWSER) $(output)/index.html
@@ -41,14 +38,12 @@ deploy: generate
papers video img $(output)/ \
adamsgaard.dk:/var/www/domains/adamsgaard.dk/
rsync -av --progress \
- $(output)/ \
+ $(gopheroutput)/ \
pages/*.txt \
adamsgaard.dk:/var/gopher/
- rsync -av
- $(output)/atom-gopher.xml \
- adamsgaard.dk:/var/gopher/atom.xml
clean:
rm -rf $(output)/
+ rm -rf $(gopheroutput)/
.PHONY: default generate view deploy