forked from tleyden/open-ocr
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
52 lines (42 loc) · 2.26 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
OUT_PATH :=
OUT_WORKER := cli_worker_linux
OUT_HTTPD:= cli_httpd_linux
OUT_PREPROCESSOR := cli_preprocessor_linux
PKG := github.com/xf0e/open-ocr
VERSION := $(shell git describe --tags|sed -e "s/\-/\./g")
SHA1VER := $(shell git rev-parse HEAD)
DATE := $(shell date +'%Y-%m-%d_%T')
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name 'main.go' | grep -v /vendor/)
all: run
release:
go build -o ${OUT_WORKER} -buildmode=pie -a -tags 'netgo,static_build' -trimpath -ldflags="-linkmode external -s -w -extldflags '--static-pie' -X main.buildTime=${DATE} \
-X main.sha1ver=${SHA1VER} -X 'github.com/xf0e/open-ocr.version=${VERSION}' -X main.version=${VERSION}" cli-worker/main.go
go build -o ${OUT_HTTPD} -buildmode=pie -a -tags 'netgo,static_build' -trimpath -ldflags="-linkmode external -s -w -extldflags '--static-pie' -X main.buildTime=${DATE} \
-X main.sha1ver=${SHA1VER} -X main.version=${VERSION} -X 'github.com/xf0e/open-ocr.version=${VERSION}'" cli-httpd/main.go
go build -o ${OUT_PREPROCESSOR} -buildmode=pie -a -tags 'netgo,static_build' -trimpath -ldflags="-linkmode external -s -w -extldflags '--static-pie' -X main.buildTime=${DATE} \
-X main.sha1ver=${SHA1VER} -X main.version=${VERSION}" cli-preprocessor/main.go
debug:
@go build -o ${OUT_WORKER} -buildmode=pie -a -tags netgo -ldflags="-w -X main.buildTime=${DATE} \
-X main.sha1ver=${SHA1VER} -X main.version=${VERSION} -X github.com/xf0e/open-ocr.version=${VERSION}" cli-worker/main.go
@go build -o ${OUT_HTTPD} -buildmode=pie -a -tags netgo -ldflags="-w -X main.buildTime=${DATE} \
-X main.sha1ver=${SHA1VER} -X main.version=${VERSION}" cli-httpd/main.go
@go build -o ${OUT_PREPROCESSOR} -buildmode=pie -a -tags netgo -ldflags="-w -X main.buildTime=${DATE} \
-X main.sha1ver=${SHA1VER} -X main.version=${VERSION}" cli-preprocessor/main.go
test:
@go test -v ${PKG}
vet:
@go vet ${PKG_LIST}
lint:
@for file in ${GO_FILES} ; do \
/home/grrr/go/bin/golint $$file ; \
done
static: vet lint
go build -i -v -o ${OUT}-v${VERSION} -tags netgo -ldflags="-extldflags \"-static\" -w -s -X main.version=${VERSION}" ${PKG}
run: release
./${OUT_WORKER}
./${OUT_HTTPD}
./${OUT_PREPROCESSOR}
clean:
-@rm ${OUT_WORKER} ${OUT_HTTPD} ${OUT_PREPROCESSOR}
.PHONY: run release static vet lint