APP_NAME = DDNSUpdater
BIN_DIR  = bin
VERSION  = 0.1.0
OUT      = $(BIN_DIR)\$(APP_NAME).exe
FLAGS    = -trimpath -ldflags="-s -w -X main.version=$(VERSION)"

all: build run

build:
	@if not exist $(BIN_DIR) mkdir $(BIN_DIR)
	cmd /c "set CGO_ENABLED=0 && go build $(FLAGS) -o $(OUT) ."

run:
	go run .

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

tidy:
	go mod tidy

fmt:
	go fmt ./...
