-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (50 loc) · 1.11 KB
/
Makefile
File metadata and controls
64 lines (50 loc) · 1.11 KB
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
_UPX_ENV ?= --no-env
_UPX ?= $(shell which upx)
ifneq ($(UPX),)
_UPX := $(shell [ -f $(UPX) ] && echo $(UPX) || echo $(UPX)/upx)
endif
ifneq ($(_UPX),)
_UPX := $(shell [ -x $(_UPX) ] && echo $(_UPX) || which upx)
endif
ifeq ($(UPX_FAST),)
_UPX_ENV += --ultra-brute -9
else
_UPX_ENV += -1
endif
.PHONY: all
all: build
.PHONY: build
build: init fmt tmallgenie
.PHONY: release
release: init fmt release_tmallgenie
.PHONY: release_build
release_build:
ifneq ($(BINNAME),)
@rm -rf release/$(BINNAME)
ifneq ($(_UPX),)
@$(_UPX) $(_UPX_ENV) bin/$(BINNAME) -o release/$(BINNAME)
else
@echo -e "\033[32;1m### \033[31;1mNo UPX be found, Uncompressed provided!\033[32;1m ###\033[0m"
@cp -raf bin/$(BINNAME) release/$(BINNAME)
endif
endif
.PHONY: init
init:
@mkdir -p bin release
.PHONY: fmt
fmt:
@go fmt ./...
.PHONY: tmallgenie
tmallgenie:
@go build -ldflags "-w -s" -o bin/$@
.PHONY: release_tmallgenie
release_tmallgenie: tmallgenie
@BINNAME=$^ make -C . release_build
.PHONY: clean
clean:
@go clean -i -n -x -cache
@rm -rf bin go.sum
.PHONY: distclean
distclean:
@go clean -i -n -x --modcache
@rm -rf bin go.sum release