correccions en el Makefile per a windows

This commit is contained in:
2025-11-01 17:37:01 +01:00
parent 5c5151c032
commit b21c52092a
5 changed files with 282 additions and 129 deletions

4
.gitignore vendored
View File

@@ -16,4 +16,6 @@ todo
build/ build/
linux_utils/ linux_utils/
.claude/ .claude/
source/version.h source/version.h
resources.pack
jdd_release/

406
Makefile
View File

@@ -1,215 +1,365 @@
executable = jaildoctors_dilemma # ==============================================================================
source = $(shell find source -name "*.cpp") # DIRECTORIES
appName = JailDoctor's Dilemma # ==============================================================================
releaseFolder = jdd_release 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) ifeq ($(OS),Windows_NT)
VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy-MM-dd'") VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy-MM-dd'")
else else
VERSION := $(shell date +%Y-%m-%d) VERSION := $(shell date +%Y-%m-%d)
endif endif
# Release names # ==============================================================================
windowsRelease = $(executable)-$(VERSION)-win32-x64.zip # WINDOWS-SPECIFIC VARIABLES
macosIntelRelease = $(executable)-$(VERSION)-macos-intel.dmg # ==============================================================================
macosAppleSiliconRelease = $(executable)-$(VERSION)-macos-apple-silicon.dmg ifeq ($(OS),Windows_NT)
linuxRelease = $(executable)-$(VERSION)-linux.tar.gz 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 # SOURCE FILES
packToolSource = tools/pack_resources/pack_resources.cpp source/core/resources/resource_pack.cpp # ==============================================================================
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: # INCLUDES
@echo "Building pack_resources tool..." # ==============================================================================
@cd tools/pack_resources && $(MAKE) INCLUDES := -Isource
# Create resources.pack from data directory # ==============================================================================
resources.pack: pack_tool # COMPILER FLAGS (OS-specific)
@echo "Creating resources.pack..." # ==============================================================================
@$(packTool) data resources.pack 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: windows:
@echo off @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" @echo Compilando para Windows con nombre: "$(WIN_TARGET_FILE).exe"
strip -s -R .comment -R .gnu.version "$(executable).exe" --strip-unneeded 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: windows_debug:
@echo off @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" @echo Compilando version debug para Windows: "$(WIN_TARGET_FILE)_debug.exe"
strip -s -R .comment -R .gnu.version "$(executable)_debug.exe" --strip-unneeded g++ $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(WIN_TARGET_FILE)_debug.exe"
windows_release: windows_release:
@echo off
# Build packing tool and create resources.pack
@$(MAKE) pack_tool @$(MAKE) pack_tool
@$(MAKE) resources.pack @$(MAKE) resources.pack
@echo off
@echo Creando release para Windows - Version: $(VERSION)
# Generate version.h from version.h.in # 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" @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 # Crea carpeta temporal 'RELEASE_FOLDER'
powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force} powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
powershell if (-not (Test-Path "$(releaseFolder)")) {New-Item "$(releaseFolder)" -ItemType Directory} powershell if (-not (Test-Path "$(RELEASE_FOLDER)")) {New-Item "$(RELEASE_FOLDER)" -ItemType Directory}
# Copy resources.pack instead of data folder # Copia el archivo 'resources.pack'
powershell Copy-Item "resources.pack" -Destination "$(releaseFolder)" powershell Copy-Item -Path "resources.pack" -Destination "$(RELEASE_FOLDER)"
# Copy root files # Copia los ficheros que están en la raíz del proyecto
powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)" powershell Copy-Item "LICENSE" -Destination "$(RELEASE_FOLDER)"
powershell Copy-Item "README.md" -Destination "$(releaseFolder)" powershell Copy-Item "README.md" -Destination "$(RELEASE_FOLDER)"
powershell Copy-Item "gamecontrollerdb.txt" -Destination "$(releaseFolder)" powershell Copy-Item "gamecontrollerdb.txt" -Destination "$(RELEASE_FOLDER)"
powershell Copy-Item "release\*.dll" -Destination "$(releaseFolder)" powershell Copy-Item "release\*.dll" -Destination "$(RELEASE_FOLDER)"
# Build with RELEASE_BUILD flag (include jdd.res for icon) # Compila (con icono)
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" windres release/jdd.rc -O coff -o $(RESOURCE_FILE)
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded 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 # Crea el fichero .zip
powershell if (Test-Path $(windowsRelease)) {Remove-Item $(windowsRelease)} powershell if (Test-Path "$(WINDOWS_RELEASE)") {Remove-Item "$(WINDOWS_RELEASE)"}
powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease) powershell Compress-Archive -Path "$(RELEASE_FOLDER)"/* -DestinationPath "$(WINDOWS_RELEASE)"
@echo Release creado: $(WINDOWS_RELEASE)
# Remove folder # Elimina la carpeta temporal 'RELEASE_FOLDER'
powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force} powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
# ==============================================================================
# COMPILACIÓN PARA MACOS
# ==============================================================================
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: 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: macos_release:
# Build packing tool and create resources.pack
@$(MAKE) pack_tool @$(MAKE) pack_tool
@$(MAKE) resources.pack @$(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 # 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"); \ @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 sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
# Verify and install create-dmg if necessary # Elimina datos de compilaciones anteriores
@which create-dmg > /dev/null || (echo "Installing create-dmg..." && brew install create-dmg) $(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 # Crea la carpeta temporal para hacer el trabajo y las carpetas obligatorias para crear una app de macOS
rm -rdf "$(releaseFolder)" $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks"
rm -rdf Frameworks $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS"
rm -f tmp.dmg $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources"
rm -f "$(macosIntelRelease)" $(MKDIR) Frameworks
rm -f "$(macosAppleSiliconRelease)"
# Create folders # Copia carpetas y ficheros
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Frameworks" cp resources.pack "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources"
mkdir -p "$(releaseFolder)/$(appName).app/Contents/MacOS" cp gamecontrollerdb.txt "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources"
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Resources" cp -R release/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks"
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"
cp -R release/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework 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 # Compila la versión para procesadores Intel
cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources" 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
cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents"
cp LICENSE "$(releaseFolder)"
cp README.md "$(releaseFolder)"
# Build INTEL with RELEASE_BUILD flag # Firma la aplicación
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 codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
# Code sign the Intel application # Empaqueta el .dmg de la versión Intel con create-dmg
codesign --deep --force --sign - --timestamp=none "$(releaseFolder)/$(appName).app" @echo "Creando DMG Intel con iconos de 96x96..."
# Build INTEL DMG with create-dmg
@echo "Creating Intel DMG with 96x96 icons..."
create-dmg \ create-dmg \
--volname "$(appName)" \ --volname "$(APP_NAME)" \
--window-pos 200 120 \ --window-pos 200 120 \
--window-size 720 300 \ --window-size 720 300 \
--icon-size 96 \ --icon-size 96 \
--text-size 12 \ --text-size 12 \
--icon "$(appName).app" 278 102 \ --icon "$(APP_NAME).app" 278 102 \
--icon "LICENSE" 441 102 \ --icon "LICENSE" 441 102 \
--icon "README.md" 604 102 \ --icon "README.md" 604 102 \
--app-drop-link 115 102 \ --app-drop-link 115 102 \
--hide-extension "$(appName).app" \ --hide-extension "$(APP_NAME).app" \
"$(macosIntelRelease)" \ "$(MACOS_INTEL_RELEASE)" \
"$(releaseFolder)" || true "$(RELEASE_FOLDER)" || true
@echo "Intel release created: $(macosIntelRelease)" @echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
# Build APPLE SILICON with RELEASE_BUILD flag # Compila la versión para procesadores Apple Silicon
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 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 # Firma la aplicación
codesign --deep --force --sign - --timestamp=none "$(releaseFolder)/$(appName).app" codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
# Build APPLE SILICON DMG with create-dmg # Empaqueta el .dmg de la versión Apple Silicon con create-dmg
@echo "Creating Apple Silicon DMG with 96x96 icons..." @echo "Creando DMG Apple Silicon con iconos de 96x96..."
create-dmg \ create-dmg \
--volname "$(appName)" \ --volname "$(APP_NAME)" \
--window-pos 200 120 \ --window-pos 200 120 \
--window-size 720 300 \ --window-size 720 300 \
--icon-size 96 \ --icon-size 96 \
--text-size 12 \ --text-size 12 \
--icon "$(appName).app" 278 102 \ --icon "$(APP_NAME).app" 278 102 \
--icon "LICENSE" 441 102 \ --icon "LICENSE" 441 102 \
--icon "README.md" 604 102 \ --icon "README.md" 604 102 \
--app-drop-link 115 102 \ --app-drop-link 115 102 \
--hide-extension "$(appName).app" \ --hide-extension "$(APP_NAME).app" \
"$(macosAppleSiliconRelease)" \ "$(MACOS_APPLE_SILICON_RELEASE)" \
"$(releaseFolder)" || true "$(RELEASE_FOLDER)" || true
@echo "Apple Silicon release created: $(macosAppleSiliconRelease)" @echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)"
# Remove data # Elimina las carpetas temporales
rm -rdf Frameworks $(RMDIR) Frameworks
rm -rdf "$(releaseFolder)" $(RMDIR) "$(RELEASE_FOLDER)"
# ==============================================================================
# COMPILACIÓN PARA LINUX
# ==============================================================================
linux: linux:
g++ $(source) -Isource -std=$(cpp_standard) -Wall -Os -lSDL3 -lGL -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)" @echo "Compilando para Linux: $(TARGET_NAME)"
strip -s -R .comment -R .gnu.version "$(executable)" --strip-unneeded g++ $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
linux_debug: linux_debug:
g++ $(source) -Isource -D DEBUG -std=$(cpp_standard) -Wall -Os -lSDL3 -lGL -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)_debug" @echo "Compilando version debug para Linux: $(TARGET_NAME)_debug"
strip -s -R .comment -R .gnu.version "$(executable)_debug" --strip-unneeded g++ $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
linux_release: linux_release:
# Build packing tool and create resources.pack
@$(MAKE) pack_tool @$(MAKE) pack_tool
@$(MAKE) resources.pack @$(MAKE) resources.pack
@echo "Creando release para Linux - Version: $(VERSION)"
# Generate version.h from version.h.in # 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"); \ @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 sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
# Remove data # Elimina carpetas previas
rm -rdf "$(releaseFolder)" $(RMDIR) "$(RELEASE_FOLDER)"
# Create folders # Crea la carpeta temporal para realizar el lanzamiento
mkdir -p "$(releaseFolder)" $(MKDIR) "$(RELEASE_FOLDER)"
# Copy resources.pack instead of data folder # Copia ficheros
cp resources.pack "$(releaseFolder)" cp resources.pack "$(RELEASE_FOLDER)"
cp LICENSE "$(releaseFolder)" cp LICENSE "$(RELEASE_FOLDER)"
cp README.md "$(releaseFolder)" cp README.md "$(RELEASE_FOLDER)"
cp gamecontrollerdb.txt "$(releaseFolder)" cp gamecontrollerdb.txt "$(RELEASE_FOLDER)"
# Build with RELEASE_BUILD flag # Compila
g++ $(source) -Isource -D RELEASE_BUILD -std=$(cpp_standard) -Wall -Os -lSDL3 -lGL -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(releaseFolder)/$(executable)" g++ $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)"
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable)" --strip-unneeded strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
# Pack files # Empaqueta ficheros
rm -f "$(linuxRelease)" $(RMFILE) "$(LINUX_RELEASE)"
cd "$(releaseFolder)" && tar -czvf "../$(linuxRelease)" * tar -czvf "$(LINUX_RELEASE)" -C "$(RELEASE_FOLDER)" .
@echo "Release creado: $(LINUX_RELEASE)"
# Remove data # Elimina la carpeta temporal
rm -rdf "$(releaseFolder)" $(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

Binary file not shown.

Binary file not shown.

View File

@@ -6,6 +6,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <cstdint>
namespace jdd { namespace jdd {
namespace ResourceHelper { namespace ResourceHelper {