diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-07-18 07:45:58 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-07-18 07:45:58 +0100 |
commit | 8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642 (patch) | |
tree | c53977d1284347bb1d5963ddb4dc7723c40c6e55 /Makefile | |
download | micro-lang-8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642.tar.gz micro-lang-8bb321f8b032dfaeffbe3d1b8dfeb215c12d3642.zip |
First public release
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 38 |
1 files changed, 38 insertions, 0 deletions
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 + |