From bd87baa40a01fb2e5f967ba889fe3a230e597a7d Mon Sep 17 00:00:00 2001 From: Joren Date: Sun, 15 Sep 2024 00:34:25 +0200 Subject: [PATCH] Makefile --- Makefile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ccf615a --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +GOCMD=go +GOBUILD=$(GOCMD) build +GOCLEAN=$(GOCMD) clean +GOTEST=$(GOCMD) test +GOGET=$(GOCMD) get +BINARY_NAME=drmdtool + +all: test build + +build: + $(GOBUILD) -o $(BINARY_NAME) -v + +test: + $(GOTEST) -v ./... + +clean: + $(GOCLEAN) + rm -f $(BINARY_NAME) + +run: + $(GOBUILD) -o $(BINARY_NAME) -v + ./$(BINARY_NAME) + +deps: + $(GOGET) github.com/BurntSushi/toml + $(GOGET) github.com/beevik/etree + $(GOGET) github.com/asticode/go-astisub + +# Cross compilation +build-linux: + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_linux -v + +build-windows: + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME).exe -v + +build-mac: + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_mac -v + +.PHONY: all build test clean run deps build-linux build-windows build-mac