# 2018 Rackspace, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"): you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # Variables to be used throughout the makefile. Most of these will be passed in as # ldflags when building/compiling the application. app_name := iplookup version := $(shell cat VERSION) hash := $(shell git rev-parse HEAD) timestamp := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p') .PHONY: all lint gorelease # Default call to GNU make. Basically displays that the variables needed to run the # subsequent make functions are being pulled correctly all: @echo $(app_name): v$(version) @echo "\nTop-level commands:\n\tmake lint\n\tmake release\n\tmake test" release: lint gorelease gorelease: git tag $(version) goreleaser --rm-dist # Small function to run golint for the packages directories lint: ## Run golint on all sub-packages golint test: ## Run unit testing go test -v help: # Ref: https://github.rackspace.com/engineering/handbook/blob/master/Makefile @echo "" @echo "IP LOOKUP (TSIP)" @echo "" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'