-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
35 lines (32 loc) · 1.06 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
# Copyright 2020 Namecoin Developers, GPLv3+
buildflags = -v -ldflags '-w -s' -tags netgo,osusergo
GOBIN := $(PWD)/bin
export GOBIN
# ./certinject or ./certinject.exe (on windows)
default: *.go cmd/certinject/*.go
go get -v -d ./cmd/certinject
go generate ./...
go install $(buildflags) ./cmd/certinject
# cross compile
bin/certinject.exe: *.go cmd/certinject/*.go
env GOOS=windows GOARCH=amd64 go generate ./...
env GOOS=windows GOARCH=amd64 go build $(buildflags) -o $@ ./cmd/certinject
strip $@
bin/certinject-linux-amd64: *.go cmd/certinject/*.go
env GOOS=linux GOARCH=amd64 go generate ./...
env GOOS=linux GOARCH=amd64 go build $(buildflags) -o $@ ./cmd/certinject
strip $@
bin/certinject-osx-amd64: *.go cmd/certinject/*.go
env GOOS=darwin GOARCH=amd64 go generate ./...
env GOOS=darwin GOARCH=amd64 go build $(buildflags) -o $@ ./cmd/certinject
all: bin/certinject.exe bin/certinject-linux-amd64 bin/certinject-osx-amd64
clean:
rm -rvf ./bin
test:
go get -v -d -t ./...
go generate ./...
go test ./...
PHONY += all
PHONY += clean
PHONY += default
PHONY += test