Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2017 Michael Reed <michael@michaelreed.io>
  2. #
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. MD_MAIN != find -L . -name '*.md' -and ! -path '*/news/*'
  16. HTML_MAIN = $(MD_MAIN:.md=.html)
  17. MD_NEWS != cat news/MANIFEST
  18. HTML_NEWS = $(MD_NEWS:.md=.html)
  19. HTML_BARE_NEWS = $(MD_NEWS:.md=.bare.html)
  20. # news/index.html implies the building of $(HTML_BARE_NEWS).
  21. all: $(HTML_MAIN) $(HTML_NEWS) news/index.html
  22. .SUFFIXES: .md .html .bare.html
  23. .md.html:
  24. ./publish.sh $<
  25. .md.bare.html:
  26. pandoc $(<) > $(<:.md=.bare.html)
  27. # Unlike all the other markdown files, news/index.md does not exist at first:
  28. # it must be generated by index.sh. Also note that index.sh generates the RSS
  29. # feed, which requires the bare HTML versions of all news items.
  30. news/index.md: $(HTML_BARE_NEWS)
  31. ./index.sh
  32. clean:
  33. rm -f $(HTML_MAIN) $(HTML_NEWS) $(HTML_BARE_NEWS) \
  34. news/index.md news/index.html news/index.bare.html \
  35. feed.xml news/feed.xml
  36. .PHONY: clean