From 8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 18 Jul 2022 07:45:58 +0100 Subject: First public release --- Makefile | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..74532be --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +MAIN := cmd/micro/micro.go +NAME := micro +GO_SOURCES := $(shell find . -name '*.go') +VERSION_STRING := $(shell git describe --exact-match --tags --always HEAD 2>/dev/null || echo git-`git rev-parse --short=6 HEAD 2>/dev/null` || echo unknown) +GOBUILD_FLAGS := -ldflags "-X main.Version=$(VERSION_STRING)" -mod=mod +PACKAGES := $(shell go list ./...) + +.PHONY: clean run parse bindir + +build: bin/$(NAME) + +build-win: bin/$(NAME).exe + +run: build + bin/$(NAME) input.micro + +parse: build + bin/$(NAME) -parse input.micro + +vet: + go vet $(PACKAGES) + +bin/$(NAME): bindir $(GO_SOURCES) + GOBIN="$(CURDIR)/bin" go build -o bin/$(NAME) $(GOBUILD_FLAGS) $(MAIN) + +bin/$(NAME).exe: bindir $(GO_SOURCES) + GOOS=windows GOARCH=386 CGO_ENABLED=1 CXX=i686-w64-mingw32-g++ CC=i686-w64-mingw32-gcc GOBIN="$(CURDIR)/bin" go build $(GOBUILD_FLAGS) -o bin/$(NAME).exe $(MAIN) + +GO_TEST_FLAGS ?= "" +test: + go test ./... -v $(GO_TEST_FLAGS) + +bindir: + mkdir -p ./bin + +clean: + rm -f bin/$(NAME) bin/$(NAME).exe + -- cgit v1.2.3