Makefile 979 Bytes
Newer Older
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
1
2
3
4
5
PROJECT_NAME := "feudalClient"
PKG := "git.scc.kit.edu/feudal/$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)

Lukas Burgey's avatar
Lukas Burgey committed
6
.PHONY: all dep build clean test  lint
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
7
8
9

all: build

Lukas Burgey's avatar
Lukas Burgey committed
10
11
12
13
dep: ## Get the dependencies
	@go get -v -d ./...

lint: dep ## Lint the files
Lukas Burgey's avatar
Lukas Burgey committed
14
	@go get -u golang.org/x/lint/golint
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
15
16
17
18
19
	@golint -set_exit_status ${PKG_LIST}

test: ## Run unittests
	@go test -short ${PKG_LIST}

Lukas Burgey's avatar
Lukas Burgey committed
20
# link dynamically
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
21
22
23
build: dep ## Build the binary file
	@go build -i -v $(PKG)

Lukas Burgey's avatar
Lukas Burgey committed
24
25
26
27
# link statically
build-static: dep ## Build the binary file
	@CGO_ENABLED=0 GOOS=linux go build -v -ldflags '-extldflags "-static"' $(PKG)

Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
28
29
30
31
32
clean: ## Remove previous build
	@rm -f $(PROJECT_NAME)

help: ## Display this help screen
	@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Lukas Burgey's avatar
Lukas Burgey committed
33

Lukas Burgey's avatar
Lukas Burgey committed
34
install: dep
Lukas Burgey's avatar
Lukas Burgey committed
35
	@go install ./...
Lukas Burgey's avatar
Lukas Burgey committed
36
37
38

tidy:
	@go mod tidy