forked from LMF709268224/titan-vps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (41 loc) · 1.35 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
SHELL=/usr/bin/env bash
all: build
.PHONY: all
unexport GOFLAGS
GOCC?=go
GOVERSION:=$(shell $(GOCC) version | tr ' ' '\n' | grep go1 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}')
ifeq ($(shell expr $(GOVERSION) \< 1017001), 1)
$(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell expr $(GOVERSION) % 1000000 / 1000).$(shell expr $(GOVERSION) % 1000))
$(error Update Golang to version to at least 1.18)
endif
# git modules that need to be loaded
MODULES:=
CLEAN:=
BINS:=
ldflags=-X=github.com/LMF709268224/titan-vps/build.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
GOFLAGS+=-ldflags="$(ldflags)"
mall: $(BUILD_DEPS)
rm -f mall
$(GOCC) build $(GOFLAGS) -o mall ./cmd/mall
.PHONY: mall
mall-arm: $(BUILD_DEPS)
rm -f mall-arm
GOOS=linux GOARCH=arm $(GOCC) build $(GOFLAGS) -o mall-arm ./cmd/mall
.PHONY: mall-arm
api-gen:
$(GOCC) run ./gen/api
goimports -w api
.PHONY: api-gen
cfgdoc-gen:
$(GOCC) run ./node/config/cfgdocgen > ./node/config/doc_gen.go
build: mall
.PHONY: build
install: install-mall
install-mall:
install -C ./mall /usr/local/bin/mall
mall-image:
docker build -t mall:latest -f ./cmd/mall/Dockerfile .
.PHONY: mall-image