APP_NAME = DDNSUpdater
BIN_DIR = bin
VERSION = 0.1.0

all: build run

build:
	@if not exist $(BIN_DIR) mkdir $(BIN_DIR)
	go build -ldflags "-s -w -X main.version=$(VERSION)" -o $(BIN_DIR)\$(APP_NAME).exe .

run:
	go run .

clean:
	@if exist $(BIN_DIR) rmdir /s /q $(BIN_DIR)

windows:
	@if not exist $(BIN_DIR) mkdir $(BIN_DIR)
	set GOOS=windows&& set GOARCH=amd64&& go build -o $(BIN_DIR)\$(APP_NAME).exe .

tidy:
	go mod tidy

fmt:
	go fmt ./...
