fix(makefile): alinear targets amb ../aee i ../projecte_2026

Abans:
  make / make build -> Debug
  make release      -> Release (sense empaquetar)

Ara, mateixa convenció que els dos projectes germans:
  make              -> Release (binari d'ús normal)
  make debug        -> Debug (flux amb debug.yaml)
  make release      -> Release + empaquetat distribució (empaquetat TODO)

Afegit make run / make run-debug per conveniència i make help.
docs/convencions.md actualitzat amb la nova taula target -> comportament.
This commit is contained in:
JailDesigner committed 2026-04-22 11:48:14 +02:00
1 parent 6800786194
commit 03f1c5f926
2 files changed
+77 -22

No files matched your search

+69 -18
View File
@@ -14,47 +14,66 @@ endif
CMAKE_DEFS := -DGIT_HASH=$(GIT_HASH) CMAKE_DEFS := -DGIT_HASH=$(GIT_HASH)
.PHONY: all configure build run clean rebuild release show-version format format-check tidy tidy-fix cppcheck hooks-install .PHONY: all debug release run run-debug clean rebuild show-version format format-check tidy tidy-fix cppcheck hooks-install help
all: build # ==============================================================================
# COMPILACIÓ
# ==============================================================================
# Convenció alineada amb ../aee i ../projecte_2026:
# make → Release (binari d'ús normal)
# make debug → Debug (flux complet + `debug.yaml` per triar escena inicial)
# make release → Release + empaquetat per a distribució (TODO, pendent)
# ==============================================================================
configure: all:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Debug $(CMAKE_DEFS)
build: configure
@cmake --build $(BUILDDIR) -j$(JOBS)
run: build
@./$(BUILDDIR)/$(PROJECT)
release:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS) @cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) -j$(JOBS) @cmake --build $(BUILDDIR) -j$(JOBS)
debug:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Debug $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) -j$(JOBS)
run: all
@./$(BUILDDIR)/$(PROJECT)
run-debug: debug
@./$(BUILDDIR)/$(PROJECT)
# Release + empaquetat per distribució (zip/dmg/tar.gz). De moment només
# compila amb CMAKE_BUILD_TYPE=Release; l'empaquetat OS-specific està
# pendent (veure Makefile de ../aee com a referència).
release: all
@echo "TODO: empaquetat per a distribució (zip/dmg/tar.gz) — pendent"
show-version: show-version:
@echo "$(PROJECT) $(VERSION) ($(GIT_HASH))" @echo "$(PROJECT) $(VERSION) ($(GIT_HASH))"
clean: clean:
@rm -rf $(BUILDDIR) @rm -rf $(BUILDDIR)
rebuild: clean build rebuild: clean all
# ============================================================================== # ==============================================================================
# CODE QUALITY (delegados a cmake) # CODE QUALITY (delegados a cmake)
# ============================================================================== # ==============================================================================
format: configure format:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) --target format @cmake --build $(BUILDDIR) --target format
format-check: configure format-check:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) --target format-check @cmake --build $(BUILDDIR) --target format-check
tidy: configure tidy:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) --target tidy @cmake --build $(BUILDDIR) --target tidy
tidy-fix: configure tidy-fix:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) --target tidy-fix @cmake --build $(BUILDDIR) --target tidy-fix
cppcheck: configure cppcheck:
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS)
@cmake --build $(BUILDDIR) --target cppcheck @cmake --build $(BUILDDIR) --target cppcheck
# ============================================================================== # ==============================================================================
@@ -63,3 +82,35 @@ cppcheck: configure
hooks-install: hooks-install:
@git config core.hooksPath .githooks @git config core.hooksPath .githooks
@echo "Git hooks activats: $(shell pwd)/.githooks" @echo "Git hooks activats: $(shell pwd)/.githooks"
# ==============================================================================
# AJUDA
# ==============================================================================
help:
@echo "Makefile per a $(PROJECT)"
@echo ""
@echo " Compilació:"
@echo " make - Compilar amb cmake (Release)"
@echo " make debug - Compilar amb cmake (Debug)"
@echo ""
@echo " Execució:"
@echo " make run - Compilar (Release) i executar"
@echo " make run-debug - Compilar (Debug) i executar"
@echo ""
@echo " Release:"
@echo " make release - Release + empaquetat (TODO pendent)"
@echo ""
@echo " Qualitat de codi:"
@echo " make format - Formatar codi amb clang-format"
@echo " make format-check - Verificar format sense modificar"
@echo " make tidy - Anàlisi estàtic amb clang-tidy"
@echo " make tidy-fix - Anàlisi estàtic amb auto-fix"
@echo " make cppcheck - Anàlisi estàtic amb cppcheck"
@echo ""
@echo " Altres:"
@echo " make clean - Esborrar carpeta $(BUILDDIR)/"
@echo " make rebuild - clean + all"
@echo " make show-version - Mostrar versió"
@echo " make hooks-install - Activar git hooks del projecte"
@echo ""
@echo " Versió actual: $(VERSION) ($(GIT_HASH))"
+8 -4
View File
@@ -27,13 +27,17 @@ de sistema que `config.yaml`:
### Comportament segons build ### Comportament segons build
- **Release** (`make release`): `debug.yaml` s'ignora completament. El joc Convenció alineada amb `../aee` i `../projecte_2026`:
arranca sempre a `LOGO` i recorre el flux sencer `LOGO → TITLE → INTRO → GAME`,
tal com ho veurà el jugador final. - **Release** (`make` — binari d'ús normal): `debug.yaml` s'ignora completament.
- **Debug** (`make build`): es llig `debug.yaml`. Si no existeix, es crea El joc arranca sempre a `LOGO` i recorre el flux sencer
`LOGO → TITLE → INTRO → GAME`, tal com ho veurà el jugador final.
- **Debug** (`make debug`): es llig `debug.yaml`. Si no existeix, es crea
automàticament amb `start_scene: GAME` perquè el dia a dia de gameplay no automàticament amb `start_scene: GAME` perquè el dia a dia de gameplay no
arrossegui els 15 s de placeholders. Editant-lo a mà, es pot triar el punt arrossegui els 15 s de placeholders. Editant-lo a mà, es pot triar el punt
d'entrada. d'entrada.
- `make release` fa el Release + empaquetat per a distribució (zip/dmg/tar.gz);
l'empaquetat concret està pendent d'implementar.
### Format ### Format