mirror of
https://github.com/onyx-and-iris/vbantxt.git
synced 2026-04-07 01:33:30 +00:00
add makefile
This commit is contained in:
40
makefile
Normal file
40
makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
program = vbantxt
|
||||
|
||||
GO = go
|
||||
BIN_DIR := bin
|
||||
|
||||
WINDOWS=$(BIN_DIR)/$(program)_windows_amd64.exe
|
||||
LINUX=$(BIN_DIR)/$(program)_linux_amd64
|
||||
VERSION=$(shell git describe --tags --always --long --dirty)
|
||||
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
.PHONY: fmt vet build windows linux test clean
|
||||
fmt:
|
||||
$(GO) fmt ./...
|
||||
|
||||
vet: fmt
|
||||
$(GO) vet ./...
|
||||
|
||||
build: vet windows linux | $(BIN_DIR)
|
||||
@echo version: $(VERSION)
|
||||
|
||||
windows: $(WINDOWS)
|
||||
|
||||
linux: $(LINUX)
|
||||
|
||||
|
||||
$(WINDOWS):
|
||||
env GOOS=windows GOARCH=amd64 go build -v -o $(WINDOWS) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/vbantxt/
|
||||
|
||||
$(LINUX):
|
||||
env GOOS=linux GOARCH=amd64 go build -v -o $(LINUX) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/vbantxt/
|
||||
|
||||
test:
|
||||
$(GO) test ./...
|
||||
|
||||
$(BIN_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
clean:
|
||||
@rm -rv $(BIN_DIR)
|
||||
Reference in New Issue
Block a user