Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Copyright (c) 2013-2016 Andy Hochhaus. All Rights Reserved.
  2. # Use of this source code is governed by the "GNU AFFERO GENERAL PUBLIC
  3. # LICENSE" license that can be found in the LICENSE file. See the AUTHORS file
  4. # for names of contributors.
  5. CLOSURE_COMPILER_JAR := "deps/compiler.jar"
  6. CLOSURE_STYLESHEETS_JAR := "deps/closure-stylesheets.jar"
  7. CLOSURE_TEMPLATES_JAR := "deps/SoyToIncrementalDomSrcCompiler.jar"
  8. CLOSURE_LINTER := "deps/linter.jar"
  9. BINDIR := bin
  10. RDIR := r
  11. GSS := $(wildcard src/www/gss/*.gss) \
  12. deps/closure-library/closure/goog/css/common.css
  13. JS := $(wildcard src/www/js/*.js)
  14. PNG := $(wildcard src/www/img/*.png)
  15. all: go $(RDIR)/compiled.css $(RDIR)/compiled.js $(RDIR)/logo.svg \
  16. $(RDIR)/*.png $(RDIR)/roboto.woff
  17. $(RDIR)/compiled.css: | $(RDIR)
  18. $(RDIR)/compiled.css: | $(BINDIR)
  19. $(RDIR):
  20. @mkdir -p $(RDIR)
  21. $(BINDIR):
  22. @mkdir -p $(BINDIR)
  23. .PHONY: go clean
  24. go:
  25. @go install -v mail/... mammoth/... www/...
  26. $(RDIR)/compiled.css: $(GSS)
  27. java -jar $(CLOSURE_STYLESHEETS_JAR) \
  28. --output-renaming-map-format CLOSURE_COMPILED \
  29. --rename CLOSURE \
  30. --output-file $(RDIR)/compiled.css \
  31. --output-renaming-map $(BINDIR)/compiled.css.map.js \
  32. $^
  33. $(BINDIR)/www/soy/skeleton.soy.js: src/www/soy/skeleton.soy
  34. java -jar $(CLOSURE_TEMPLATES_JAR) \
  35. --shouldGenerateJsdoc \
  36. --outputPathFormat $(BINDIR)/www/soy/skeleton.soy.js \
  37. src/www/soy/skeleton.soy
  38. $(RDIR)/compiled.js: $(JS) $(RDIR)/compiled.css $(BINDIR)/www/soy/skeleton.soy.js
  39. java -server -XX:+TieredCompilation -jar $(CLOSURE_COMPILER_JAR) \
  40. --js $(BINDIR)/compiled.css.map.js \
  41. --js deps/closure-library/closure/goog/ \
  42. --js deps/incremental-dom-closure.js \
  43. --js deps/soyutils_usegoog.js \
  44. --js=bin/www/**.js \
  45. --js=src/www/js/**.js \
  46. --closure_entry_point=mammoth.app \
  47. --only_closure_dependencies \
  48. --compilation_level=ADVANCED_OPTIMIZATIONS \
  49. --define=goog.DEBUG=false \
  50. --define=goog.STRICT_MODE_COMPATIBLE=true \
  51. --define=goog.json.USE_NATIVE_JSON=true \
  52. --define=goog.soy.REQUIRE_STRICT_AUTOESCAPE=true \
  53. --warning_level=VERBOSE \
  54. --jscomp_error=* \
  55. --hide_warnings_for=deps/closure-library/closure/goog/ \
  56. --hide_warnings_for=deps/incremental-dom-closure.js \
  57. --hide_warnings_for=deps/soyutils_usegoog.js \
  58. --hide_warnings_for=bin/www/ \
  59. --language_in=ECMASCRIPT6_STRICT \
  60. --language_out=ECMASCRIPT5_STRICT \
  61. --create_source_map=$(BINDIR)/compiled.map.json \
  62. --use_types_for_optimization \
  63. --js_output_file=$(RDIR)/compiled.js \
  64. --output_wrapper="(function(){%output%}).call(this);"
  65. $(RDIR)/logo.svg: src/www/img/logo.svg
  66. cp src/www/img/logo.svg $(RDIR)/logo.svg
  67. $(RDIR)/*.png: $(GSS)
  68. cp src/www/img/*.png $(RDIR)
  69. $(RDIR)/roboto.woff: src/www/roboto.woff
  70. cp src/www/roboto.woff $(RDIR)/roboto.woff
  71. lint:
  72. @go install github.com/golang/lint/...
  73. find src/mail src/mammoth src/www -name *.go -type f | \
  74. xargs -I {} go fmt {}
  75. find src/mail src/mammoth src/www -name *.go -type f | \
  76. xargs -I {} go vet {}
  77. find src/mail src/mammoth src/www -name *.go -type f | \
  78. xargs -I {} $(BINDIR)/golint {}
  79. find src/www -name *.js | \
  80. xargs -I {} java -jar deps/linter.jar {}
  81. find src/www -name *.js | \
  82. xargs -I {} ./deps/clang/bin/clang-format -style=Google -i {}
  83. clean:
  84. rm -rf $(RDIR) $(BINDIR) pkg