Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # -----------------------
  2. # Compilation options
  3. # -----------------------
  4. RELEASE := 1
  5. STATIC := 0
  6. NO_DBG_SYMBOLS := 0
  7. FLAGS ?=
  8. ifeq ($(RELEASE), 1)
  9. FLAGS += --release
  10. endif
  11. ifeq ($(STATIC), 1)
  12. FLAGS += --static
  13. endif
  14. ifeq ($(NO_DBG_SYMBOLS), 1)
  15. FLAGS += --no-debug
  16. else
  17. FLAGS += --debug
  18. endif
  19. ifeq ($(API_ONLY), 1)
  20. FLAGS += -Dapi_only
  21. endif
  22. # -----------------------
  23. # Main
  24. # -----------------------
  25. all: invidious
  26. get-libs:
  27. shards install --production
  28. # TODO: add support for ARM64 via cross-compilation
  29. invidious: get-libs
  30. crystal build src/invidious.cr $(FLAGS) --progress --stats --error-trace
  31. run: invidious
  32. ./invidious
  33. # -----------------------
  34. # Development
  35. # -----------------------
  36. format:
  37. crystal tool format
  38. test:
  39. crystal spec
  40. verify:
  41. crystal build src/invidious.cr -Dskip_videojs_download \
  42. --no-codegen --progress --stats --error-trace
  43. # -----------------------
  44. # (Un)Install
  45. # -----------------------
  46. # TODO
  47. # -----------------------
  48. # Cleaning
  49. # -----------------------
  50. clean:
  51. rm invidious
  52. distclean: clean
  53. rm -rf libs
  54. rm -rf ~/.cache/{crystal,shards}
  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 " API_ONLY Build invidious without a GUI (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