1
0
mirror of https://github.com/henrydcase/nobs.git synced 2024-11-25 16:41:32 +00:00
nobs/Makefile

60 lines
1.4 KiB
Makefile
Raw Normal View History

2018-07-31 18:00:55 +01:00
# I'm sure there is better way. But I would need to find it first
MK_FILE_PATH = $(lastword $(MAKEFILE_LIST))
PRJ_DIR = $(abspath $(dir $(MK_FILE_PATH)))
2018-10-25 15:18:54 +01:00
GO ?= go
2018-07-31 18:00:55 +01:00
VENDOR_DIR = tls_vendor
2019-04-09 17:28:02 +01:00
OPTS ?= -v
2018-10-25 15:18:54 +01:00
NOASM ?=
TEST_PATH ?= ./...
GOCACHE ?= off
2019-04-09 17:28:02 +01:00
BENCH_OPTS ?= -v -bench=. -run="^_" -benchmem
TEST_PATH ?= ./...
2019-04-09 17:28:02 +01:00
DBG = 1
OPTS_ENV =
2018-07-31 18:14:59 +01:00
ifeq ($(NOASM),1)
OPTS+=$(OPTS_TAGS)
endif
2018-07-31 18:00:55 +01:00
ifeq ($(PPROF),1)
BENCH_OPTS+= -cpuprofile=cpu.out -memprofile=mem0.out
endif
2019-04-09 17:28:02 +01:00
ifeq ($(DBG),1)
DBG_FLAGS+= #-m # escape analysis
DBG_FLAGS+= -l # no inline
DBG_FLAGS+= -N # debug symbols
#OPTS+=-gcflags=all="$(DBG_FLAGS)"
OPTS+=-gcflags "$(DBG_FLAGS)"
OPTS_ENV+= GOTRACEBACK=crash # enable core dumps
endif
2020-05-14 09:51:20 +01:00
test:
$(OPTS_ENV) $(GO) test $(OPTS) $(TEST_PATH)
2018-07-31 18:14:59 +01:00
cover:
$(GO) test \
-coverprofile=coverage.txt -covermode=atomic $(OPTS) $(TEST_PATH)
2018-07-31 18:00:55 +01:00
bench:
$(GO) test $(BENCH_OPTS) $(TEST_PATH)
2018-10-25 15:18:54 +01:00
2018-07-31 18:00:55 +01:00
clean:
rm -rf $(VENDOR_DIR)
rm -rf coverage.txt
2018-07-31 18:00:55 +01:00
vendor-sidh-for-tls: clean
mkdir -p $(VENDOR_DIR)/github_com/henrydcase/nobs/
rsync -a . $(VENDOR_DIR)/github_com/henrydcase/nobs/ --exclude=$(VENDOR_DIR) --exclude=.git --exclude=.travis.yml --exclude=README.md
find $(VENDOR_DIR) -type f -print0 -name "*.go" | xargs -0 sed -i 's/github\.com/github_com/g'
2020-05-14 09:51:20 +01:00
gen: clean
$(GO) generate -v ./...
$(GO) mod tidy
pprof-cpu:
$(GO) tool pprof cpu.out
pprof-mem:
$(GO) tool pprof mem0.out