-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
36 lines (29 loc) · 868 Bytes
/
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
# Vars and params
GOCMD=go
BINARY_NAME=udig
PACKAGE=github.com/netrixone/udig/cmd/udig
GEODB_NAME=IP2LOCATION-LITE-DB1.IPV6.BIN
INSTALL_DIR=$(shell dirname "`which $(BINARY_NAME)`")
all: build test
clean:
$(GOCMD) clean -i $(PACKAGE)
rm -f $(BINARY_NAME)
rm -f $(BINARY_NAME)_min
rm -f $(GEODB_NAME)
build: deps
$(GOCMD) build -v -o $(BINARY_NAME) $(PACKAGE)
install: deps test
$(GOCMD) install $(PACKAGE)
ifneq (,$(wildcard $(GEODB_NAME)))
cp $(GEODB_NAME) "$(INSTALL_DIR)"
endif
release: deps test
$(GOCMD) build -ldflags="-s -w" -v -o $(BINARY_NAME)_min $(PACKAGE)
upx --brute $(BINARY_NAME)_min
deps:
$(GOCMD) get -v -t ./...
ifeq (,$(wildcard $(GEODB_NAME)))
wget -q -O tmp.zip "https://download.ip2location.com/lite/$(GEODB_NAME).ZIP" && unzip -p tmp.zip $(GEODB_NAME) > $(GEODB_NAME) && rm tmp.zip
endif
test: build
$(GOCMD) test