Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. # news/index.html implies the building of $(HTML_NEWS).
  20. all: $(HTML_MAIN) news/index.html
  21. .SUFFIXES: .md .html
  22. # Does not apply for news/index.md; see below.
  23. .md.html:
  24. ./publish.sh $<
  25. # Unlike all the other markdown files, news/index.md does not exist at first:
  26. # it must be generated by index.sh. Also note that index.sh depends on the
  27. # existence of the HTML version of all news items, hence the dependency line
  28. # below.
  29. news/index.md: $(HTML_NEWS)
  30. ./index.sh
  31. clean:
  32. rm -f $(HTML_MAIN) $(HTML_MAIN:.html=.bare.html) \
  33. $(HTML_NEWS) $(HTML_NEWS:.html=.bare.html) \
  34. news/index.md news/index.html news/index.bare.html \
  35. feed.xml news/feed.xml
  36. .PHONY: clean