-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (35 loc) · 830 Bytes
/
Makefile
File metadata and controls
44 lines (35 loc) · 830 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
38
39
40
41
42
43
44
# Project specific variables
PROJECT=api
OS=$(shell uname)
GOARCH = amd64
# GO env
GOPATH=$(shell pwd)
GO=go
GOCMD=GOPATH=$(GOPATH) $(GO)
GOBUILD = $(GOCMD) build
# Build the project
.PHONY: all
all: build
.PHONY: build
build: format test compile
.PHONY: compile
compile: darwin linux windows
.PHONY: format
format:
@for gofile in $$(find ./src -name "*.go"); do \
echo "formatting" $$gofile; \
gofmt -w $$gofile; \
done
.PHONY: test
test:
$(GOCMD) test -v -race ./src/...
.PHONY: run
run:
$(GOCMD) run ./src/main.go
multi: build darwin linux windows
darwin:
GOOS=darwin GOARCH=${GOARCH} $(GOBUILD) -o bin/$(PROJECT)_darwin src/main.go
linux:
GOOS=linux GOARCH=${GOARCH} $(GOBUILD) -o bin/$(PROJECT)_linux src/main.go
windows:
GOOS=windows GOARCH=${GOARCH} $(GOBUILD) -o bin/$(PROJECT)_windows.exe src/main.go