diff --git a/.gitignore b/.gitignore index dfa9fde..5f59f31 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,6 @@ todo build/ linux_utils/ .claude/ -source/version.h \ No newline at end of file +source/version.h +resources.pack +jdd_release/ \ No newline at end of file diff --git a/Makefile b/Makefile index 0de83d2..e3f7f32 100644 --- a/Makefile +++ b/Makefile @@ -1,215 +1,365 @@ -executable = jaildoctors_dilemma -source = $(shell find source -name "*.cpp") -appName = JailDoctor's Dilemma -releaseFolder = jdd_release +# ============================================================================== +# DIRECTORIES +# ============================================================================== +DIR_ROOT := $(dir $(abspath $(MAKEFILE_LIST))) +DIR_SOURCES := $(addsuffix /, $(DIR_ROOT)source) +DIR_BIN := $(addsuffix /, $(DIR_ROOT)) +DIR_TOOLS := $(addsuffix /, $(DIR_ROOT)tools) -# Automatic version based on current date (OS-specific) +# ============================================================================== +# TARGET NAMES +# ============================================================================== +TARGET_NAME := jaildoctors_dilemma +TARGET_FILE := $(DIR_BIN)$(TARGET_NAME) +APP_NAME := JailDoctor's Dilemma +RELEASE_FOLDER := jdd_release +RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME) +RESOURCE_FILE := release/jdd.res + +# ============================================================================== +# PACKING TOOL +# ============================================================================== +ifeq ($(OS),Windows_NT) + PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources.exe + PACK_CXX := $(CXX) +else + PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources + PACK_CXX := $(CXX) +endif +PACK_SOURCES := $(DIR_TOOLS)pack_resources/pack_resources.cpp source/core/resources/resource_pack.cpp +PACK_INCLUDES := -Isource + +# ============================================================================== +# VERSION (automatic based on date) +# ============================================================================== ifeq ($(OS),Windows_NT) VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy-MM-dd'") else VERSION := $(shell date +%Y-%m-%d) endif -# Release names -windowsRelease = $(executable)-$(VERSION)-win32-x64.zip -macosIntelRelease = $(executable)-$(VERSION)-macos-intel.dmg -macosAppleSiliconRelease = $(executable)-$(VERSION)-macos-apple-silicon.dmg -linuxRelease = $(executable)-$(VERSION)-linux.tar.gz +# ============================================================================== +# WINDOWS-SPECIFIC VARIABLES +# ============================================================================== +ifeq ($(OS),Windows_NT) + WIN_TARGET_FILE := $(DIR_BIN)$(APP_NAME) + WIN_RELEASE_FILE := $(RELEASE_FOLDER)/$(APP_NAME) +else + WIN_TARGET_FILE := $(TARGET_FILE) + WIN_RELEASE_FILE := $(RELEASE_FILE) +endif -# Specify the C++ standard -cpp_standard = c++20 +# ============================================================================== +# RELEASE NAMES +# ============================================================================== +WINDOWS_RELEASE := $(TARGET_NAME)-$(VERSION)-win32-x64.zip +MACOS_INTEL_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-intel.dmg +MACOS_APPLE_SILICON_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-apple-silicon.dmg +LINUX_RELEASE := $(TARGET_NAME)-$(VERSION)-linux.tar.gz -# Resource packing tool -packTool = tools/pack_resources/pack_resources -packToolSource = tools/pack_resources/pack_resources.cpp source/core/resources/resource_pack.cpp +# ============================================================================== +# SOURCE FILES +# ============================================================================== +APP_SOURCES := \ + source/main.cpp \ + source/core/audio/audio.cpp \ + source/core/input/input.cpp \ + source/core/input/mouse.cpp \ + source/core/input/global_inputs.cpp \ + source/core/rendering/screen.cpp \ + source/core/rendering/surface.cpp \ + source/core/rendering/surface_sprite.cpp \ + source/core/rendering/surface_animated_sprite.cpp \ + source/core/rendering/surface_moving_sprite.cpp \ + source/core/rendering/text.cpp \ + source/core/rendering/texture.cpp \ + source/core/rendering/gif.cpp \ + source/core/rendering/opengl/opengl_shader.cpp \ + source/core/resources/asset.cpp \ + source/core/resources/resource.cpp \ + source/core/resources/resource_helper.cpp \ + source/core/resources/resource_loader.cpp \ + source/core/resources/resource_pack.cpp \ + source/core/system/director.cpp \ + source/core/system/debug.cpp \ + source/core/system/global_events.cpp \ + source/game/options.cpp \ + source/game/entities/player.cpp \ + source/game/entities/enemy.cpp \ + source/game/entities/item.cpp \ + source/game/gameplay/room.cpp \ + source/game/gameplay/scoreboard.cpp \ + source/game/gameplay/cheevos.cpp \ + source/game/gameplay/item_tracker.cpp \ + source/game/gameplay/room_tracker.cpp \ + source/game/gameplay/stats.cpp \ + source/game/scenes/logo.cpp \ + source/game/scenes/loading_screen.cpp \ + source/game/scenes/title.cpp \ + source/game/scenes/game.cpp \ + source/game/scenes/game_over.cpp \ + source/game/scenes/ending.cpp \ + source/game/scenes/ending2.cpp \ + source/game/scenes/credits.cpp \ + source/game/ui/notifier.cpp \ + source/utils/utils.cpp \ + source/utils/delta_timer.cpp \ + source/external/jail_audio.cpp -# Build the resource packing tool -pack_tool: - @echo "Building pack_resources tool..." - @cd tools/pack_resources && $(MAKE) +# ============================================================================== +# INCLUDES +# ============================================================================== +INCLUDES := -Isource -# Create resources.pack from data directory -resources.pack: pack_tool - @echo "Creating resources.pack..." - @$(packTool) data resources.pack +# ============================================================================== +# COMPILER FLAGS (OS-specific) +# ============================================================================== +CPP_STANDARD := c++20 +ifeq ($(OS),Windows_NT) + FixPath = $(subst /,\\,$1) + CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections \ + -Wl,--gc-sections -static-libstdc++ -static-libgcc \ + -Wl,-subsystem,windows -DWINDOWS_BUILD + CXXFLAGS_DEBUG := -std=$(CPP_STANDARD) -Wall -g -D_DEBUG -DWINDOWS_BUILD + LDFLAGS := -lmingw32 -lws2_32 -lSDL3 -lopengl32 + RM := del /Q + MKDIR := mkdir +else + FixPath = $1 + CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections + CXXFLAGS_DEBUG := -std=$(CPP_STANDARD) -Wall -g -D_DEBUG + LDFLAGS := -lSDL3 + RMFILE := rm -f + RMDIR := rm -rdf + MKDIR := mkdir -p + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + CXXFLAGS += -DLINUX_BUILD + LDFLAGS += -lGL + endif + ifeq ($(UNAME_S),Darwin) + CXXFLAGS += -Wno-deprecated -DMACOS_BUILD + CXXFLAGS_DEBUG += -Wno-deprecated -DMACOS_BUILD + LDFLAGS += -framework OpenGL + # Configurar arquitectura (por defecto arm64) + CXXFLAGS += -arch arm64 + CXXFLAGS_DEBUG += -arch arm64 + endif +endif + +# ============================================================================== +# REGLAS PARA HERRAMIENTA DE EMPAQUETADO Y RESOURCES.PACK +# ============================================================================== +$(PACK_TOOL): FORCE + @echo "Compilando herramienta de empaquetado..." + $(PACK_CXX) -std=$(CPP_STANDARD) -Wall -Os $(PACK_INCLUDES) $(PACK_SOURCES) -o $(PACK_TOOL) + @echo "✓ Herramienta de empaquetado lista: $(PACK_TOOL)" + +pack_tool: $(PACK_TOOL) + +resources.pack: $(PACK_TOOL) + @echo "Generando resources.pack desde directorio data/..." + $(PACK_TOOL) data resources.pack + @echo "✓ resources.pack generado exitosamente" + +# ============================================================================== +# COMPILACIÓN PARA WINDOWS +# ============================================================================== windows: @echo off - g++ $(source) -Isource -std=$(cpp_standard) -Wall -Os -lmingw32 -lws2_32 -lSDL3main -lSDL3 -lopengl32 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable).exe" - strip -s -R .comment -R .gnu.version "$(executable).exe" --strip-unneeded + @echo Compilando para Windows con nombre: "$(WIN_TARGET_FILE).exe" + windres release/jdd.rc -O coff -o $(RESOURCE_FILE) + g++ $(APP_SOURCES) $(RESOURCE_FILE) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_TARGET_FILE).exe" + strip -s -R .comment -R .gnu.version "$(WIN_TARGET_FILE).exe" --strip-unneeded windows_debug: @echo off - g++ $(source) -Isource -D DEBUG -std=$(cpp_standard) -Wall -Os -lmingw32 -lws2_32 -lSDL3main -lSDL3 -lopengl32 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable)_debug.exe" - strip -s -R .comment -R .gnu.version "$(executable)_debug.exe" --strip-unneeded + @echo Compilando version debug para Windows: "$(WIN_TARGET_FILE)_debug.exe" + g++ $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(WIN_TARGET_FILE)_debug.exe" windows_release: - @echo off - -# Build packing tool and create resources.pack @$(MAKE) pack_tool @$(MAKE) resources.pack + @echo off + @echo Creando release para Windows - Version: $(VERSION) # Generate version.h from version.h.in - @echo "Generating version.h..." + @echo "Generando version.h..." @powershell -Command "$$GIT_HASH = (git rev-parse --short=7 HEAD 2>$$null); if (-not $$GIT_HASH) { $$GIT_HASH = 'unknown' }; (Get-Content source/version.h.in) -replace '@GIT_HASH@', $$GIT_HASH | Set-Content source/version.h" -# Create release folder - powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force} - powershell if (-not (Test-Path "$(releaseFolder)")) {New-Item "$(releaseFolder)" -ItemType Directory} +# Crea carpeta temporal 'RELEASE_FOLDER' + powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force} + powershell if (-not (Test-Path "$(RELEASE_FOLDER)")) {New-Item "$(RELEASE_FOLDER)" -ItemType Directory} -# Copy resources.pack instead of data folder - powershell Copy-Item "resources.pack" -Destination "$(releaseFolder)" +# Copia el archivo 'resources.pack' + powershell Copy-Item -Path "resources.pack" -Destination "$(RELEASE_FOLDER)" -# Copy root files - powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)" - powershell Copy-Item "README.md" -Destination "$(releaseFolder)" - powershell Copy-Item "gamecontrollerdb.txt" -Destination "$(releaseFolder)" - powershell Copy-Item "release\*.dll" -Destination "$(releaseFolder)" +# Copia los ficheros que están en la raíz del proyecto + powershell Copy-Item "LICENSE" -Destination "$(RELEASE_FOLDER)" + powershell Copy-Item "README.md" -Destination "$(RELEASE_FOLDER)" + powershell Copy-Item "gamecontrollerdb.txt" -Destination "$(RELEASE_FOLDER)" + powershell Copy-Item "release\*.dll" -Destination "$(RELEASE_FOLDER)" -# Build with RELEASE_BUILD flag (include jdd.res for icon) - g++ $(source) release/jdd.res -Isource -D RELEASE_BUILD -std=$(cpp_standard) -Wall -Os -lmingw32 -lws2_32 -lSDL3main -lSDL3 -lopengl32 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe" - strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded +# Compila (con icono) + windres release/jdd.rc -O coff -o $(RESOURCE_FILE) + g++ $(APP_SOURCES) $(RESOURCE_FILE) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_RELEASE_FILE).exe" + strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded -# Create ZIP - powershell if (Test-Path $(windowsRelease)) {Remove-Item $(windowsRelease)} - powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease) +# Crea el fichero .zip + powershell if (Test-Path "$(WINDOWS_RELEASE)") {Remove-Item "$(WINDOWS_RELEASE)"} + powershell Compress-Archive -Path "$(RELEASE_FOLDER)"/* -DestinationPath "$(WINDOWS_RELEASE)" + @echo Release creado: $(WINDOWS_RELEASE) -# Remove folder - powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force} +# Elimina la carpeta temporal 'RELEASE_FOLDER' + powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force} +# ============================================================================== +# COMPILACIÓN PARA MACOS +# ============================================================================== macos: - clang++ $(source) -Isource -std=$(cpp_standard) -Wall -Os -lSDL3 -framework OpenGL -Wno-deprecated -ffunction-sections -fdata-sections -o "$(executable)" + @echo "Compilando para macOS: $(TARGET_NAME)" + clang++ $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)" macos_debug: - clang++ $(source) -Isource -D DEBUG -std=$(cpp_standard) -Wall -Os -lSDL3 -framework OpenGL -Wno-deprecated -ffunction-sections -fdata-sections -o "$(executable)_debug" + @echo "Compilando version debug para macOS: $(TARGET_NAME)_debug" + clang++ $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug" macos_release: -# Build packing tool and create resources.pack @$(MAKE) pack_tool @$(MAKE) resources.pack - @echo "Creating macOS release - Version: $(VERSION)" + @echo "Creando release para macOS - Version: $(VERSION)" + +# Verificar e instalar create-dmg si es necesario + @which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg) # Generate version.h from version.h.in - @echo "Generating version.h..." + @echo "Generando version.h..." @GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \ sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h -# Verify and install create-dmg if necessary - @which create-dmg > /dev/null || (echo "Installing create-dmg..." && brew install create-dmg) +# Elimina datos de compilaciones anteriores + $(RMDIR) "$(RELEASE_FOLDER)" + $(RMDIR) Frameworks + $(RMFILE) tmp.dmg + $(RMFILE) "$(MACOS_INTEL_RELEASE)" + $(RMFILE) "$(MACOS_APPLE_SILICON_RELEASE)" -# Remove data and possible data from previous builds - rm -rdf "$(releaseFolder)" - rm -rdf Frameworks - rm -f tmp.dmg - rm -f "$(macosIntelRelease)" - rm -f "$(macosAppleSiliconRelease)" +# Crea la carpeta temporal para hacer el trabajo y las carpetas obligatorias para crear una app de macOS + $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks" + $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS" + $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" + $(MKDIR) Frameworks -# Create folders - mkdir -p "$(releaseFolder)/$(appName).app/Contents/Frameworks" - mkdir -p "$(releaseFolder)/$(appName).app/Contents/MacOS" - mkdir -p "$(releaseFolder)/$(appName).app/Contents/Resources" - mkdir -p Frameworks - -# Copy resources.pack instead of data folder - cp resources.pack "$(releaseFolder)/$(appName).app/Contents/Resources" - cp gamecontrollerdb.txt "$(releaseFolder)/$(appName).app/Contents/Resources" - cp -R release/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework "$(releaseFolder)/$(appName).app/Contents/Frameworks" +# Copia carpetas y ficheros + cp resources.pack "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" + cp gamecontrollerdb.txt "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" + cp -R release/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks" cp -R release/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework Frameworks + cp release/*.icns "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" + cp release/Info.plist "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents" + cp LICENSE "$(RELEASE_FOLDER)" + cp README.md "$(RELEASE_FOLDER)" -# Copy files - cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources" - cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents" - cp LICENSE "$(releaseFolder)" - cp README.md "$(releaseFolder)" +# Compila la versión para procesadores Intel + clang++ $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -std=$(CPP_STANDARD) -Wall -Os -framework SDL3 -F ./Frameworks -framework OpenGL -Wno-deprecated -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15 -# Build INTEL with RELEASE_BUILD flag - clang++ $(source) -Isource -D MACOS_BUNDLE -D RELEASE_BUILD -std=$(cpp_standard) -Wall -Os -framework SDL3 -F ./Frameworks -framework OpenGL -Wno-deprecated -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15 +# Firma la aplicación + codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app" -# Code sign the Intel application - codesign --deep --force --sign - --timestamp=none "$(releaseFolder)/$(appName).app" - -# Build INTEL DMG with create-dmg - @echo "Creating Intel DMG with 96x96 icons..." +# Empaqueta el .dmg de la versión Intel con create-dmg + @echo "Creando DMG Intel con iconos de 96x96..." create-dmg \ - --volname "$(appName)" \ + --volname "$(APP_NAME)" \ --window-pos 200 120 \ --window-size 720 300 \ --icon-size 96 \ --text-size 12 \ - --icon "$(appName).app" 278 102 \ + --icon "$(APP_NAME).app" 278 102 \ --icon "LICENSE" 441 102 \ --icon "README.md" 604 102 \ --app-drop-link 115 102 \ - --hide-extension "$(appName).app" \ - "$(macosIntelRelease)" \ - "$(releaseFolder)" || true - @echo "Intel release created: $(macosIntelRelease)" + --hide-extension "$(APP_NAME).app" \ + "$(MACOS_INTEL_RELEASE)" \ + "$(RELEASE_FOLDER)" || true + @echo "Release Intel creado: $(MACOS_INTEL_RELEASE)" -# Build APPLE SILICON with RELEASE_BUILD flag - clang++ $(source) -Isource -D MACOS_BUNDLE -D RELEASE_BUILD -std=$(cpp_standard) -Wall -Os -framework SDL3 -F ./Frameworks -framework OpenGL -Wno-deprecated -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11 +# Compila la versión para procesadores Apple Silicon + clang++ $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -std=$(CPP_STANDARD) -Wall -Os -framework SDL3 -F ./Frameworks -framework OpenGL -Wno-deprecated -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11 -# Code sign the Apple Silicon application - codesign --deep --force --sign - --timestamp=none "$(releaseFolder)/$(appName).app" +# Firma la aplicación + codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app" -# Build APPLE SILICON DMG with create-dmg - @echo "Creating Apple Silicon DMG with 96x96 icons..." +# Empaqueta el .dmg de la versión Apple Silicon con create-dmg + @echo "Creando DMG Apple Silicon con iconos de 96x96..." create-dmg \ - --volname "$(appName)" \ + --volname "$(APP_NAME)" \ --window-pos 200 120 \ --window-size 720 300 \ --icon-size 96 \ --text-size 12 \ - --icon "$(appName).app" 278 102 \ + --icon "$(APP_NAME).app" 278 102 \ --icon "LICENSE" 441 102 \ --icon "README.md" 604 102 \ --app-drop-link 115 102 \ - --hide-extension "$(appName).app" \ - "$(macosAppleSiliconRelease)" \ - "$(releaseFolder)" || true - @echo "Apple Silicon release created: $(macosAppleSiliconRelease)" + --hide-extension "$(APP_NAME).app" \ + "$(MACOS_APPLE_SILICON_RELEASE)" \ + "$(RELEASE_FOLDER)" || true + @echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)" -# Remove data - rm -rdf Frameworks - rm -rdf "$(releaseFolder)" +# Elimina las carpetas temporales + $(RMDIR) Frameworks + $(RMDIR) "$(RELEASE_FOLDER)" +# ============================================================================== +# COMPILACIÓN PARA LINUX +# ============================================================================== linux: - g++ $(source) -Isource -std=$(cpp_standard) -Wall -Os -lSDL3 -lGL -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)" - strip -s -R .comment -R .gnu.version "$(executable)" --strip-unneeded + @echo "Compilando para Linux: $(TARGET_NAME)" + g++ $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)" + strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded linux_debug: - g++ $(source) -Isource -D DEBUG -std=$(cpp_standard) -Wall -Os -lSDL3 -lGL -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)_debug" - strip -s -R .comment -R .gnu.version "$(executable)_debug" --strip-unneeded + @echo "Compilando version debug para Linux: $(TARGET_NAME)_debug" + g++ $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug" linux_release: -# Build packing tool and create resources.pack @$(MAKE) pack_tool @$(MAKE) resources.pack + @echo "Creando release para Linux - Version: $(VERSION)" # Generate version.h from version.h.in - @echo "Generating version.h..." + @echo "Generando version.h..." @GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \ sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h -# Remove data - rm -rdf "$(releaseFolder)" +# Elimina carpetas previas + $(RMDIR) "$(RELEASE_FOLDER)" -# Create folders - mkdir -p "$(releaseFolder)" +# Crea la carpeta temporal para realizar el lanzamiento + $(MKDIR) "$(RELEASE_FOLDER)" -# Copy resources.pack instead of data folder - cp resources.pack "$(releaseFolder)" - cp LICENSE "$(releaseFolder)" - cp README.md "$(releaseFolder)" - cp gamecontrollerdb.txt "$(releaseFolder)" +# Copia ficheros + cp resources.pack "$(RELEASE_FOLDER)" + cp LICENSE "$(RELEASE_FOLDER)" + cp README.md "$(RELEASE_FOLDER)" + cp gamecontrollerdb.txt "$(RELEASE_FOLDER)" -# Build with RELEASE_BUILD flag - g++ $(source) -Isource -D RELEASE_BUILD -std=$(cpp_standard) -Wall -Os -lSDL3 -lGL -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(releaseFolder)/$(executable)" - strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable)" --strip-unneeded +# Compila + g++ $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)" + strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded -# Pack files - rm -f "$(linuxRelease)" - cd "$(releaseFolder)" && tar -czvf "../$(linuxRelease)" * +# Empaqueta ficheros + $(RMFILE) "$(LINUX_RELEASE)" + tar -czvf "$(LINUX_RELEASE)" -C "$(RELEASE_FOLDER)" . + @echo "Release creado: $(LINUX_RELEASE)" -# Remove data - rm -rdf "$(releaseFolder)" \ No newline at end of file +# Elimina la carpeta temporal + $(RMDIR) "$(RELEASE_FOLDER)" + +# ============================================================================== +# REGLAS ESPECIALES +# ============================================================================== +FORCE: + +.PHONY: windows windows_debug windows_release macos macos_debug macos_release linux linux_debug linux_release pack_tool resources.pack diff --git a/release/jdd.res b/release/jdd.res index 3b2ee3c..679af62 100644 Binary files a/release/jdd.res and b/release/jdd.res differ diff --git a/resources.pack b/resources.pack index d11b097..7ac2436 100644 Binary files a/resources.pack and b/resources.pack differ diff --git a/source/core/resources/resource_helper.hpp b/source/core/resources/resource_helper.hpp index eedd110..3b358b0 100644 --- a/source/core/resources/resource_helper.hpp +++ b/source/core/resources/resource_helper.hpp @@ -6,6 +6,7 @@ #include #include +#include namespace jdd { namespace ResourceHelper {