1
0
mirror of https://github.com/henrydcase/nobs.git synced 2024-11-22 15:18:57 +00:00

Improvements to makefile

This commit is contained in:
Henry Case 2019-04-09 17:28:02 +01:00
parent b184944242
commit 71624cdc4c

View File

@ -5,12 +5,14 @@ GO ?= go
GOPATH_LOCAL = $(PRJ_DIR)/build/ GOPATH_LOCAL = $(PRJ_DIR)/build/
GOPATH_DIR = src/github.com/henrydcase/nobs GOPATH_DIR = src/github.com/henrydcase/nobs
VENDOR_DIR = tls_vendor VENDOR_DIR = tls_vendor
OPTS ?= OPTS ?= -v
NOASM ?= NOASM ?=
TEST_PATH ?= ./... TEST_PATH ?= ./...
GOCACHE ?= off GOCACHE ?= off
BENCH_OPTS ?= -v -bench=. -run="NonExistingTest" -benchmem BENCH_OPTS ?= -v -bench=. -run="^_" -benchmem
TEST_PATH ?= ./... TEST_PATH ?= ./...
DBG = 1
OPTS_ENV =
ifeq ($(NOASM),1) ifeq ($(NOASM),1)
OPTS+=$(OPTS_TAGS) OPTS+=$(OPTS_TAGS)
@ -20,6 +22,15 @@ ifeq ($(PPROF),1)
BENCH_OPTS+= -cpuprofile=cpu.out -memprofile=mem0.out BENCH_OPTS+= -cpuprofile=cpu.out -memprofile=mem0.out
endif endif
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
TARGETS ?= \ TARGETS ?= \
dh \ dh \
drbg \ drbg \
@ -37,11 +48,11 @@ make_dirs:
cp -rf etc $(GOPATH_LOCAL)/$(GOPATH_DIR) cp -rf etc $(GOPATH_LOCAL)/$(GOPATH_DIR)
test: clean make_dirs $(addprefix prep-,$(TARGETS)) test: clean make_dirs $(addprefix prep-,$(TARGETS))
cd $(GOPATH_LOCAL); GOPATH=$(GOPATH_LOCAL) go test $(OPTS) -v $(TEST_PATH) cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go test $(OPTS) $(TEST_PATH)
cover: cover:
cd $(GOPATH_LOCAL); GOPATH=$(GOPATH_LOCAL) go test \ cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go test \
-race -coverprofile=coverage_$(NOASM).txt -covermode=atomic $(OPTS) -v $(TEST_PATH) -race -coverprofile=coverage_$(NOASM).txt -covermode=atomic $(OPTS) $(TEST_PATH)
cat $(GOPATH_LOCAL)/coverage_$(NOASM).txt >> coverage.txt cat $(GOPATH_LOCAL)/coverage_$(NOASM).txt >> coverage.txt
bench: clean $(addprefix prep-,$(TARGETS)) bench: clean $(addprefix prep-,$(TARGETS))