-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (38 loc) · 915 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
# Makefile
# Frain
PLATFORMS := darwin linux windows
VERSION := $(shell cat VERSION)
os = $(word 1, $@)
# Go
BINARY := frain
BUILDFLAGS := -ldflags "-X main.buildVersion=$(VERSION)"
GOBUILDDIR := cmd/frain/
GOINSTALL := $(GOCMD) install $(BUILDFLAGS)
GOFILES := $(GOBUILDDIR)*.go
GOCMD := go
GOBIN := $(GOPATH)/bin
GOBUILD := $(GOCMD) build $(BUILDFLAGS)
GOCLEAN := $(GOCMD) clean
GOGET := $(GOCMD) get
GOINSTALL := $(GOCMD) install $(BUILDFLAGS)
GORUN := $(GOCMD) run $(BUILDFLAGS)
GOTEST := $(GOCMD) test
all: test build
build:
$(GOBUILD) -v -o $(BINARY) $(GOFILES)
clean:
$(GOCLEAN)
rm -f $(BINARY)
rm -rf release
install:
cd $(GOBUILDDIR) && $(GOINSTALL)
run:
$(GORUN) -v $(GOFILES) -h
test:
$(GOTEST) -v
.PHONY: $(PLATFORMS)
$(PLATFORMS):
mkdir -p release
GOOS=$(os) GOARCH=amd64 $(GOBUILD) -o release/$(BINARY)-v$(VERSION)-$(os)-amd64 $(GOFILES)
.PHONY: release
release: darwin linux windows