-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (59 loc) · 1.43 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Makefile for Go
GO_CMD=go
GO_BUILD=$(GO_CMD) build
GO_TEST=$(GO_CMD) test -v
GO_CLEAN=$(GO_CMD) clean
GO_VET=$(GO_CMD) vet
GO_FMT=go fmt
GO_LINT=golint
GOOS ?= $(shell go env GOOS)
ifeq ($(GOOS),windows)
IS_EXE := .exe
endif
# Packages
PACKAGE_LIST := $(GOPATH)/src/goWebApp
NON_VENDOR := $(shell go list ./... | grep -v /vendor)
DIST_DIR := ./build
SOURCE_DIR := $(PACKAGE_LIST)/app/goWebApp
NAME:=build/goWebApp
BUILD_FILE:=$(GOPATH)/src/common
info:
@if [ -d "$(PACKAGE_LIST)" ]; then \
echo "Reading project info $$p ..."; \
n := $(BUILD_FILE)/readYaml.sh $(PACKAGE_LIST)/build.yml ; \
echo "stored value.."$(n); \
fi
.PHONY: all build compile test clean fmt vet lint
all: build
compile: clean fmt vet lint
build: vet
@if [ -d "$(PACKAGE_LIST)" ]; then \
echo "Build $$p ..."; \
$(GO_BUILD) -o $(NAME) $(SOURCE_DIR)/*.go || exit 1; \
fi
test:
@if [ -d "$(PACKAGE_LIST)" ]; then \
echo "Unit Testing $$p ..."; \
$(GO_TEST) $(NON_VENDOR) ; \
fi
clean:
@if [ -d "$(DIST_DIR)" ]; then \
echo "Cleaning $$p ..."; \
rm -rf $(DIST_DIR)$*; \
fi
fmt:
@if [ -d "$(PACKAGE_LIST)" ]; then \
echo "Formatting ..."; \
$(GO_FMT) $(NON_VENDOR); \
fi
vet:
@if [ -d "$(PACKAGE_LIST)" ]; then \
echo "Vet $$p ..."; \
$(GO_VET) $(NON_VENDOR); \
fi
lint:
@if [ -d "$(PACKAGE_LIST)" ]; then \
echo "Lint $$p ... "; \
go list ./... | grep -v /vendor | xargs -L1 golint; \
fi
# vim: set noexpandtab shiftwidth=8 softtabstop=0: