# 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 := go_keys hash := $(shell git rev-parse HEAD) version := $(shell cat VERSION) timestamp := $(shell date -u '+%Y-%m-%d_%I:%M:%S%p') .PHONY: all test tag_latest compile_mac compile_linux build # 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) @echo "\tgit hash: $(hash)" @echo "\ttimestamp: $(timestamp)" @echo "\nTop-level commands:\n\tmake lint\n\tmake build\n\tmake test\n\tmake nagios" release: ## Release a new version and build, tag. git tag $(version) goreleaser --rm-dist testrelease: ## Test a release goreleaser --rm-dist --snapshot # Small function to run golint for the packages directories lint: golint golint cmd build: compile_mac #compile_windows compile_mac: CGO_ENABLED=1 GOARCH=amd64 GO111MODULE=on go build -a -installsuffix cgo -o bin/gokeys_mac cmd/main.go compile_linux: CGO_ENABLED=1 GOOS=linux GO111MODULE=on go build -a -installsuffix cgo -o bin/gokeys_nix cmd/main.go compile_windows: CGO_ENABLED=1 GOOS=windows GOARCH=amd64 GO111MODULE=on go build -a -installsuffix cgo -o bin/gokeys.exe cmd/main.go