Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # -----------------------
  2. # Compilation options
  3. # -----------------------
  4. RELEASE := 1
  5. STATIC := 0
  6. DISABLE_QUIC := 0
  7. NO_DBG_SYMBOLS := 0
  8. FLAGS ?=
  9. ifeq ($(RELEASE), 1)
  10. FLAGS += --release
  11. endif
  12. ifeq ($(STATIC), 1)
  13. FLAGS += --static
  14. endif
  15. ifeq ($(NO_DBG_SYMBOLS), 1)
  16. FLAGS += --no-debug
  17. else
  18. FLAGS += --debug
  19. endif
  20. ifeq ($(DISABLE_QUIC), 1)
  21. FLAGS += -Ddisable_quic
  22. endif
  23. # -----------------------
  24. # Main
  25. # -----------------------
  26. all: invidious
  27. get-libs:
  28. shards install --production
  29. # TODO: add support for ARM64 via cross-compilation
  30. invidious: get-libs
  31. crystal build src/invidious.cr $(FLAGS) --progress --stats --error-trace
  32. run: invidious
  33. ./invidious
  34. # -----------------------
  35. # Development
  36. # -----------------------
  37. format:
  38. crystal tool format
  39. test:
  40. crystal spec
  41. verify:
  42. crystal build src/invidious.cr -Dskip_videojs_download \
  43. --no-codegen --progress --stats --error-trace
  44. # -----------------------
  45. # (Un)Install
  46. # -----------------------
  47. # TODO
  48. # -----------------------
  49. # Cleaning
  50. # -----------------------
  51. clean:
  52. rm invidious
  53. distclean: clean
  54. rm -rf libs
  55. # -----------------------
  56. # Help page
  57. # -----------------------
  58. help:
  59. @echo "Targets available in this Makefile:"
  60. @echo ""
  61. @echo " get-libs Fetch Crystal libraries"
  62. @echo " invidious Build Invidious"
  63. @echo " run Launch Invidious"
  64. @echo ""
  65. @echo " format Run the Crystal formatter"
  66. @echo " test Run tests"
  67. @echo " verify Just make sure that the code compiles, but without"
  68. @echo " generating any binaries. Useful to search for errors"
  69. @echo ""
  70. @echo " clean Remove build artifacts"
  71. @echo " distclean Remove build artifacts and libraries"
  72. @echo ""
  73. @echo ""
  74. @echo "Build options available for this Makefile:"
  75. @echo ""
  76. @echo " RELEASE Make a release build (Default: 1)"
  77. @echo " STATIC Link libraries statically (Default: 0)"
  78. @echo ""
  79. @echo " DISABLE_QUIC Disable support for QUIC (Default: 0)"
  80. @echo " NO_DBG_SYMBOLS Strip debug symbols (Default: 0)"
  81. # No targets generates an output named after themselves
  82. .PHONY: all get-libs build amd64 run
  83. .PHONY: format test verify clean distclean help