Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Example
  3. #
  4. # $ make title='My Photos' base='https://example.com/sub/my-photos'
  5. #
  6. # See http://purl.mro.name/Photos2Atom
  7. #
  8. .PHONY: all build clean large thumb
  9. _build/200/%: src/%
  10. @-mkdir -p _build/200
  11. @# https://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
  12. @# https://www.linuxquestions.org/questions/linux-software-2/question-about-thumbnail-orientation-dimensions-with-imagemagick-493034/
  13. convert $< -thumbnail 200x200 -quality 30% -auto-orient -strip -define png:exclude-chunk=all -interlace Plane $@
  14. @touch -r "$<" "$@"
  15. _build/1200/%: src/%
  16. @-mkdir -p _build/1200
  17. convert $< -resize 1200x1200\> -quality 82% -auto-orient -strip -define png:exclude-chunk=all -interlace Plane $@
  18. @touch -r "$<" "$@"
  19. build: _build/index.xml
  20. all: build
  21. clean:
  22. rm -rf _build
  23. SRC := $(wildcard src/*)
  24. thumb: $(patsubst src/%,_build/200/%,${SRC})
  25. large: $(patsubst src/%,_build/1200/%,${SRC})
  26. _build/index.xml.raw: thumb large
  27. sh ./atom.sh '$(title)' '$(base)' ${SRC} > $@
  28. _build/index.xml: rfc4287.rng _build/index.xml.raw
  29. xmllint --format --encode utf-8 --nocdata --nonet --output $@ --relaxng $^