aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 13 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 6ddd223..7b70f0a 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,8 @@ functional-tests.a = $(functional-tests.go:.go=.a)
functional-tests.bin = $(functional-tests.go:.go=.bin)
fuzz-targets.a = $(fuzz-targets.go:.go=.a)
fuzz-targets.bin = $(fuzz-targets.go:.go=.bin)
+benchmarks.a = $(benchmarks.go:.go=.a)
+benchmarks.bin = $(benchmarks.go:.go=.bin)
cgo.go = \
src/_cgo_import.go \
@@ -71,6 +73,8 @@ derived-assets = \
tests/functional/streq.so \
$(fuzz-targets.a) \
$(fuzz-targets.bin) \
+ $(benchmarks.a) \
+ $(benchmarks.bin) \
side-assets = \
src/_cgo_export.h \
@@ -87,7 +91,7 @@ $(derived-assets): Makefile deps.mk
$(cgo.go) $(cgo.c) $(cgo.o): src/_cgo_.o
-$(functional-tests.a) $(fuzz-targets.a): src/$(NAME).a
+$(functional-tests.a) $(fuzz-targets.a) $(benchmarks.a): src/$(NAME).a
src/_cgo_.o: src/$(NAME).go
@@ -113,13 +117,13 @@ tests/main.bin: tests/main.a
src/version.go: Makefile
echo 'package $(NAME); const Version = "$(VERSION)"' > $@
-$(functional-tests.a):
+$(functional-tests.a) $(benchmarks.a):
go tool compile $(GOCFLAGS) -o $@ -p main -I src $*.go
$(fuzz-targets.a):
go tool compile -d=libfuzzer $(GOCFLAGS) -o $@ -p main -I src $*.go
-$(functional-tests.bin) $(fuzz-targets.bin):
+$(functional-tests.bin) $(fuzz-targets.bin) $(benchmarks.bin):
go tool link $(GOLDFLAGS) -o $@ -L src --extldflags '$(LDLIBS)' $*.a
tests/functional/streq.so: tests/functional/streq.c
@@ -165,14 +169,17 @@ FUZZSEC=1
fuzz-targets.bin-check = $(fuzz-targets.go:.go=.bin-check)
$(fuzz-targets.bin-check):
$(EXEC)$*.bin --test.fuzztime=$(FUZZSEC)s \
- --test.fuzz=Fuzz --test.fuzzcachedir=tests/fuzz/corpus
+ --test.fuzz='.*' --test.fuzzcachedir=tests/fuzz/corpus
fuzz: $(fuzz-targets.bin-check)
-bench: tests/main.bin
- $(EXEC)tests/main.bin -test.bench '.*'
+benchmarks.bin-check = $(benchmarks.go:.go=.bin-check)
+$(benchmarks.bin-check):
+ $(EXEC)$*.bin
+
+bench: $(benchmarks.bin-check)