forked from brocaar/chirpstack-network-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (55 loc) · 1.78 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
65
66
.PHONY: build clean test package serve update-vendor api statics
PKGS := $(shell go list ./... | grep -v /vendor/ | grep -v loraserver/api | grep -v /migrations | grep -v /static)
VERSION := $(shell git describe --always |sed -e "s/^v//")
build: statics
@echo "Compiling source"
@mkdir -p build
go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(VERSION)" -o build/loraserver cmd/loraserver/main.go
clean:
@echo "Cleaning up workspace"
@rm -rf build
@rm -rf dist
@rm -rf docs/public
test: statics
@echo "Running tests"
@for pkg in $(PKGS) ; do \
golint $$pkg ; \
done
@go vet $(PKGS)
@go test -p 1 -v $(PKGS)
dist:
goreleaser
mkdir -p dist/upload/tar
mkdir -p dist/upload/deb
mv dist/*.tar.gz dist/upload/tar
mv dist/*.deb dist/upload/deb
snapshot:
@goreleaser --snapshot
api:
@echo "Generating API code from .proto files"
go generate api/gw/gw.go
go generate api/as/as.go
go generate api/nc/nc.go
go generate api/ns/ns.go
go generate api/geo/geo.go
go generate api/common/common.go
go generate internal/storage/device_session.go
statics:
@echo "Generating static files"
@go generate cmd/loraserver/main.go
dev-requirements:
go install golang.org/x/lint/golint
go install golang.org/x/tools/cmd/stringer
go install github.com/golang/protobuf/protoc-gen-go
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go install github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
go install github.com/jteeuwen/go-bindata/go-bindata
go install github.com/goreleaser/goreleaser
go install github.com/goreleaser/nfpm
# shortcuts for development
serve: build
@echo "Starting Lora Server"
./build/loraserver
run-compose-test:
docker-compose run --rm loraserver make test