Skip to content

Commit e1aa520

Browse files
authored
Merge pull request #3 from Nigh/makefile_update
add independent Makefile for windows
2 parents 1d6cce5 + 7badd9f commit e1aa520

2 files changed

Lines changed: 55 additions & 6 deletions

File tree

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ all: darwin linux win64
2323

2424
.PHONY: darwin
2525
darwin: $(OSXBIN)
26-
# chmod +x $(OSXBIN)
26+
chmod +x $(OSXBIN)
2727

2828
.PHONY: $(OSXBIN)
2929
$(OSXBIN):
30-
set GOARCH=$(GOARCH)&set GOOS=$(GOOSX)&$(CC) -o $(OSXBIN) -ldflags="$(LDFLAGS)"
30+
GOARCH=$(GOARCH) GOOS=$(GOOSX) $(CC) -o $(OSXBIN) -ldflags="$(LDFLAGS)"
3131

3232
.PHONY: linux
3333
linux: $(LINUXBIN)
34-
# chmod +x $(LINUXBIN)
34+
chmod +x $(LINUXBIN)
3535

3636
.PHONY: $(LINUXBIN)
3737
$(LINUXBIN):
38-
set GOARCH=$(GOARCH)&set GOOS=$(GOOSLINUX)&$(CC) -o $(LINUXBIN) -ldflags="$(LDFLAGS)"
38+
GOARCH=$(GOARCH) GOOS=$(GOOSLINUX) $(CC) -o $(LINUXBIN) -ldflags="$(LDFLAGS)"
3939

4040
.PHONY: win64
4141
win64: $(WINBIN)
4242

4343
.PHONY: $(WINBIN)
4444
$(WINBIN):
45-
set GOARCH=$(GOARCH)&set GOOS=$(GOOSWIN)&$(CC) -o $(WINBIN) -ldflags="$(LDFLAGS)"
45+
GOARCH=$(GOARCH) GOOS=$(GOOSWIN) $(CC) -o $(WINBIN) -ldflags="$(LDFLAGS)"
4646

4747
.PHONY: clean
4848
clean:
49-
del /f /q .\$(DIR)\*
49+
rm ./$(DIR) -rf

Makefile_windows

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
VERSION?=v0.0.0-test
3+
4+
DIR = dist
5+
EXECUTABLE = ass-shifter
6+
GOARCH = amd64
7+
GOOSWIN = windows
8+
GOOSX = darwin
9+
GOOSLINUX = linux
10+
11+
WINBIN = $(DIR)/$(EXECUTABLE)-win-$(GOARCH).exe
12+
OSXBIN = $(DIR)/$(EXECUTABLE)-darwin-$(GOARCH)
13+
LINUXBIN = $(DIR)/$(EXECUTABLE)-linux-$(GOARCH)
14+
15+
CC = go build
16+
LDFLAGS = all=-w -s -X main.version=$(VERSION)
17+
18+
.PHONY: default all
19+
20+
default: all
21+
22+
all: darwin linux win64
23+
24+
.PHONY: darwin
25+
darwin: $(OSXBIN)
26+
# chmod +x $(OSXBIN)
27+
28+
.PHONY: $(OSXBIN)
29+
$(OSXBIN):
30+
set GOARCH=$(GOARCH)&set GOOS=$(GOOSX)&$(CC) -o $(OSXBIN) -ldflags="$(LDFLAGS)"
31+
32+
.PHONY: linux
33+
linux: $(LINUXBIN)
34+
# chmod +x $(LINUXBIN)
35+
36+
.PHONY: $(LINUXBIN)
37+
$(LINUXBIN):
38+
set GOARCH=$(GOARCH)&set GOOS=$(GOOSLINUX)&$(CC) -o $(LINUXBIN) -ldflags="$(LDFLAGS)"
39+
40+
.PHONY: win64
41+
win64: $(WINBIN)
42+
43+
.PHONY: $(WINBIN)
44+
$(WINBIN):
45+
set GOARCH=$(GOARCH)&set GOOS=$(GOOSWIN)&$(CC) -o $(WINBIN) -ldflags="$(LDFLAGS)"
46+
47+
.PHONY: clean
48+
clean:
49+
del /f /q .\$(DIR)\*

0 commit comments

Comments
 (0)