-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
78 lines (64 loc) · 1.72 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
# Variables
REPOSITORY := tentacule/pgstosrt
LANGUAGE := eng
TAG_ALL := latest
# Makefile.env
ifneq (,$(wildcard ./Makefile.env))
include Makefile.env
export
endif
##
##@ General
##
## Print this message and exit
.PHONY: help
help:
@awk ' \
BEGIN { \
printf "\nUsage:\n make \033[36m<target>\033[0m\n" \
} \
END { \
printf "\n" \
} \
/^[0-9A-Za-z-]+:/ { \
if (prev ~ /^## /) { \
printf " \x1b[36m%-23s\x1b[0m %s\n", substr($$1, 0, length($$1)-1), substr(prev, 3) \
} \
} \
/^##@/ { \
printf "\n\033[1m%s\033[0m\n", substr($$0, 5) \
} \
!/^\.PHONY/ { \
prev = $$0 \
} \
' $(MAKEFILE_LIST)
##
##@ Supplemental
##
## Download tesseract-ocr data files
tessdata:
git clone --depth=1 https://github.com/tesseract-ocr/tessdata.git
##
##@ Single language
##
## Build a single-language docker image (options: LANGUAGE=eng)
build-single: tessdata
docker build . \
--file Dockerfile \
--tag $(REPOSITORY):$(LANGUAGE) \
--build-arg LANGUAGE=$(LANGUAGE)
## Push a single-language docker image (options: LANGUAGE=eng)
push-single:
docker push $(REPOSITORY):$(LANGUAGE)
##
##@ Multi language
##
## Build all-languages docker image (default language is `eng`)
build-all: tessdata
docker build . \
--file Dockerfile \
--tag $(REPOSITORY):$(TAG_ALL) \
--build-arg LANGUAGE=*
## Push all-languages docker image
push-all:
docker push $(REPOSITORY):$(TAG_ALL)