2024-09-15 00:34:25 +02:00
|
|
|
GOCMD=go
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
|
|
|
GOTEST=$(GOCMD) test
|
|
|
|
GOGET=$(GOCMD) get
|
|
|
|
BINARY_NAME=drmdtool
|
2024-09-15 05:00:02 +02:00
|
|
|
SRC_DIR=src
|
2024-09-15 00:34:25 +02:00
|
|
|
|
|
|
|
all: test build
|
|
|
|
|
|
|
|
build:
|
2024-09-15 05:00:02 +02:00
|
|
|
cd $(SRC_DIR) && $(GOBUILD) -o ../$(BINARY_NAME) -v
|
2024-09-15 00:34:25 +02:00
|
|
|
|
|
|
|
test:
|
2024-09-15 05:00:02 +02:00
|
|
|
cd $(SRC_DIR) && $(GOTEST) -v ./...
|
2024-09-15 00:34:25 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GOCLEAN)
|
|
|
|
rm -f $(BINARY_NAME)
|
|
|
|
|
|
|
|
run:
|
2024-09-15 05:00:02 +02:00
|
|
|
cd $(SRC_DIR) && $(GOBUILD) -o ../$(BINARY_NAME) -v
|
2024-09-15 00:34:25 +02:00
|
|
|
./$(BINARY_NAME)
|
|
|
|
|
|
|
|
deps:
|
|
|
|
$(GOGET) github.com/BurntSushi/toml
|
|
|
|
$(GOGET) github.com/beevik/etree
|
|
|
|
$(GOGET) github.com/asticode/go-astisub
|
|
|
|
|
|
|
|
# Cross compilation
|
|
|
|
build-linux:
|
2024-09-15 05:00:02 +02:00
|
|
|
cd $(SRC_DIR) && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o ../$(BINARY_NAME)_linux -v
|
2024-09-15 00:34:25 +02:00
|
|
|
|
|
|
|
build-windows:
|
2024-09-15 05:00:02 +02:00
|
|
|
cd $(SRC_DIR) && CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o ../$(BINARY_NAME).exe -v
|
2024-09-15 00:34:25 +02:00
|
|
|
|
|
|
|
build-mac:
|
2024-09-15 05:00:02 +02:00
|
|
|
cd $(SRC_DIR) && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o ../$(BINARY_NAME)_mac -v
|
2024-09-15 00:34:25 +02:00
|
|
|
|
|
|
|
.PHONY: all build test clean run deps build-linux build-windows build-mac
|