-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
201 lines (176 loc) · 7.1 KB
/
Makefile
File metadata and controls
201 lines (176 loc) · 7.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# =============================================================================
# RPG - Professional Makefile
# =============================================================================
# Usage:
# make → Atlases + Build + Test + Run (full pipeline)
# make quick → Run immediately (skip atlases/build/test)
# make build → Build only
# make test → Run tests only
# make run → Run Desktop
# make release → Release build + run
# make clean → Clean artifacts
# make watch → Watch mode
# make atlases → Generate autotiling atlases
# make help → Show help
# =============================================================================
.PHONY: all build test run quick full release clean watch info help atlases clean-atlases rebuild-atlases
.DEFAULT_GOAL := all
# Configuration
SOLUTION := RPG.sln
DESKTOP_PROJECT := RPG.Desktop/RPG.Desktop.csproj
SHARED_PROJECT := RPG.Shared/RPG.Shared.csproj
TESTS_PROJECT := RPG.Tests/RPG.Tests.csproj
BUILD_CONFIG ?= Debug
# Autotiling configuration
ATLAS_GENERATOR := Tools/AtlasGenerator/bin/AtlasGenerator
ATLAS_GENERATOR_PROJECT := Tools/AtlasGenerator/AtlasGenerator.csproj
ATLAS_DIR := RPG.Shared/Assets/Textures/Autotiling
BASE_ATLAS := $(ATLAS_DIR)/base_terrain.png
WANG_ATLAS := $(ATLAS_DIR)/wang_overlay.png
# Colors (ANSI escape codes)
BLUE := \033[0;34m
GREEN := \033[0;32m
YELLOW := \033[1;33m
RED := \033[0;31m
MAGENTA := \033[0;35m
CYAN := \033[0;36m
NC := \033[0m # No Color
# =============================================================================
# Main Targets
# =============================================================================
## Default: Full pipeline (atlases + build + test + run)
all: full
## Full pipeline: atlases + build + test + run
full: atlases build test run
## Quick launch: run immediately (skip atlases/build/test)
quick:
@echo "$(MAGENTA)⚡ Quick Launch$(NC)"
@dotnet run --project $(DESKTOP_PROJECT) --configuration $(BUILD_CONFIG) --no-build
## Build solution
build:
@echo "$(MAGENTA)🔨 Building Solution ($(BUILD_CONFIG))$(NC)"
@dotnet restore $(SOLUTION) --nologo
@dotnet build $(SOLUTION) --configuration $(BUILD_CONFIG) --no-restore --nologo -v:minimal
@echo "$(GREEN)✓ Build complete$(NC)"
## Run tests
test:
@echo "$(MAGENTA)🧪 Running Tests$(NC)"
@if [ -f "$(TESTS_PROJECT)" ]; then \
dotnet test $(TESTS_PROJECT) --configuration $(BUILD_CONFIG) --no-build --nologo -v:minimal --logger "console;verbosity=normal"; \
if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ All tests passed$(NC)"; \
else \
echo "$(RED)✗ Some tests failed$(NC)"; \
exit 1; \
fi \
else \
echo "$(YELLOW)⚠ No tests project found, skipping$(NC)"; \
fi
## Run Desktop
run:
@echo "$(MAGENTA)🎮 Launching RPG Desktop$(NC)"
@dotnet run --project $(DESKTOP_PROJECT) --configuration $(BUILD_CONFIG) --no-build
## Release build + run
release:
@$(MAKE) BUILD_CONFIG=Release clean atlases build test run
## Watch mode (auto-reload on file changes)
watch:
@echo "$(MAGENTA)👀 Watch Mode$(NC)"
@dotnet watch --project $(DESKTOP_PROJECT) run
## Clean build artifacts
clean:
@echo "$(MAGENTA)🧹 Cleaning Build Artifacts$(NC)"
@dotnet clean $(SOLUTION) --nologo || true
@find . -type d \( -name "bin" -o -name "obj" \) -not -path "*/node_modules/*" -exec rm -rf {} + 2>/dev/null || true
@echo "$(GREEN)✓ Clean complete$(NC)"
## Show project information
info:
@echo "$(CYAN)RPG - Project Information$(NC)"
@echo ""
@echo "$(CYAN)Solution:$(NC) $(SOLUTION)"
@echo "$(CYAN)Desktop:$(NC) $(DESKTOP_PROJECT)"
@echo "$(CYAN)Shared:$(NC) $(SHARED_PROJECT)"
@echo "$(CYAN)Tests:$(NC) $(TESTS_PROJECT)"
@echo ""
@echo "$(CYAN)Atlases:$(NC)"
@echo " Base: $(BASE_ATLAS)"
@echo " Wang Overlay: $(WANG_ATLAS)"
@echo ""
@echo "$(CYAN).NET SDK:$(NC)"
@dotnet --version
@echo ""
@echo "$(CYAN)Build Config:$(NC) $(BUILD_CONFIG)"
# =============================================================================
# Autotiling Targets
# =============================================================================
## Generate all autotiling atlases
atlases: $(BASE_ATLAS) $(WANG_ATLAS)
@echo "$(GREEN)✓ All atlases ready$(NC)"
## Generate base terrain atlas (256×256, 8 terrains)
$(BASE_ATLAS): $(ATLAS_GENERATOR)
@mkdir -p $(ATLAS_DIR)
@echo "$(MAGENTA)🎨 Generating base terrain atlas$(NC)"
@$(ATLAS_GENERATOR) --type base --output $@ --size 256 --tile-size 32
@echo "$(GREEN)✓ Base atlas: $@$(NC)"
## Generate Wang overlay atlas (512×512, 64 tiles)
$(WANG_ATLAS): $(ATLAS_GENERATOR)
@mkdir -p $(ATLAS_DIR)
@echo "$(MAGENTA)🎨 Generating Wang overlay atlas$(NC)"
@$(ATLAS_GENERATOR) --type wang --output $@ --size 512 --tile-size 32 --count 64
@echo "$(GREEN)✓ Wang atlas: $@$(NC)"
## Build atlas generator tool (AOT binary)
$(ATLAS_GENERATOR): $(ATLAS_GENERATOR_PROJECT)
@echo "$(MAGENTA)🔧 Building atlas generator$(NC)"
@dotnet publish $(ATLAS_GENERATOR_PROJECT) \
-c Release \
-r linux-x64 \
--self-contained \
-p:PublishAot=true \
-o Tools/AtlasGenerator/bin \
--nologo -v:quiet
@echo "$(GREEN)✓ Atlas generator built$(NC)"
## Force regenerate atlases
rebuild-atlases: clean-atlases atlases
## Clean generated atlases only
clean-atlases:
@echo "$(MAGENTA)🧹 Cleaning atlases$(NC)"
@rm -f $(BASE_ATLAS) $(WANG_ATLAS)
@echo "$(GREEN)✓ Atlases cleaned$(NC)"
## Deep clean (atlases + generator + build artifacts)
distclean: clean clean-atlases
@echo "$(MAGENTA)🧹 Deep cleaning$(NC)"
@rm -rf Tools/AtlasGenerator/bin Tools/AtlasGenerator/obj
@echo "$(GREEN)✓ Deep clean complete$(NC)"
# =============================================================================
# Help
# =============================================================================
## Show help
help:
@echo "$(CYAN)RPG - Professional Makefile$(NC)"
@echo ""
@echo "$(YELLOW)USAGE:$(NC)"
@echo " make [TARGET] [BUILD_CONFIG=Debug|Release]"
@echo ""
@echo "$(YELLOW)MAIN TARGETS:$(NC)"
@grep -E '^## ' $(MAKEFILE_LIST) | grep -v "AUTOTILING" | sed 's/## / $(GREEN)/' | column -t -s ':' | sed 's/$$/$(NC)/'
@echo ""
@echo "$(YELLOW)AUTOTILING TARGETS:$(NC)"
@echo " $(GREEN)make atlases$(NC) Generate all autotiling atlases"
@echo " $(GREEN)make rebuild-atlases$(NC) Force regenerate atlases"
@echo " $(GREEN)make clean-atlases$(NC) Clean generated atlases only"
@echo " $(GREEN)make distclean$(NC) Deep clean (everything)"
@echo ""
@echo "$(YELLOW)ENVIRONMENT VARIABLES:$(NC)"
@echo " $(CYAN)BUILD_CONFIG$(NC) Build configuration (Debug|Release)"
@echo " Default: Debug"
@echo ""
@echo "$(YELLOW)EXAMPLES:$(NC)"
@echo " make # Atlases + Build + Test + Run"
@echo " make atlases # Generate atlases only"
@echo " make quick # Quick launch (skip everything)"
@echo " make build # Build only"
@echo " make BUILD_CONFIG=Release # Release build"
@echo " make release # Release pipeline"
@echo " make watch # Auto-reload mode"
@echo " make rebuild-atlases # Force regenerate atlases"
@echo ""