Content files and ksh/bsdmake templating engine for my personal website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. HTGEN=./scripts/htgen
  2. MKLIST=./scripts/mklist
  3. RSSGEN=./scripts/rssgen
  4. BLOG=blog
  5. POSTS!=find ${BLOG} -type f -mindepth 2 -maxdepth 2 -name index.tmpl
  6. OS!=uname
  7. .if ${OS} == "Darwin"
  8. INSTALL=ginstall -Dp -m 0444
  9. LOCAL_TARGET=${HOME}/Public/www.c0ffee.net
  10. .else
  11. INSTALL=install -Dp -m 0444
  12. LOCAL_TARGET=/var/www/htdocs/www
  13. .endif
  14. HEAD=partials/head.tmpl
  15. RSYNC_TARGET=puffy:/var/www/htdocs/www
  16. DOMAIN=www.c0ffee.net
  17. BASEURL=https://${DOMAIN}
  18. RSS_TITLE="Cullum Smith's Blog"
  19. RSS_DESCRIPTION="Articles about BSD, privacy, self-hosting, and more."
  20. .PHONY: all clean tarball rsync local
  21. all: index.html resume/index.html ${BLOG}/index.html ${POSTS:S/.tmpl$/.html/g} rss.xml
  22. index.html: ${HEAD} index.tmpl list.tmpl partials/footer_openbsd.tmpl
  23. ${HTGEN} -o $@ ${HEAD} '@index.tmpl' list.tmpl partials/footer_openbsd.tmpl
  24. resume/index.html: ${HEAD} resume/index.tmpl partials/footer.tmpl
  25. ${HTGEN} -o $@ ${HEAD} '@resume/index.tmpl' partials/footer.tmpl
  26. ${BLOG}/index.html: ${HEAD} ${BLOG}/index.tmpl ${BLOG}/list.tmpl partials/footer_blog.tmpl
  27. ${HTGEN} -o $@ ${HEAD} ${BLOG}/index.tmpl '@${BLOG}/list.tmpl' partials/footer_blog.tmpl
  28. list.tmpl: ${POSTS}
  29. ${MKLIST} -o $@ -n 5 ${BLOG}
  30. ${BLOG}/list.tmpl: ${POST}
  31. ${MKLIST} -o $@ ${BLOG}
  32. .for POST in ${POSTS}
  33. ${POST:S/.tmpl$/.html/g}: ${HEAD} partials/header_${BLOG}.tmpl ${POST} partials/footer_post.tmpl
  34. ${HTGEN} -o $@ ${HEAD} partials/header_${BLOG}.tmpl '@${POST}' partials/footer_post.tmpl
  35. .endfor
  36. rss.xml: ${POSTS}
  37. ${RSSGEN} -o $@ -b "${BASEURL}" -t ${RSS_TITLE} -d ${RSS_DESCRIPTION} ${BLOG}
  38. dist: all
  39. mkdir -p dist
  40. find . -type d -path ./dist -prune -o -type f -name '*.html' -print | sed 's|^\./||' | xargs -n1 -I{} ${INSTALL} {} dist/{}
  41. ${INSTALL} css/style.css dist/css/style.css
  42. ${INSTALL} favicon.png dist/favicon.png
  43. ${INSTALL} robots.txt dist/robots.txt
  44. ${INSTALL} rss.xml dist/rss/index.rss
  45. find files -type f -exec ${INSTALL} {} dist/{} \;
  46. find img -type f -exec ${INSTALL} {} dist/{} \;
  47. tarball: dist
  48. tar cvzf ${DOMAIN}.tar.gz dist
  49. local: dist
  50. rsync -rlpth dist/ ${LOCAL_TARGET}
  51. rsync: dist
  52. rsync -rlpth dist/ ${RSYNC_TARGET}
  53. clean:
  54. rm -f list.tmpl ${BLOG}/list.tmpl rss.xml
  55. find . -name '*.html' -exec rm -f {} \;
  56. rm -rf dist
  57. rm -f ${DOMAIN}.tar.gz