2019-11-19 11:55:02 -07:00
|
|
|
NEBULA_CMD_PATH = "./cmd/nebula"
|
2019-11-19 10:00:20 -07:00
|
|
|
BUILD_NUMBER ?= dev+$(shell date -u '+%Y%m%d%H%M%S')
|
|
|
|
GO111MODULE = on
|
|
|
|
export GO111MODULE
|
|
|
|
|
Add linux-386, linux-ppc64le targets (#56)
* Use golang.org/x/sys/unix for _linux.go sources
To support builds on GOARCH=386 and possibly elsewhere, it's necessary
to use the x/sys/unix package instead of the syscall package. This is
because the syscall package is frozen and does not support
SYS_GETSOCKNAME, SYS_RECVFROM, nor SYS_SENDTO for GOARCH=386.
This commit alone doesn't add support for 386 builds, just gets things
onto x/sys/unix so that it's possible.
The remaining uses of the syscall package relate to signals, which
cannot be switched to the x/sys/unix package at this time. Windows
support breaks, so they can either continue using the syscall package
(it's frozen, this is safe for Go 1.x at minimum), or something can be
written to just use both windows- and unix-compatible signals.
* Add linux-386, ppc64le targets to Makefile
Because 'linux' is linux-amd64 already, just add linux-386 and
linux-ppc64le targets to distinguish them. Would rename the linux
target but that might break existing uses.
2019-12-11 18:51:55 -07:00
|
|
|
all: bin-linux bin-linux-386 bin-linux-ppc64le bin-arm bin-arm6 bin-arm64 bin-darwin bin-windows bin-mips bin-mipsle bin-mips64 bin-mips64le
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
bin:
|
2019-11-23 08:33:02 -07:00
|
|
|
go build -ldflags "-X main.Build=$(BUILD_NUMBER)" -o ./nebula ${NEBULA_CMD_PATH}
|
2019-11-19 10:00:20 -07:00
|
|
|
go build -ldflags "-X main.Build=$(BUILD_NUMBER)" -o ./nebula-cert ./cmd/nebula-cert
|
|
|
|
|
|
|
|
install:
|
2019-11-19 11:55:02 -07:00
|
|
|
go install -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 10:00:20 -07:00
|
|
|
go install -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
|
|
|
bin-arm:
|
2019-11-19 11:31:59 -07:00
|
|
|
mkdir -p build/arm
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=arm GOOS=linux go build -o build/arm/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 11:31:59 -07:00
|
|
|
GOARCH=arm GOOS=linux go build -o build/arm/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
bin-arm6:
|
2019-11-19 11:31:59 -07:00
|
|
|
mkdir -p build/arm6
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=arm GOARM=6 GOOS=linux go build -o build/arm6/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 11:31:59 -07:00
|
|
|
GOARCH=arm GOARM=6 GOOS=linux go build -o build/arm6/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
bin-arm64:
|
2019-11-19 11:31:59 -07:00
|
|
|
mkdir -p build/arm64
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=arm64 GOOS=linux go build -o build/arm64/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 11:31:59 -07:00
|
|
|
GOARCH=arm64 GOOS=linux go build -o build/arm64/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
bin-vagrant:
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=amd64 GOOS=linux go build -o nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 10:00:20 -07:00
|
|
|
GOARCH=amd64 GOOS=linux go build -ldflags "-X main.Build=$(BUILD_NUMBER)" -o ./nebula-cert ./cmd/nebula-cert
|
2019-11-19 11:31:59 -07:00
|
|
|
|
2019-11-19 10:00:20 -07:00
|
|
|
bin-darwin:
|
2019-11-19 11:31:59 -07:00
|
|
|
mkdir -p build/darwin
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=amd64 GOOS=darwin go build -o build/darwin/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 11:31:59 -07:00
|
|
|
GOARCH=amd64 GOOS=darwin go build -o build/darwin/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
bin-windows:
|
2019-11-19 11:31:59 -07:00
|
|
|
mkdir -p build/windows
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=amd64 GOOS=windows go build -o build/windows/nebula.exe -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 11:31:59 -07:00
|
|
|
GOARCH=amd64 GOOS=windows go build -o build/windows/nebula-cert.exe -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
bin-linux:
|
2019-11-19 11:31:59 -07:00
|
|
|
mkdir -p build/linux
|
2019-11-19 11:55:02 -07:00
|
|
|
GOARCH=amd64 GOOS=linux go build -o build/linux/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ${NEBULA_CMD_PATH}
|
2019-11-19 11:31:59 -07:00
|
|
|
GOARCH=amd64 GOOS=linux go build -o build/linux/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
Add linux-386, linux-ppc64le targets (#56)
* Use golang.org/x/sys/unix for _linux.go sources
To support builds on GOARCH=386 and possibly elsewhere, it's necessary
to use the x/sys/unix package instead of the syscall package. This is
because the syscall package is frozen and does not support
SYS_GETSOCKNAME, SYS_RECVFROM, nor SYS_SENDTO for GOARCH=386.
This commit alone doesn't add support for 386 builds, just gets things
onto x/sys/unix so that it's possible.
The remaining uses of the syscall package relate to signals, which
cannot be switched to the x/sys/unix package at this time. Windows
support breaks, so they can either continue using the syscall package
(it's frozen, this is safe for Go 1.x at minimum), or something can be
written to just use both windows- and unix-compatible signals.
* Add linux-386, ppc64le targets to Makefile
Because 'linux' is linux-amd64 already, just add linux-386 and
linux-ppc64le targets to distinguish them. Would rename the linux
target but that might break existing uses.
2019-12-11 18:51:55 -07:00
|
|
|
bin-linux-386:
|
|
|
|
mkdir -p build/linux-386
|
|
|
|
GOARCH=386 GOOS=linux go build -o build/linux-386/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula
|
|
|
|
GOARCH=386 GOOS=linux go build -o build/linux-386/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
|
|
|
bin-linux-ppc64le:
|
|
|
|
mkdir -p build/linux-ppc64le
|
|
|
|
GOARCH=ppc64le GOOS=linux go build -o build/linux-ppc64le/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula
|
|
|
|
GOARCH=ppc64le GOOS=linux go build -o build/linux-ppc64le/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
2019-12-11 11:38:45 -07:00
|
|
|
|
|
|
|
bin-mips:
|
|
|
|
mkdir -p build/mips
|
|
|
|
GOARCH=mips GOOS=linux go build -o build/mips/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula
|
|
|
|
GOARCH=mips GOOS=linux go build -o build/mips/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
|
|
|
|
|
|
|
bin-mipsle:
|
|
|
|
mkdir -p build/mipsle
|
|
|
|
GOARCH=mipsle GOOS=linux go build -o build/mipsle/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula
|
|
|
|
GOARCH=mipsle GOOS=linux go build -o build/mipsle/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
2019-11-21 22:31:12 -07:00
|
|
|
bin-mips64:
|
|
|
|
mkdir -p build/mips64
|
|
|
|
GOARCH=mips64 GOOS=linux go build -o build/mips64/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula
|
|
|
|
GOARCH=mips64 GOOS=linux go build -o build/mips64/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
2019-11-22 16:22:31 -07:00
|
|
|
bin-mips64le:
|
|
|
|
mkdir -p build/mips64le
|
|
|
|
GOARCH=mips64le GOOS=linux go build -o build/mips64le/nebula -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula
|
|
|
|
GOARCH=mips64le GOOS=linux go build -o build/mips64le/nebula-cert -ldflags "-X main.Build=$(BUILD_NUMBER)" ./cmd/nebula-cert
|
|
|
|
|
2019-11-19 11:31:59 -07:00
|
|
|
release: all
|
|
|
|
tar -zcv -C build/arm/ -f nebula-linux-arm.tar.gz nebula nebula-cert
|
|
|
|
tar -zcv -C build/arm6/ -f nebula-linux-arm6.tar.gz nebula nebula-cert
|
|
|
|
tar -zcv -C build/arm64/ -f nebula-linux-arm64.tar.gz nebula nebula-cert
|
|
|
|
tar -zcv -C build/darwin/ -f nebula-darwin-amd64.tar.gz nebula nebula-cert
|
|
|
|
tar -zcv -C build/windows/ -f nebula-windows-amd64.tar.gz nebula.exe nebula-cert.exe
|
|
|
|
tar -zcv -C build/linux/ -f nebula-linux-amd64.tar.gz nebula nebula-cert
|
Add linux-386, linux-ppc64le targets (#56)
* Use golang.org/x/sys/unix for _linux.go sources
To support builds on GOARCH=386 and possibly elsewhere, it's necessary
to use the x/sys/unix package instead of the syscall package. This is
because the syscall package is frozen and does not support
SYS_GETSOCKNAME, SYS_RECVFROM, nor SYS_SENDTO for GOARCH=386.
This commit alone doesn't add support for 386 builds, just gets things
onto x/sys/unix so that it's possible.
The remaining uses of the syscall package relate to signals, which
cannot be switched to the x/sys/unix package at this time. Windows
support breaks, so they can either continue using the syscall package
(it's frozen, this is safe for Go 1.x at minimum), or something can be
written to just use both windows- and unix-compatible signals.
* Add linux-386, ppc64le targets to Makefile
Because 'linux' is linux-amd64 already, just add linux-386 and
linux-ppc64le targets to distinguish them. Would rename the linux
target but that might break existing uses.
2019-12-11 18:51:55 -07:00
|
|
|
tar -zcv -C build/linux-386/ -f nebula-linux-386.tar.gz nebula nebula-cert
|
|
|
|
tar -zcv -C build/linux-ppc64le/ -f nebula-linux-ppc64le.tar.gz nebula nebula-cert
|
2019-12-11 11:38:45 -07:00
|
|
|
tar -zcv -C build/mips/ -f nebula-linux-mips.tar.gz nebula nebula-cert
|
|
|
|
tar -zcv -C build/mipsle/ -f nebula-linux-mipsle.tar.gz nebula nebula-cert
|
2019-11-21 22:31:12 -07:00
|
|
|
tar -zcv -C build/mips64/ -f nebula-linux-mips64.tar.gz nebula nebula-cert
|
2019-11-22 16:22:31 -07:00
|
|
|
tar -zcv -C build/mips64le/ -f nebula-linux-mips64le.tar.gz nebula nebula-cert
|
2019-11-19 10:00:20 -07:00
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet -v ./...
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test -v ./...
|
|
|
|
|
|
|
|
test-cov-html:
|
|
|
|
go test -coverprofile=coverage.out
|
|
|
|
go tool cover -html=coverage.out
|
|
|
|
|
|
|
|
bench:
|
|
|
|
go test -bench=.
|
|
|
|
|
|
|
|
bench-cpu:
|
|
|
|
go test -bench=. -benchtime=5s -cpuprofile=cpu.pprof
|
|
|
|
go tool pprof go-audit.test cpu.pprof
|
|
|
|
|
|
|
|
bench-cpu-long:
|
|
|
|
go test -bench=. -benchtime=60s -cpuprofile=cpu.pprof
|
|
|
|
go tool pprof go-audit.test cpu.pprof
|
|
|
|
|
|
|
|
proto: nebula.pb.go cert/cert.pb.go
|
|
|
|
|
|
|
|
nebula.pb.go: nebula.proto .FORCE
|
|
|
|
go build github.com/golang/protobuf/protoc-gen-go
|
|
|
|
PATH="$(PWD):$(PATH)" protoc --go_out=. $<
|
|
|
|
rm protoc-gen-go
|
|
|
|
|
|
|
|
cert/cert.pb.go: cert/cert.proto .FORCE
|
|
|
|
$(MAKE) -C cert cert.pb.go
|
|
|
|
|
2019-11-19 11:55:02 -07:00
|
|
|
service:
|
|
|
|
@echo > /dev/null
|
|
|
|
$(eval NEBULA_CMD_PATH := "./cmd/nebula-service")
|
|
|
|
ifeq ($(words $(MAKECMDGOALS)),1)
|
|
|
|
$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
|
|
|
|
endif
|
|
|
|
|
2019-11-19 10:00:20 -07:00
|
|
|
.FORCE:
|
2019-11-19 11:55:02 -07:00
|
|
|
.PHONY: test test-cov-html bench bench-cpu bench-cpu-long bin proto release service
|
2019-11-19 10:00:20 -07:00
|
|
|
.DEFAULT_GOAL := bin
|