# Makefile for pack_resources tool

# Compiler
CXX := g++
CXXFLAGS := -std=c++20 -Wall -Wextra -O2

# Directories
TOOL_DIR := .
SOURCE_DIR := ../../source/core/resources

# Source files
SOURCES := pack_resources.cpp \
           $(SOURCE_DIR)/resource_pack.cpp

# Output
TARGET := pack_resources

# Platform-specific executable extension
ifeq ($(OS),Windows_NT)
    TARGET := $(TARGET).exe
endif

# Default target
all: $(TARGET)

# Build the tool
$(TARGET): $(SOURCES)
	@echo "Building pack_resources tool..."
	$(CXX) $(CXXFLAGS) $(SOURCES) -o $(TARGET)
	@echo "Build complete: $(TARGET)"

# Test: create a test pack
test: $(TARGET)
	@echo "Creating test pack..."
	./$(TARGET) ../../data test_resources.pack

# Create the actual resources.pack
pack: $(TARGET)
	@echo "Creating resources.pack..."
	./$(TARGET) ../../data ../../resources.pack

# List contents of a pack
list: $(TARGET)
	@echo "Listing pack contents..."
	./$(TARGET) --list ../../resources.pack

# Clean
clean:
	@echo "Cleaning..."
	rm -f $(TARGET) test_resources.pack
	@echo "Clean complete"

.PHONY: all test pack list clean
