2022-12-27 22:04:45 +01:00
|
|
|
WWW = ${PWD}/www
|
|
|
|
SITE = ${PWD}/site
|
|
|
|
SCRIPTS = ${PWD}/scripts
|
|
|
|
LOCAL = /var/www/htdocs
|
|
|
|
REMOTE = sdk@codevoid.de:/home/www/htdocs/shagen
|
|
|
|
|
|
|
|
# do everything by default
|
|
|
|
all: build-and-upload-all
|
|
|
|
@echo "done."
|
|
|
|
|
2022-12-27 22:39:14 +01:00
|
|
|
# Create the photo galleries and create the index and preview html pages.
|
2022-12-27 22:04:45 +01:00
|
|
|
PHOTODIRS != find photos/* -maxdepth 0 -mindepth 0 -type d
|
2023-01-05 13:10:18 +01:00
|
|
|
get-photos:
|
|
|
|
[ ! -d "photos" ] \
|
|
|
|
&& git clone sdk@home.codevoid.de:.photos.git photos \
|
|
|
|
|| cd photos && git pull
|
2022-12-27 22:04:45 +01:00
|
|
|
photos: ${PHOTODIRS}
|
|
|
|
mkdir -p ${SITE}/photos
|
|
|
|
cd photos && sh ${SCRIPTS}/mkphotoindex.sh > index.html
|
2022-12-27 22:39:14 +01:00
|
|
|
find photos -type f \( -not -name "*.html" \
|
|
|
|
-not -name "*.txt" \
|
|
|
|
-not -name "*.meta" \
|
|
|
|
\) -exec install -D {} www/{} \;
|
|
|
|
find photos -type f \( -name "*.html" \
|
|
|
|
-o -name "*.meta" \
|
|
|
|
\) -exec install -D {} site/{} \;
|
2023-01-05 13:10:18 +01:00
|
|
|
${PHOTODIRS}: get-photos
|
2022-12-27 22:39:14 +01:00
|
|
|
cd "$@" && sh ${SCRIPTS}/mkphotos.sh > index.html
|
2022-12-27 22:04:45 +01:00
|
|
|
|
2022-12-27 22:39:14 +01:00
|
|
|
# (manual step) - it takes some time to optimize all images and it's not really necessary.
|
2022-12-27 22:04:45 +01:00
|
|
|
optimize:
|
|
|
|
find photos -name "*.jpg" -type f -exec jpegoptim -w 12 --all-progressive --strip-all "{}" +
|
|
|
|
|
2022-12-27 22:39:14 +01:00
|
|
|
# create the uugrn test calendar
|
2022-12-27 22:04:45 +01:00
|
|
|
calendar:
|
|
|
|
mkdir -p ${SITE}/uugcal
|
|
|
|
cd ${SITE}/uugcal && sh ${SCRIPTS}/mkuugcalendar.sh > index.html
|
|
|
|
|
|
|
|
# invoke zod and compile the website into the www/ dir
|
|
|
|
compile:
|
|
|
|
mkdir -p ${WWW}
|
|
|
|
zod ${SITE} ${WWW}
|
|
|
|
|
|
|
|
# after mixing different generators in the compile step, let's tidy and
|
2022-12-27 22:39:14 +01:00
|
|
|
# indent the output properly. XXX is there a tool that does _only_
|
|
|
|
# indent? We don't need all the other tidy magic here...
|
2022-12-27 22:04:45 +01:00
|
|
|
tidy:
|
|
|
|
find ${WWW} -type f -name "*.html" \
|
|
|
|
-exec tidy -q -i -m -c -w 120 -f /dev/null {} \;
|
|
|
|
find ${WWW} -type f -name "*.html" \
|
|
|
|
-exec sed -i '/.*meta name="generator".*/d' {} \;
|
|
|
|
|
|
|
|
# create gzip variants of text files, so they can be served by httpds
|
|
|
|
# gzip-static extension
|
|
|
|
gzip:
|
|
|
|
find ${WWW} -type f \
|
|
|
|
\( -name "*.html" -o -name "*.css" \) \
|
|
|
|
-exec gzip -kf9 {} \;
|
|
|
|
|
|
|
|
# set permissions so the web server can read the file
|
|
|
|
fixperms:
|
|
|
|
doas chown -R sdk:www ${WWW}
|
|
|
|
doas chmod -R ugo+wrX,go-w ${WWW}
|
|
|
|
|
|
|
|
# we can upload to the local and the remote webserver at the same time
|
2022-12-27 22:39:14 +01:00
|
|
|
upload-local:
|
2022-12-27 22:04:45 +01:00
|
|
|
doas rsync -a --delete ${WWW}/ ${LOCAL}/
|
2022-12-27 22:39:14 +01:00
|
|
|
upload-remote:
|
2022-12-27 22:04:45 +01:00
|
|
|
doas rsync -a --delete -e ssh ${WWW}/ ${REMOTE}/
|
|
|
|
upload-all: upload-local upload-remote
|
|
|
|
|
2023-01-11 16:13:44 +01:00
|
|
|
build: photos calendar
|
2022-12-27 22:04:45 +01:00
|
|
|
make compile; \
|
|
|
|
make fixperms;
|
|
|
|
|
|
|
|
build-and-upload-all:
|
|
|
|
make build; \
|
|
|
|
make upload-all;
|
|
|
|
|
|
|
|
# deploy to the local webserver for preview
|
|
|
|
local:
|
|
|
|
make build; \
|
|
|
|
make upload-local;
|
|
|
|
remote:
|
|
|
|
make build; \
|
|
|
|
make upload-remote
|
|
|
|
|
|
|
|
# clean up temporary files and everything that can be regenerated very fast
|
|
|
|
clean:
|
|
|
|
rm -rf ${WWW}/photos
|
|
|
|
rm -rf ${SITE}/photos
|
|
|
|
rm -f photos/index.html
|
|
|
|
rm -f photos/*/*.html
|
|
|
|
rm -rf ${SITE}/uugcal
|
|
|
|
rm -rf ${WWW}
|
|
|
|
|
|
|
|
# clean and also delete all generated images
|
|
|
|
realclean: clean
|
|
|
|
rm -rf photos/*/{thm,mid}
|
|
|
|
|
|
|
|
|
|
|
|
### TARGETS BELOW ARE ONLY FOR CONVENIENCE
|
|
|
|
|
|
|
|
git-add:
|
|
|
|
find site/photos -type f \
|
|
|
|
-not -name "*.html" \
|
|
|
|
-not -path "*/thm/*" \
|
|
|
|
-not -path "*/mid/*" \
|
|
|
|
-exec git add "{}" +
|
|
|
|
|
|
|
|
# watch files and rebuild automatically
|
|
|
|
notify:
|
|
|
|
ulimit -n 1024; \
|
|
|
|
find ${SITE} ${SCRIPTS} -not -path "*/photos/*" -type f \
|
|
|
|
| inotifywait -m -e modify --fromfile - \
|
|
|
|
| while read line; \
|
|
|
|
do \
|
|
|
|
make; \
|
|
|
|
done
|
|
|
|
|
|
|
|
.PHONY: ${PHOTODIRS} ${REPOS}
|