forked from chirpstack/chirpstack-gateway-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (42 loc) · 1.35 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
.PHONY: build clean test package serve run-compose-test
PKGS := $(shell go list ./... | grep -v /vendor/)
VERSION := $(shell git describe --always)
GOOS ?= linux
GOARCH ?= amd64
build:
@echo "Compiling source for $(GOOS) $(GOARCH)"
@mkdir -p build
@GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X main.version=$(VERSION)" -o build/lora-gateway-bridge$(BINEXT) cmd/lora-gateway-bridge/main.go
clean:
@echo "Cleaning up workspace"
@rm -rf build
@rm -rf dist/tar/$(VERSION)
@rm -rf docs/public
test:
@echo "Running tests"
@for pkg in $(PKGS) ; do \
golint $$pkg ; \
done
@go vet $(PKGS)
@go test -cover -v $(PKGS)
documentation:
@echo "Building documentation"
@mkdir -p dist/docs
@cd docs && hugo
@cd docs/public/ && tar -pczf ../../dist/docs/lora-gateway-bridge.tar.gz .
package: clean build
@echo "Creating package for $(GOOS) $(GOARCH)"
@mkdir -p dist/tar/$(VERSION)
@cp build/* dist/tar/$(VERSION)
@cd dist/tar/$(VERSION)/ && tar -pczf ../lora_gateway_bridge_$(VERSION)_$(GOOS)_$(GOARCH).tar.gz .
@rm -rf dist/tar/$(VERSION)
package-deb:
@cd packaging && TARGET=deb ./package.sh
requirements:
@go get -u github.com/golang/lint/golint
@go get -u github.com/kisielk/errcheck
# shortcuts for development
serve: build
./build/lora-gateway-bridge
run-compose-test:
docker-compose run --rm gatewaybridge make test