Debian Codegraph @

Makefile

raw
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
15 ifeq ($(NOASM),1)
16 OPTS+=$(OPTS_TAGS)
17 endif
18
19 ifeq ($(PPROF),1)
20 BENCH_OPTS+= -cpuprofile=cpu.out -memprofile=mem0.out
21 endif
22
23 ifeq ($(DBG),1)
24 DBG_FLAGS+= #-m # escape analysis
25 DBG_FLAGS+= -l # no inline
26 DBG_FLAGS+= -N # debug symbols
27 #OPTS+=-gcflags=all="$(DBG_FLAGS)"
28 OPTS+=-gcflags "$(DBG_FLAGS)"
29 OPTS_ENV+= GOTRACEBACK=crash # enable core dumps
30 endif
31
32 test:
33 $(OPTS_ENV) $(GO) test $(OPTS) $(TEST_PATH)
34
35 test_csidh: clean make_dirs $(addprefix prep-,$(TARGETS))
36 cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go test $(OPTS) github.com/henrydcase/nobs/dh/csidh
37
38 test_csidh_bin: clean make_dirs $(addprefix prep-,$(TARGETS))
39 cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go test -c $(OPTS) github.com/henrydcase/nobs/dh/csidh
40
41 cover:
42 $(GO) test \
43 -coverprofile=coverage.txt -covermode=atomic $(OPTS) $(TEST_PATH)
44
45 bench:
46 $(GO) test $(BENCH_OPTS) $(TEST_PATH)
47
48 bench_csidh: clean $(addprefix prep-,$(TARGETS))
49 cd $(GOPATH_LOCAL); GOCACHE=$(GOCACHE) GOPATH=$(GOPATH_LOCAL) $(GO) test \
50 $(BENCH_OPTS) github.com/henrydcase/nobs/dh/csidh
51
52 clean:
53 rm -rf $(VENDOR_DIR)
54 rm -rf coverage.txt
55
56 vendor-sidh-for-tls: clean
57 mkdir -p $(VENDOR_DIR)/github_com/henrydcase/nobs/
58 rsync -a . $(VENDOR_DIR)/github_com/henrydcase/nobs/ --exclude=$(VENDOR_DIR) --exclude=.git --exclude=.travis.yml --exclude=README.md
59 find $(VENDOR_DIR) -type f -print0 -name "*.go" | xargs -0 sed -i 's/github\.com/github_com/g'
60
61 pprof-cpu:
62 $(GO) tool pprof cpu.out
63
64 pprof-mem:
65 $(GO) tool pprof mem0.out