-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 lines (35 loc) · 1.28 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
.PHONY: clean run generated fixlinter watch publish
IMAGE = stor.highloadcup.ru/travels/raccoon_shooter
all: fixlinter hlcup
fixlinter: generated
# "Running 'go get' to fix linters analysis"
go clean github.com/ei-grad/hlcup/...
go get github.com/ei-grad/hlcup/...
DB = array
GENERATED = \
models/entities_easyjson.go \
models/indexes_easyjson.go
$(GENERATED): models/entities.go models/indexes.go
go generate ./models
generated: $(GENERATED)
DATE = $(shell LANG=C date --iso=seconds)
LDFLAGS = '-s -w -X main.appBuildDate=$(DATE)'
SOURCES = $(wildcard *.go */*.go)
hlcup: $(SOURCES) $(GENERATED)
CGO_ENABLED=0 go build $(TAGS) -ldflags=$(LDFLAGS)
docker: $(SOURCES) Dockerfile
docker build -t $(IMAGE) .
touch docker
DATA = full
race: $(SOURCES) $(GENERATED)
go run -race $(TAGS) -ldflags=$(LDFLAGS) $(wildcard *.go) -b :8000 -data $(DATA)/data.zip $(ARGS)
MEMORY = 4294967296
run: docker
docker run -it --rm -m=$(MEMORY) --ulimit memlock=$(MEMORY):$(MEMORY) --net=host -v `realpath $(DATA)`:/tmp/data $(IMAGE)
publish: docker
docker push $(IMAGE)
clean:
go clean ./... github.com/ei-grad/hlcup/...
rm -rf hlcup docker $(GENERATED)
watch: $(SOURCES) $(GENERATED)
iwatch "go build $(TAGS) -ldflags=$(LDFLAGS) -o hlcup-watch && ./hlcup-watch -b :8000 -data $(DATA)/data.zip $(ARGS)"