-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
79 lines (56 loc) · 1.88 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
67
68
69
70
71
72
73
74
75
76
77
78
79
CC=go
RM=rm
MV=mv
SOURCEDIR=.
SOURCES:= $(shell find $(SOURCEDIR) -name '*.go')
GOARM=7
#GOARCH=amd64
EXEC=bebopanalyzer
VERSION=1.11
BUILD_TIME=`date +%FT%T%z`
PACKAGES:= github.com/metakeule/fmtdate github.com/ptrv/go-gpx github.com/gorilla/mux github.com/gorilla/mux
LIBS=
LDFLAGS=
.DEFAULT_GOAL:= $(EXEC)
$(EXEC): organize $(SOURCES)
@echo " Compilation des sources ${BUILD_TIME}"
@if [ "arm" = "${GOARCH}" ]; then\
GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build ${LDFLAGS} -o ${EXEC} $(SOURCEDIR)/main.go;\
else\
GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build ${LDFLAGS} -o ${EXEC} $(SOURCEDIR)/main.go;\
fi
@echo " ${EXEC} version:${VERSION}.${GOOS}-${GOARCH} generated."
deps: init
@echo " Download packages"
@$(foreach element,$(PACKAGES),go get -d -v $(element);)
organize: deps
@echo " Go FMT"
@$(foreach element,$(SOURCES),go fmt $(element);)
init: clean
@echo " Init of the project"
execute:
./${EXEC} conf.json
clean:
@if [ -f "${EXEC}" ] ; then rm ${EXEC} ; fi
@echo " Nettoyage effectuee"
package: ${EXEC} swagger
@zip -r ${EXEC}-${GOOS}-${GOARCH}-${VERSION}.zip ./${EXEC} resources
@echo " Archive ${EXEC}-${GOOS}-${GOARCH}-${VERSION}.zip created"
audit: ${EXEC}
@go tool vet -all -shadow ./
@echo " Audit effectue"
swagger:
@echo "Generate swagger json file specs"
@GOOS=linux GOARCH=amd64 go run ${GOPATH}/src/github.com/go-swagger/go-swagger/cmd/swagger/swagger.go generate spec -m -b ./routes > resources/swagger.json
@echo "Specs generate at resources/swagger.json"
deps: get-linter get-vulncheck
@echo "Getting tools..."
get-linter:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
get-vulncheck:
go install golang.org/x/vuln/cmd/govulncheck@latest
lint:
@echo "Lint the whole project"
golangci-lint run --timeout 5m ./...
vulncheck:
govulncheck ./...