-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
34 lines (25 loc) · 787 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
.PHONY: fmt compile run
PROJECTNAME=$(shell basename "$(PWD)")
# Go related variables.
GOBASE=$(shell pwd)
GOBIN=$(GOBASE)/bin
GOFILES=$(wildcard *.go)
# Redirect error output to a file, so we can show it in development mode.
STDERR=/tmp/.$(PROJECTNAME)-stderr.txt
# PID file will store the server process id when it's running on development mode
PID=/tmp/.$(PROJECTNAME).pid
# Make is verbose in Linux. Make it silent.
MAKEFLAGS += --silent
fmt:
gofmt -w .
compile:
@for GOOS in linux windows;do\
for GOARCH in amd64; do\
GOOS=$${GOOS} GOARCH=$${GOARCH} go build -v -o bin/$(PROJECTNAME).$${GOOS}-$${GOARCH} ; \
done ;\
done
cp bin/microserver.windows-amd64 bin/microserver
-rm bin/microserver.windows-amd64
-rm bin/microserver.linux-amd64
run:
go run main.go