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

83 lines
2.7 KiB
Makefile
Raw Permalink 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)))
GOPATH_LOCAL = $(PRJ_DIR)/build/
GOPATH_DIR = src/github.com/henrydcase/nobs
VENDOR_DIR = tls_vendor
2019-02-15 16:41:00 +00:00
OPTS ?= -v
2018-07-31 18:14:59 +01:00
NOASM ?=
2019-02-15 16:41:00 +00:00
ETC_DIR = $(PRJ_DIR)/etc
GO ?= go
2019-02-17 22:29:27 +00:00
BENCH_OPTS ?= -bench=. -run="^_"
2019-02-15 16:41:00 +00:00
V ?= 0
GOCACHE ?= off
GOARCH ?=
ETC_DIR = $(PRJ_DIR)/etc
2019-02-19 14:43:36 +00:00
BENCH_NAME = BenchmarkXMul
2019-02-17 22:29:27 +00: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
2019-02-17 22:29:27 +00:00
ifeq ($(DBG),1)
2019-02-19 14:43:36 +00:00
DBG_FLAGS+= #-m # escape analysis
DBG_FLAGS+= -l # no inline
DBG_FLAGS+= -N # debug symbols
2019-02-17 22:29:27 +00:00
#OPTS+=-gcflags=all="$(DBG_FLAGS)"
OPTS+=-gcflags "$(DBG_FLAGS)"
OPTS_ENV+= GOTRACEBACK=crash # enable core dumps
endif
2018-07-31 19:14:49 +01:00
TARGETS= \
dh \
drbg \
ec \
2018-07-31 19:14:49 +01:00
hash \
2019-02-17 22:29:27 +00:00
kem \
utils
2018-07-31 18:00:55 +01:00
prep-%:
mkdir -p $(GOPATH_LOCAL)/$(GOPATH_DIR)
cp -rf $* $(GOPATH_LOCAL)/$(GOPATH_DIR)/$*
make_dirs:
mkdir -p $(GOPATH_LOCAL)/$(GOPATH_DIR)
2018-07-31 18:14:59 +01:00
cp -rf etc $(GOPATH_LOCAL)/$(GOPATH_DIR)
2018-07-31 18:00:55 +01:00
test: clean make_dirs $(addprefix prep-,$(TARGETS))
2019-02-17 22:29:27 +00:00
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go test $(OPTS) ./...
2018-07-31 18:14:59 +01:00
2018-10-19 10:13:43 +01:00
build: clean make_dirs $(addprefix prep-,$(TARGETS))
2019-02-17 22:29:27 +00:00
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go build $(OPTS) ./...
2018-10-19 10:13:43 +01:00
2018-07-31 18:14:59 +01:00
cover:
2019-02-17 22:29:27 +00:00
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOPATH=$(GOPATH_LOCAL) go test \
-race -coverprofile=coverage_$(NOASM).txt -covermode=atomic $(OPTS) ./...
2018-07-31 18:14:59 +01:00
cat $(GOPATH_LOCAL)/coverage_$(NOASM).txt >> coverage.txt
2018-07-31 18:00:55 +01:00
clean:
rm -rf $(GOPATH_LOCAL)
rm -rf $(VENDOR_DIR)
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'
2019-02-15 16:41:00 +00:00
bench: clean $(addprefix prep-,$(TARGETS))
2019-02-17 22:29:27 +00:00
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOCACHE=$(GOCACHE) GOPATH=$(GOPATH_LOCAL) GOMAXPROCS=1 $(GO) test \
2019-02-15 16:41:00 +00:00
$(BENCH_OPTS) ./...
2019-02-19 14:43:36 +00:00
bench_csidh: clean make_dirs $(addprefix prep-,$(TARGETS))
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOCACHE=$(GOCACHE) GOPATH=$(GOPATH_LOCAL) GOMAXPROCS=1 $(GO) test \
$(OPTS) -run="^_" -bench=$(BENCH_NAME) -memprofile mem.prof -benchmem github.com/henrydcase/nobs/dh/csidh
test_drbg: clean make_dirs $(addprefix prep-,$(TARGETS))
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOCACHE=$(GOCACHE) GOPATH=$(GOPATH_LOCAL) GOMAXPROCS=1 $(GO) test \
$(OPTS) -c -run=. github.com/henrydcase/nobs/drbg
bench_drbg: clean make_dirs $(addprefix prep-,$(TARGETS))
cd $(GOPATH_LOCAL); $(OPTS_ENV) GOCACHE=$(GOCACHE) GOPATH=$(GOPATH_LOCAL) GOMAXPROCS=1 $(GO) test \
$(OPTS) -run="XXX" -bench=. -benchmem -memprofile=drbg_prof github.com/henrydcase/nobs/drbg