-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmakefile
65 lines (47 loc) · 1.44 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
CC=go
RM=rm
MV=mv
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
#GOPATH=$(SOURCEDIR)/
GOOS=linux
GOARCH=amd64
#GOARCH=arm
GOARM=7
EXEC=facedetection
VERSION=1.0.0
BUILD_TIME=`date +%FT%T%z`
PACKAGES := fmt github.com/harrydb/go/img/grayscale github.com/disintegration/imaging
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}-${VERSION} $(SOURCEDIR)/main.go;\
else\
GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build ${LDFLAGS} -o ${EXEC}-${VERSION} $(SOURCEDIR)/main.go;\
fi
@echo " ${EXEC}-${VERSION} 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}-${VERSION}
clean:
@if [ -f "${EXEC}-${VERSION}" ] ; then rm ${EXEC}-${VERSION} ; fi
@echo " Nettoyage effectuee"
package: ${EXEC}
@zip -r ${EXEC}-${GOOS}-${GOARCH}-${VERSION}.zip ./${EXEC}-${VERSION} resources
@echo " Archive ${EXEC}-${GOOS}-${GOARCH}-${VERSION}.zip created"
audit: ${EXEC}
@go tool vet -all -shadow ./
@echo " Audit effectue"
test: $(EXEC)
@GOOS=${GOOS} GOARCH=${GOARCH} go test ./...
@echo " Tests OK."