-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
48 lines (38 loc) · 1.19 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
DIR = ./build
EXECUTABLE = p2a
GOARCH = amd64
GOOSWIN = windows
GOOSX = darwin
GOOSLINUX = linux
GOMOD = on
CGO_ENABLED = 0
WINBIN = $(DIR)/$(EXECUTABLE)-win-$(GOARCH).exe
OSXBIN = $(DIR)/$(EXECUTABLE)-darwin-$(GOARCH)
LINUXBIN = $(DIR)/$(EXECUTABLE)-linux-$(GOARCH)
CC = go build
CFLAGS =
LDFLAGS = all=-w -s
GCFLAGS = all=
ASMFLAGS = all=
.PHONY: all
all: darwin linux win64
.PHONY: darwin
darwin: $(OSXBIN)
chmod +x $(OSXBIN)
.PHONY: $(OSXBIN)
$(OSXBIN):
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSX) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(OSXBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)"
.PHONY: linux
linux: $(LINUXBIN)
chmod +x $(LINUXBIN)
.PHONY: $(LINUXBIN)
$(LINUXBIN):
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSLINUX) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(LINUXBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)"
.PHONY: win64
win64: $(WINBIN)
.PHONY: $(WINBIN)
$(WINBIN):
GO111MODULE=$(GOMOD) GOARCH=$(GOARCH) GOOS=$(GOOSWIN) CGO_ENABLED=$(CGO_ENABLED) $(CC) $(CFLAGS) -o $(WINBIN) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)"
.PHONY: clean
clean:
rm -rf $(DIR)/*