-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
37 lines (30 loc) · 798 Bytes
/
makefile
File metadata and controls
37 lines (30 loc) · 798 Bytes
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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=TETRIS
# Determine the OS and architecture
ifeq ($(OS),Windows_NT)
OSFLAG := windows
EXTENSION := .exe
else
OSFLAG := $(shell uname | tr '[:upper:]' '[:lower:]')
EXTENSION :=
endif
build: $(BINARY_NAME)
$(BINARY_NAME):
$(GOBUILD) -o $(BINARY_NAME)$(EXTENSION) -v
# Build for Linux
linux:
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_$(OSFLAG)_amd64$(EXTENSION) -v
# Build for Mac
darwin:
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_$(OSFLAG)_amd64$(EXTENSION) -v
# Build for Windows
windows:
GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_windows_amd64$(EXTENSION) -v
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)*$(EXTENSION)