-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (33 loc) · 959 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
# Makefile
export GO111MODULE=on
GO_CMD=go
GO_GET=$(GO_CMD) get -v
GO_BUILD=$(GO_CMD) build
GO_BUILD_RACE=$(GO_CMD) build -race
GO_TEST=$(GO_CMD) test
GO_TEST_VERBOSE=$(GO_CMD) test -v
GO_TEST_COVER=$(GO_CMD) test -cover -count=1 -p=1
GO_INSTALL=$(GO_CMD) install -v
SERVER_BIN=weather_monster
SERVER_BIN_DIR=.
SERVER_DIR=.
SERVER_MAIN=main.go
SOURCE_PKG_DIR= .
SOURCEDIR=.
SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
all: dependencies tests build-server
dependencies:
@echo "==> Installing dependencies ...";
@$(GO_GET) ./...
tests:
@echo "==> Running tests ...";
@$(GO_TEST_COVER) $(SOURCE_PKG_DIR)/api/...
@$(GO_TEST_COVER) $(SOURCE_PKG_DIR)/config
@$(GO_TEST_COVER) $(SOURCE_PKG_DIR)/pkg/errors
@$(GO_TEST_COVER) $(SOURCE_PKG_DIR)/schema
build-server:
@echo "==> Building server ...";
@GOOS=linux $(GO_BUILD) -o $(SERVER_BIN) -ldflags "-w -s" $(SERVER_DIR)/$(SERVER_MAIN) || exit 1;
@chmod 755 $(SERVER_BIN)
run:
./$(SERVER_BIN)