25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

71 lines
1.5 KiB

  1. # I'm sure there is better way. But I would need to find it first
  2. MK_FILE_PATH = $(lastword $(MAKEFILE_LIST))
  3. PRJ_DIR = $(abspath $(dir $(MK_FILE_PATH)))
  4. GO ?= go
  5. VENDOR_DIR = tls_vendor
  6. OPTS ?= -v
  7. NOASM ?=
  8. TEST_PATH ?= ./...
  9. GOCACHE ?= off
  10. BENCH_OPTS ?= -v -bench=. -run="^_" -benchmem
  11. TEST_PATH ?= ./...
  12. DBG = 1
  13. OPTS_ENV =
  14. OPTS_TAGS ?= -tags noasm
  15. ARCH = $(shell uname -m)
  16. ifeq ($(ARCH), ppc64le)
  17. NOASM+=1
  18. endif
  19. ifeq ($(ARCH), riscv64)
  20. NOASM+=1
  21. OPTS_TAGS+= -timeout 0
  22. endif
  23. ifeq ($(NOASM),1)
  24. OPTS+=$(OPTS_TAGS)
  25. endif
  26. ifeq ($(PPROF),1)
  27. BENCH_OPTS+= -cpuprofile=cpu.out -memprofile=mem0.out
  28. endif
  29. ifeq ($(DBG),1)
  30. DBG_FLAGS+= #-m # escape analysis
  31. DBG_FLAGS+= -l # no inline
  32. DBG_FLAGS+= -N # debug symbols
  33. #OPTS+=-gcflags=all="$(DBG_FLAGS)"
  34. OPTS+=-gcflags "$(DBG_FLAGS)"
  35. OPTS_ENV+= GOTRACEBACK=crash # enable core dumps
  36. endif
  37. test:
  38. $(OPTS_ENV) $(GO) test $(OPTS) $(TEST_PATH)
  39. cover:
  40. $(GO) test \
  41. -coverprofile=coverage.txt -covermode=atomic $(OPTS) $(TEST_PATH)
  42. bench:
  43. $(GO) test $(BENCH_OPTS) $(TEST_PATH)
  44. clean:
  45. rm -rf $(VENDOR_DIR)
  46. rm -rf coverage.txt
  47. vendor-sidh-for-tls: clean
  48. mkdir -p $(VENDOR_DIR)/github_com/henrydcase/nobs/
  49. rsync -a . $(VENDOR_DIR)/github_com/henrydcase/nobs/ --exclude=$(VENDOR_DIR) --exclude=.git --exclude=.travis.yml --exclude=README.md
  50. find $(VENDOR_DIR) -type f -print0 -name "*.go" | xargs -0 sed -i 's/github\.com/github_com/g'
  51. gen: clean
  52. $(GO) generate -v ./...
  53. $(GO) mod tidy
  54. pprof-cpu:
  55. $(GO) tool pprof cpu.out
  56. pprof-mem:
  57. $(GO) tool pprof mem0.out