-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
48 lines (41 loc) · 837 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
37
38
39
40
41
42
43
44
45
46
47
48
ver?=dev
bindir?=./bin
GOARCH?=amd64
GOCMD=./cmd/openmsr/main.go
GOBUILD=go build -ldflags "-w -s"
OUT=$(bindir)/openmsr-$(ver)-$(GOARCH)
clean:
-rm -rf $(bindir)
run:
go run $(GOCMD)
dev:
go build -o $(OUT)-dev $(GOCMD)
linux:
CGO_ENABLED=1 GOOS=linux
CC=gcc CXX=g++
ifeq ($(GOARCH), 386)
GOGCCFLAGS="-m32"
endif
$(GOBUILD) -o $(OUT) $(GOCMD)
windows:
CGO_ENABLED=1 GOOS=windows
ifeq ($(GOARCH), 386)
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
else
CC=x86_64-w64-mingw32-gcc
CXX=x86_64-w64-mingw32-g++
endif
$(GOBUILD) -o $(OUT).exe $(GOCMD)
macos:
CGO_ENABLED=1 GOOS=darwin
ifeq ($(arch), 386)
CC=o32-gcc CXX=o32-g++
else
CC=o64-gcc CXX=064-g++
endif
$(GOBUILD) -o $(OUT)-macos $(GOCMD)
all:
make linux windows macos GOARCH=amd64
# 386 doesn't work for anything yet
-make linux windows macos GOARCH=386