66 lines
1.7 KiB
Makefile
66 lines
1.7 KiB
Makefile
all: website fix-permissions
|
|
|
|
# Extensions:
|
|
# 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
|
|
|
|
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'
|
|
|
|
STATIC_FILES = src/assets
|
|
|
|
$(PH_FILES):
|
|
echo "Create: src/$@ => www/${@:S/ph/html/}"
|
|
cat src/header.th > www/${@:S/ph/html/}
|
|
cat src/$@ >> www/${@:S/ph/html/}
|
|
cat src/footer.th >> www/${@:S/ph/html/}
|
|
|
|
$(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/}
|
|
|
|
website: prepare copy-static-files $(PH_FILES) $(PM_FILES) $(PS_FILES) $(PA_FILES)
|
|
|
|
prepare:
|
|
echo "Mkdir: www"
|
|
mkdir -p www
|
|
|
|
copy-static-files: prepare
|
|
rsync -r --partial --delete --out-format="Copy: src/%f => www/%f" $(STATIC_FILES) www/
|
|
|
|
clean:
|
|
rm -rf www
|
|
|
|
fix-permissions: website
|
|
chown -R sdk:www www
|
|
chmod -R ug+Xrw www
|
|
|
|
|