forked from brocaar/chirpstack-application-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (45 loc) · 1.51 KB
/
Makefile
File metadata and controls
55 lines (45 loc) · 1.51 KB
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
.PHONY: build clean test package serve update-vendor
PKGS := $(shell go list ./... | grep -v /vendor/ |grep -v /api | grep -v /migrations | grep -v /static)
VERSION := $(shell git describe --always)
GOOS ?= linux
GOARCH ?= amd64
build:
@echo "Compiling source for $(GOOS) $(GOARCH)"
@mkdir -p build
@GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags "-X main.version=$(VERSION)" -o build/lora-app-server$(BINEXT) cmd/lora-app-server/main.go
clean:
@echo "Cleaning up workspace"
@rm -rf build
@rm -rf dist/$(VERSION)
test:
@echo "Running tests"
@for pkg in $(PKGS) ; do \
golint $$pkg ; \
done
@go vet $(PKGS)
@go test -p 1 -v $(PKGS)
package: clean build
@echo "Creating package for $(GOOS) $(GOARCH)"
@mkdir -p dist/$(VERSION)
@cp build/* dist/$(VERSION)
@cd dist/$(VERSION) && tar -pczf ../lora_app_server_$(VERSION)_$(GOOS)_$(GOARCH).tar.gz .
@rm -rf dist/$(VERSION)
generate:
@echo "Running go generate"
@go generate api/api.go
@go generate cmd/lora-app-server/main.go
# shortcuts for development
requirements:
@echo "Installing development tools"
@go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
@go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
@go get -u github.com/golang/protobuf/protoc-gen-go
@go get -u github.com/elazarl/go-bindata-assetfs/...
serve: build
@echo "Starting Lora App Server"
./build/lora_app_server
update-vendor:
@echo "Updating vendored packages"
@govendor update +external
run-compose-test:
docker-compose run --rm appserver make test