-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (51 loc) · 1.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
SHELL := /bin/bash
.DEFAULT_GOAL: build
# These will be provided to the target
VERSION := $(shell git describe --tags 2>/dev/null || echo "0.0.0")
COMMIT := $(shell git rev-parse --short=8 HEAD)
# Use linker flags to provide version/build settings to the target
LDFLAGS=-ldflags "-s -w -X=main.version=$(VERSION) -X=main.commit=$(COMMIT)"
.PHONY: build
build:
@env GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o build/base64
.PHONY: clean
clean:
@rm -f $(TARGET)
.PHONY: install
install:
@go install $(LDFLAGS)
.PHONY: lint
lint:
@golangci-lint --color always run
.PHONY: simplify
simplify:
@gofmt -s -l -w .
.PHONY: test
test:
@go test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: go-fuzz
go-fuzz:
@if ! which go-fuzz &>/dev/null; then \
go get github.com/dvyukov/go-fuzz/go-fuzz \
&& go mod tidy \
; \
fi
@if ! which go-fuzz-build &>/dev/null; then \
go get github.com/dvyukov/go-fuzz/go-fuzz-build \
&& go mod tidy \
; \
fi
.PHONY: fuzz-xbase
fuzz-xbase: go-fuzz
@(cd xbase && go-fuzz-build github.com/zemanlx/base64/xbase)
@go-fuzz -bin=xbase/xbase-fuzz.zip -workdir=xbase/fuzz
.PHONY: test-fuzzing
test-fuzzing:
@wget https://app.fuzzbuzz.io/releases/cli/latest/linux/fuzzbuzz
@chmod a+x fuzzbuzz
./fuzzbuzz validate
./fuzzbuzz target build xbase
rm ./fuzzbuzz
.PHONY: integration-test
integration-test: build
@./integration_test.sh