Makefile 971 B

12345678910111213141516171819202122232425262728293031323334353637
  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 -auto-orient -quality 30% -strip -define png:exclude-chunk=all $@
  14. @touch -r "$<" "$@"
  15. _build/1200/%: src/%
  16. @-mkdir -p _build/1200
  17. convert $< -resize 1200x1200\> -auto-orient -quality 82% -strip -define png:exclude-chunk=all $@
  18. @touch -r "$<" "$@"
  19. build: thumb large _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: ${SRC}
  27. sh ./atom.sh '$(title)' '$(base)' $^ > $@