2023-10-23 22:39:52 +02:00
|
|
|
all:
|
2023-10-24 08:08:46 +02:00
|
|
|
make -s -j8 website
|
2023-10-23 13:19:55 +02:00
|
|
|
|
2023-10-23 22:39:52 +02:00
|
|
|
debug:
|
|
|
|
make website
|
|
|
|
|
|
|
|
# Extensions in src/
|
2023-10-23 13:19:55 +02:00
|
|
|
# th - template with html code
|
|
|
|
# ph - page with html code
|
|
|
|
# pm - page with markdown code
|
|
|
|
# ps - page with shell code
|
|
|
|
# pa - page with asciidoctor code
|
2023-10-23 22:39:52 +02:00
|
|
|
# pt - page with plain text
|
2023-10-24 22:24:12 +02:00
|
|
|
# everything will be converted to html
|
2023-10-23 13:19:55 +02:00
|
|
|
|
|
|
|
PH_FILES != find src -type f -name "*.ph" | sed 's|src/||g'
|
|
|
|
PM_FILES != find src -type f -name "*.pm" | sed 's|src/||g'
|
|
|
|
PS_FILES != find src -type f -name "*.ps" | sed 's|src/||g'
|
|
|
|
PA_FILES != find src -type f -name "*.pa" | sed 's|src/||g'
|
2023-10-23 22:39:52 +02:00
|
|
|
PT_FILES != find src -type f -name "*.pt" | sed 's|src/||g'
|
2023-10-23 13:19:55 +02:00
|
|
|
|
2023-11-02 11:44:39 +01:00
|
|
|
COMMIT_MSG != echo "Update $$(date +"%Y-%m-%d %H:%M:%S")"
|
2023-11-02 11:43:25 +01:00
|
|
|
|
2023-10-24 22:24:12 +02:00
|
|
|
# put static files and dirs into .control/static-files. Globbing is supported.
|
2023-10-23 22:39:52 +02:00
|
|
|
STATIC_FILES != cat .control/static-files
|
2023-10-24 22:24:12 +02:00
|
|
|
|
|
|
|
# put a local directory or a remote server with path (ssh notation) in here.
|
2023-10-23 22:39:52 +02:00
|
|
|
REMOTE != cat .control/remote-ssh-target
|
2023-10-23 13:19:55 +02:00
|
|
|
|
|
|
|
$(PH_FILES):
|
|
|
|
echo "Create: src/$@ => www/${@:S/ph/html/}"
|
2023-10-23 22:39:52 +02:00
|
|
|
mkdir -p "$$(dirname www/${@})"
|
2023-10-23 13:19:55 +02:00
|
|
|
cat src/header.th > www/${@:S/ph/html/}
|
|
|
|
cat src/$@ >> www/${@:S/ph/html/}
|
|
|
|
cat src/footer.th >> www/${@:S/ph/html/}
|
|
|
|
|
2023-10-23 22:39:52 +02:00
|
|
|
$(PT_FILES):
|
|
|
|
echo "Create: src/$@ => www/${@:S/pt/html/}"
|
|
|
|
mkdir -p "$$(dirname www/${@})"
|
|
|
|
cat src/header.th > www/${@:S/pt/html/}
|
|
|
|
echo "<pre>" >> www/${@:S/pt/html/}
|
|
|
|
cat src/$@ >> www/${@:S/pt/html/}
|
|
|
|
echo "</pre>" >> www/${@:S/pt/html/}
|
|
|
|
cat src/footer.th >> www/${@:S/pt/html/}
|
|
|
|
|
2023-10-23 13:19:55 +02:00
|
|
|
$(PM_FILES):
|
|
|
|
echo "Create: src/$@ => www/${@:S/pm/html/}"
|
|
|
|
mkdir -p "$$(dirname www/${@})"
|
|
|
|
cat src/header.th > www/${@:S/pm/html/}
|
|
|
|
discount -f fencedcode src/$@ >> www/${@:S/pm/html/}
|
|
|
|
cat src/footer.th >> www/${@:S/pm/html/}
|
|
|
|
|
|
|
|
$(PS_FILES):
|
|
|
|
echo "Create: src/$@ => www/${@:S/ps/html/}"
|
|
|
|
mkdir -p "$$(dirname www/${@})"
|
|
|
|
cat src/header.th > www/${@:S/ps/html/}
|
|
|
|
ksh src/$@ >> www/${@:S/ps/html/}
|
|
|
|
cat src/footer.th >> www/${@:S/ps/html/}
|
|
|
|
|
|
|
|
$(PA_FILES):
|
|
|
|
echo "Create: src/$@ => www/${@:S/pa/html/}"
|
|
|
|
mkdir -p "$$(dirname www/${@})"
|
|
|
|
cat src/header.th > www/${@:S/pa/html/}
|
|
|
|
asciidoctor -e \
|
|
|
|
-r asciidoctor-diagram \
|
|
|
|
-a imagesdir=/tmp/adoc-tmp \
|
|
|
|
-a stylesheet! \
|
|
|
|
-a data-uri \
|
|
|
|
-o - src/$@ >> www/${@:S/pa/html/}
|
|
|
|
cat src/footer.th >> www/${@:S/pa/html/}
|
|
|
|
|
2023-10-23 22:39:52 +02:00
|
|
|
website: prepare copy-static-files $(PH_FILES) $(PM_FILES) $(PS_FILES) $(PA_FILES) $(PT_FILES)
|
2023-10-23 13:19:55 +02:00
|
|
|
|
|
|
|
prepare:
|
|
|
|
echo "Mkdir: www"
|
|
|
|
mkdir -p www
|
|
|
|
|
2023-11-02 11:43:25 +01:00
|
|
|
git-commit:
|
|
|
|
git pull --autostash
|
|
|
|
git add src Makefile
|
2023-11-02 21:47:41 +01:00
|
|
|
git commit -m "$(COMMIT_MSG)" && git push || return
|
2023-11-02 11:43:25 +01:00
|
|
|
|
2023-10-23 13:19:55 +02:00
|
|
|
copy-static-files: prepare
|
2023-10-23 22:39:52 +02:00
|
|
|
rsync -a --partial --delete --no-p --no-o --no-g --out-format="Copy: %f => www/" $(STATIC_FILES) www/
|
2023-10-23 13:19:55 +02:00
|
|
|
|
|
|
|
clean:
|
2023-10-23 22:39:52 +02:00
|
|
|
make -s _clean
|
|
|
|
_clean:
|
|
|
|
echo "Delete: www"
|
2023-10-23 13:19:55 +02:00
|
|
|
rm -rf www
|
|
|
|
|
2023-10-23 22:39:52 +02:00
|
|
|
install:
|
|
|
|
make -s _install
|
2023-11-02 11:43:25 +01:00
|
|
|
make -s git-commit
|
2023-10-23 22:39:52 +02:00
|
|
|
_install: website
|
|
|
|
echo "Fixing Permissions in www/"
|
|
|
|
doas chown -R sdk:www www
|
|
|
|
doas chmod -R ugo+Xrw www
|
|
|
|
echo "Deploy: www/ => /var/www/htdocs/"
|
2023-11-02 11:43:25 +01:00
|
|
|
cd www && doas rsync -a -o -g -p --inplace --partial --delete --exclude "*/cache/*" --out-format="Deploy: %f => /var/www/htdocs/%f" * $(REMOTE)
|
2023-10-24 08:08:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
#### HELPER TARGETS ####
|
|
|
|
|
2023-10-24 22:24:12 +02:00
|
|
|
css:
|
|
|
|
@vim src/assets/style.css
|
|
|
|
@echo rebuild?
|
|
|
|
@read
|
|
|
|
@make install
|
|
|
|
@make css
|