github.com/kilpkonn/gtm-enhanced@v1.3.5/Makefile (about) 1 BINARY = bin/gtm 2 VERSION = 0.0.0-dev 3 COMMIT = $(shell git show -s --format='%h' HEAD) 4 LDFLAGS = -ldflags "-X main.Version=$(VERSION)-$(COMMIT)" 5 GIT2GO_VERSION = v27 6 GIT2GO_PATH = $(GOPATH)/src/github.com/libgit2/git2go 7 LIBGIT2_PATH = $(GIT2GO_PATH)/vendor/libgit2 8 PKGS = $(shell go list ./... | grep -v vendor) 9 BUILD_TAGS = static 10 11 build: 12 go build --tags '$(BUILD_TAGS)' $(LDFLAGS) -o $(BINARY) 13 14 debug: BUILD_TAGS += debug 15 debug: build 16 17 profile: BUILD_TAGS += profile 18 profile: build 19 20 debug-profile: BUILD_TAGS += debug profile 21 debug-profile: build 22 23 test: 24 @go test $(TEST_OPTIONS) --tags '$(BUILD_TAGS)' $(PKGS) | grep --colour -E "FAIL|$$" 25 26 test-verbose: TEST_OPTIONS += -v 27 test-verbose: test 28 29 lint: 30 -@$(call color_echo, 4, "\nGo Vet"); \ 31 go vet --all --tags '$(BUILD_TAGS)' $(PKGS) 32 -@$(call color_echo, 4, "\nError Check"); \ 33 errcheck -ignoretests -tags '$(BUILD_TAGS)' $(PKGS) 34 -@$(call color_echo, 4, "\nIneffectual Assign"); \ 35 ineffassign ./ 36 -@$(call color_echo, 4, "\nStatic Check"); \ 37 staticcheck --tests=false --tags '$(BUILD_TAGS)' $(PKGS) 38 -@$(call color_echo, 4, "\nGo Simple"); \ 39 gosimple --tests=false --tags '$(BUILD_TAGS)' $(PKGS) 40 -@$(call color_echo, 4, "\nUnused"); \ 41 unused --tests=false --tags '$(BUILD_TAGS)' $(PKGS) 42 -@$(call color_echo, 4, "\nGo Lint"); \ 43 golint $(PKGS) 44 -@$(call color_echo, 4, "\nGo Format"); \ 45 go fmt $(PKGS) 46 -@$(call color_echo, 4, "\nLicense Check"); \ 47 ag --go -L license . |grep -v vendor/ 48 49 install: 50 go install --tags '$(BUILD_TAGS)' $(LDFLAGS) 51 52 clean: 53 go clean 54 rm bin/* 55 56 git2go-install: 57 [[ -d $(GIT2GO_PATH) ]] || git clone https://github.com/libgit2/git2go.git $(GIT2GO_PATH) && \ 58 cd ${GIT2GO_PATH} && \ 59 git pull && \ 60 git checkout -qf $(GIT2GO_VERSION) && \ 61 git submodule update --init 62 63 git2go: git2go-install 64 cd $(LIBGIT2_PATH) && \ 65 mkdir -p install/lib && \ 66 mkdir -p build && \ 67 cd build && \ 68 cmake -DTHREADSAFE=ON \ 69 -DBUILD_CLAR=OFF \ 70 -DBUILD_SHARED_LIBS=OFF \ 71 -DCMAKE_C_FLAGS=-fPIC \ 72 -DUSE_SSH=OFF \ 73 -DCURL=OFF \ 74 -DUSE_HTTPS=OFF \ 75 -DUSE_BUNDLED_ZLIB=ON \ 76 -DCMAKE_BUILD_TYPE="RelWithDebInfo" \ 77 -DCMAKE_INSTALL_PREFIX=../install \ 78 .. && \ 79 cmake --build . 80 81 git2go-clean: 82 [[ -d $(GIT2GO_PATH) ]] && rm -rf $(GIT2GO_PATH) 83 84 define color_echo 85 @tput setaf $1 86 @echo $2 87 @tput sgr0 88 endef 89 90 .PHONY: build test vet fmt install clean git2go-install git2go-build all-tags profile debug