From 03f1c5f9260c010292adac7f47163b0f9ccf1b2d Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 22 Apr 2026 11:48:14 +0200 Subject: [PATCH] fix(makefile): alinear targets amb ../aee i ../projecte_2026 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Makefile | 87 +++++++++++++++++++++++++++++++++++---------- docs/convencions.md | 12 ++++--- 2 files changed, 77 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index f11935e..eb38c4f 100644 --- a/Makefile +++ b/Makefile @@ -14,47 +14,66 @@ endif 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: - @cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Debug $(CMAKE_DEFS) - -build: configure - @cmake --build $(BUILDDIR) -j$(JOBS) - -run: build - @./$(BUILDDIR)/$(PROJECT) - -release: +all: @cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS) @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: @echo "$(PROJECT) $(VERSION) ($(GIT_HASH))" clean: @rm -rf $(BUILDDIR) -rebuild: clean build +rebuild: clean all # ============================================================================== # CODE QUALITY (delegados a cmake) # ============================================================================== -format: configure +format: + @cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS) @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 -tidy: configure +tidy: + @cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS) @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 -cppcheck: configure +cppcheck: + @cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release $(CMAKE_DEFS) @cmake --build $(BUILDDIR) --target cppcheck # ============================================================================== @@ -63,3 +82,35 @@ cppcheck: configure hooks-install: @git config core.hooksPath .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))" diff --git a/docs/convencions.md b/docs/convencions.md index 700bdd8..e4ceacf 100644 --- a/docs/convencions.md +++ b/docs/convencions.md @@ -27,13 +27,17 @@ de sistema que `config.yaml`: ### Comportament segons build -- **Release** (`make release`): `debug.yaml` s'ignora completament. El joc - arranca sempre a `LOGO` i recorre el flux sencer `LOGO → TITLE → INTRO → GAME`, - tal com ho veurà el jugador final. -- **Debug** (`make build`): es llig `debug.yaml`. Si no existeix, es crea +Convenció alineada amb `../aee` i `../projecte_2026`: + +- **Release** (`make` — binari d'ús normal): `debug.yaml` s'ignora completament. + 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 arrossegui els 15 s de placeholders. Editant-lo a mà, es pot triar el punt d'entrada. +- `make release` fa el Release + empaquetat per a distribució (zip/dmg/tar.gz); + l'empaquetat concret està pendent d'implementar. ### Format