Makefile 1013 B

123456789101112131415161718192021222324252627282930313233343536
  1. # YUI=/usr/share/java/yuicompressor-2.4.6.jar
  2. # 201501290914: Using https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar
  3. YUI=/tmp/yuicompressor-2.4.8.jar
  4. MINIFY_OTPIONS= --preserve-semi --line-break 80
  5. VERSION = `grep -e '\* Version: *[0-9.]' org-info-src.js | cut -sd ':' -f 2-`
  6. TMPv = tmp-version.js
  7. TMPs = tmp-min.js
  8. all: minify
  9. minify: version sed.txt
  10. @if [ -f $(TMPv) ] && [ -f $(TMPs) ]; then \
  11. sed -f sed.txt $(TMPv) > $(TMPs); \
  12. java -jar $(YUI) $(MINIFY_OTPIONS) $(TMPs) > org-info.js; \
  13. rm $(TMPv); \
  14. rm $(TMPs); \
  15. echo "org-info.js successfully built."; \
  16. else \
  17. echo "Failed to build. $(TMPv) and/or $(TMPs) are missing!"; \
  18. fi
  19. version:
  20. @if [ -f $(TMPv) ] || [ -f $(TMPs) ]; then \
  21. echo "$(TMPv) and/or $(TMPs) exist. Please remove them or adjust the Makefile!"; \
  22. else \
  23. sed -e "s/###VERSION###/$(VERSION)/g" org-info-src.js > $(TMPv); \
  24. touch $(TMPs); \
  25. fi
  26. clean:
  27. @rm -f $(TMPv) $(TMPs)
  28. @echo "Temporary files removed."