# Makefile for redmine-tree

.PHONY: all build install clean

BINARY_NAME := redmine-tree
BUILD_DIR := build
INSTALL_DIR := $(HOME)/.local/bin

all: build

build:
	@echo "Building $(BINARY_NAME)..."
	@go build -o $(BUILD_DIR)/$(BINARY_NAME) .

install: build
ifeq ($(OS),Windows_NT)
	@echo "Detected Windows. Executable built to $(BUILD_DIR)/$(BINARY_NAME).exe"
	@echo "Please add $(abspath $(BUILD_DIR)) to your PATH manually if you wish to run it from anywhere."
else
	@echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)..."
	@mkdir -p $(INSTALL_DIR)
	@cp $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_DIR)/
	@echo "Installation complete. Make sure $(INSTALL_DIR) is in your PATH."
endif

clean:
	@echo "Cleaning build directory..."
	@rm -rf $(BUILD_DIR)
