-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
46 lines (43 loc) · 1.27 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME= icontool
BINARY_MACOS=$(BINARY_NAME)_macos
BINARY_UNIX=$(BINARY_NAME)_unix
BINARY_WIN=$(BINARY_NAME)_win.exe
all: test build
build:
$(GOBUILD) -o $(BINARY_NAME) -v
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
run:
$(GOBUILD) -o $(BINARY_NAME) -v ./...
./$(BINARY_NAME)
# Cross cleaning
clean-all: clean-windows clean-macos clean-linux
clean-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOCLEAN) -i
rm -f $(BINARY_NAME)
rm -f $(BINARY_WIN)
clean-macos:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOCLEAN) -i
rm -f $(BINARY_NAME)
rm -f $(BINARY_MACOS)
clean-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOCLEAN) -i
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
# Cross compilation
build-all: build-windows build-macos build-linux
build-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_WIN) -v
build-macos:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_MACOS) -v
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v