Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. # Don't allow an implicit 'all' rule. This is not a user-facing file.
  2. ifeq ($(MAKECMDGOALS),)
  3. $(error This Makefile requires an explicit rule to be specified)
  4. endif
  5. ifeq ($(DBG_MAKEFILE),1)
  6. $(warning ***** starting Makefile.generated_files for goal(s) "$(MAKECMDGOALS)")
  7. $(warning ***** $(shell date))
  8. endif
  9. GOBIN := $(go env GOBIN)
  10. ifeq ($(GOBIN),)
  11. GOBIN := ~/go/bin
  12. endif
  13. # It's necessary to set this because some environments don't link sh -> bash.
  14. SHELL := /bin/bash
  15. ARCH := "`uname -s`"
  16. LINUX := "Linux"
  17. MAC := "Darwin"
  18. # We don't need make's built-in rules.
  19. MAKEFLAGS += --no-builtin-rules
  20. .SUFFIXES:
  21. # Constants used throughout.
  22. .EXPORT_ALL_VARIABLES:
  23. OUT_DIR ?= _output
  24. BIN_DIR := $(OUT_DIR)/bin
  25. .PHONY: build update clean
  26. all: check bazel-update
  27. build: init check bazel-build
  28. test-coverage:
  29. bazel coverage --test_env=DEPLOY_ENV=uat --test_timeout=60 --test_env=APP_ID=bazel.test --test_output=all --cache_test_results=no //app/service/main/account/dao/...
  30. simple-build:
  31. bazel build --watchfs -- //tools/... -//vendor/...
  32. ifeq ($(WHAT),)
  33. bazel-build:
  34. bazel build --config=office --watchfs //app/... //build/... //library/...
  35. else
  36. bazel-build:
  37. bazel build --config=ci -- //$(WHAT)/...
  38. endif
  39. build-keep-going:
  40. bazel build --config=ci -k //app/... //build/... //library/...
  41. cat bazel-out/stable-status.txt
  42. clean:
  43. bazel clean --expunge
  44. rm -rf _output
  45. update: init bazel-update
  46. bazel-update:
  47. ./build/update-bazel.sh
  48. prow-update:
  49. ./build/update-prow.sh
  50. test:
  51. @if [ "$(WHAT)" != "" ]; \
  52. then \
  53. cd $(WHAT) && make ; \
  54. else \
  55. echo "Please input the WHAT" ;\
  56. fi
  57. bazel-test:
  58. @if [ "$(WHAT)" != "" ]; \
  59. then \
  60. bazel test --watchfs -- //$(WHAT)/... ; \
  61. else \
  62. echo "Please input the WHAT" ;\
  63. fi
  64. check:
  65. @./build/check.sh
  66. init:
  67. @if [ ! -f .git/hooks/pre-commit ] ; \
  68. then \
  69. echo "make all" >> .git/hooks/pre-commit; \
  70. sudo chmod +x .git/hooks/pre-commit; \
  71. fi
  72. build-all-kratos:
  73. bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_386 //app/tool/kratos:kratos
  74. bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //app/tool/kratos:kratos
  75. bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //app/tool/kratos:kratos
  76. install-kratos: init check build-kratos
  77. @if [[ "$(ARCH)" == "Linux" ]]; then \
  78. cp bazel-bin/app/tool/kratos/linux_amd64_pure_stripped/kratos $(GOBIN); \
  79. fi; \
  80. if [[ "$(ARCH)" == "Darwin" ]]; then \
  81. cp bazel-bin/app/tool/kratos/darwin_amd64_stripped/kratos $(GOBIN); \
  82. fi
  83. build-kratos:
  84. bazel build //app/tool/kratos:kratos
  85. ci-bazel-build:
  86. bazel build --config=ci -- //app/...
  87. ci-bazel-build-a:
  88. bazel build --config=ci -- //app/admin/...
  89. ci-bazel-build-b:
  90. bazel build --config=ci -- //app/interface/...
  91. ci-bazel-build-c:
  92. bazel build --config=ci -- //app/job/... //app/tool/... //app/common/... //app/infra/...
  93. ci-bazel-build-d:
  94. bazel build --config=ci -- //app/service/... //library/...
  95. ci-bazel-build-common:
  96. bazel build --config=ci -- //app/common/...
  97. ci-bazel-build-infra:
  98. bazel build --config=ci -- //app/infra/...
  99. ci-bazel-build-tool:
  100. bazel build --config=ci -- //app/tool/...
  101. ci-bazel-build-main:
  102. bazel build --config=ci -- //app/admin/main/... //app/interface/main/... //app/job/main/... //app/service/main/...
  103. ci-bazel-build-live:
  104. bazel build --config=ci -- //app/admin/live/... //app/interface/live/... //app/job/live/... //app/job/live-userexp/... //app/service/live/...
  105. ci-bazel-build-ep:
  106. bazel build --config=ci -- //app/admin/ep/... //app/service/ep/...
  107. ci-bazel-build-openplatform:
  108. bazel build --config=ci -- //app/admin/openplatform/... //app/interface/openplatform/... //app/job/openplatform/... //app/service/openplatform/...
  109. ci-bazel-build-bbq:
  110. bazel build --config=ci -- //app/interface/bbq/... //app/job/bbq/... //app/service/bbq/...
  111. ci-bazel-build-video:
  112. bazel build --config=ci -- //app/interface/video/... //app/service/video/...
  113. ci-bazel-build-ops:
  114. bazel build --config=ci -- //app/service/ops/...
  115. ci-bazel-build-library:
  116. bazel build --config=ci -- //library/...
  117. ci-bazel-build-admin-main:
  118. bazel build --config=ci -- //app/admin/main/...
  119. ci-bazel-build-interface-main:
  120. bazel build --config=ci -- //app/interface/main/...
  121. ci-bazel-build-job-main:
  122. bazel build --config=ci -- //app/job/main/...
  123. ci-bazel-build-service-main:
  124. bazel build --config=ci -- //app/service/main/...