forked from hellofresh/klepto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (30 loc) · 1.1 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
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
# Space separated patterns of packages to skip in list, test, format.
IGNORED_PACKAGES := /vendor/
.PHONY: all clean deps build
all: clean deps build
deps:
@echo "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)"
@go get github.com/goreleaser/goreleaser
@go get -u github.com/golang/dep/cmd/dep
@dep ensure
# Builds the project
build:
@echo "$(OK_COLOR)==> Building... $(NO_COLOR)"
@goreleaser --snapshot --rm-dist --skip-validate
test:
@/bin/sh -c "./build/test.sh $(allpackages)"
# Cleans our project: deletes binaries
clean:
@echo "$(OK_COLOR)==> Cleaning project$(NO_COLOR)"
@go clean
@rm -rf dist
# cd into the GOPATH to workaround ./... not following symlinks
_allpackages = $(shell ( go list ./... 2>&1 1>&3 | \
grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)) 1>&2 ) 3>&1 | \
grep -v -e "^$$" $(addprefix -e ,$(IGNORED_PACKAGES)))
# memoize allpackages, so that it's executed only once and only if used
allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)