Simplifica Makefile a 3 targets delegats a CMake amb release a dist/
This commit is contained in:
413
Makefile
413
Makefile
@@ -1,264 +1,189 @@
|
||||
# Directorios
|
||||
DIR_ROOT := $(dir $(abspath $(MAKEFILE_LIST)))
|
||||
DIR_SOURCES := $(addsuffix /, $(DIR_ROOT)source)
|
||||
DIR_BIN := $(addsuffix /, $(DIR_ROOT))
|
||||
DIR_BUILD := $(addsuffix /, $(DIR_ROOT)build)
|
||||
# ==============================================================================
|
||||
# Makefile per a Shadertoy
|
||||
#
|
||||
# Tres targets:
|
||||
# make → Release (cmake)
|
||||
# make debug → Debug (cmake)
|
||||
# make release → Release + empaquetat per a distribució a dist/
|
||||
#
|
||||
# El SO es detecta automàticament. La compilació sempre passa per CMake.
|
||||
# ==============================================================================
|
||||
|
||||
# Variables
|
||||
TARGET_NAME := shadertoy
|
||||
TARGET_FILE := $(DIR_BIN)$(TARGET_NAME)
|
||||
APP_NAME := Shadertoy
|
||||
RELEASE_FOLDER := shadertoy_release
|
||||
RESOURCE_FILE := release/windows/shadertoy.res
|
||||
PROJECT := shadertoy
|
||||
APP_NAME := Shadertoy
|
||||
DIR_ROOT := $(dir $(abspath $(MAKEFILE_LIST)))
|
||||
BUILDDIR := build
|
||||
DIST_DIR := dist
|
||||
RELEASE_FOLDER := $(DIST_DIR)/_tmp
|
||||
|
||||
# Versión automática basada en la fecha actual (formato YYYY.MM.DD para que
|
||||
# CFBundleShortVersionString del bundle macOS sea conforme a la spec de Apple).
|
||||
# ==============================================================================
|
||||
# DETECCIÓ DE PLATAFORMA + GENERADOR CMAKE + JOBS
|
||||
# ==============================================================================
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# MSYS2/Git Bash usa /dev/null, cmd.exe pur usa NUL.
|
||||
ifneq ($(MSYSTEM),)
|
||||
NULDEV := /dev/null
|
||||
else
|
||||
NULDEV := NUL
|
||||
endif
|
||||
JOBS ?= $(NUMBER_OF_PROCESSORS)
|
||||
HAS_NINJA := $(shell ninja --version 2>$(NULDEV))
|
||||
ifneq ($(HAS_NINJA),)
|
||||
CMAKE_GEN := -G "Ninja"
|
||||
else
|
||||
CMAKE_GEN := -G "MinGW Makefiles"
|
||||
endif
|
||||
UNAME_S := Windows
|
||||
SHELL := cmd.exe
|
||||
else
|
||||
NULDEV := /dev/null
|
||||
JOBS ?= $(shell nproc 2>/dev/null || echo 4)
|
||||
CMAKE_GEN :=
|
||||
UNAME_S := $(shell uname -s)
|
||||
endif
|
||||
|
||||
# ==============================================================================
|
||||
# VERSIÓ (data, format YYYY.MM.DD)
|
||||
# ==============================================================================
|
||||
ifeq ($(OS),Windows_NT)
|
||||
VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy.MM.dd'")
|
||||
else
|
||||
VERSION := $(shell date +%Y.%m.%d)
|
||||
endif
|
||||
|
||||
# Variables específicas para Windows (usando APP_NAME)
|
||||
# ==============================================================================
|
||||
# NOMS DELS ARTEFACTES DE RELEASE
|
||||
# ==============================================================================
|
||||
WINDOWS_RELEASE := $(DIST_DIR)/$(PROJECT)-$(VERSION)-win32-x64.zip
|
||||
MACOS_APPLE_SILICON_RELEASE := $(DIST_DIR)/$(PROJECT)-$(VERSION)-macos-apple-silicon.dmg
|
||||
LINUX_RELEASE := $(DIST_DIR)/$(PROJECT)-$(VERSION)-linux.tar.gz
|
||||
|
||||
.PHONY: all debug release clean help _windows_release _macos_release _linux_release
|
||||
|
||||
# ==============================================================================
|
||||
# COMPILACIÓ (delegada a CMake)
|
||||
# ==============================================================================
|
||||
all:
|
||||
@cmake $(CMAKE_GEN) -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release
|
||||
@cmake --build $(BUILDDIR) -j$(JOBS)
|
||||
|
||||
debug:
|
||||
@cmake $(CMAKE_GEN) -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Debug
|
||||
@cmake --build $(BUILDDIR) -j$(JOBS)
|
||||
|
||||
# ==============================================================================
|
||||
# RELEASE (auto-dispatch per SO)
|
||||
# ==============================================================================
|
||||
release:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
WIN_TARGET_FILE := $(DIR_BIN)$(APP_NAME)
|
||||
WIN_RELEASE_FILE := $(RELEASE_FOLDER)/$(APP_NAME)
|
||||
@"$(MAKE)" _windows_release
|
||||
else
|
||||
WIN_TARGET_FILE := $(TARGET_FILE)
|
||||
WIN_RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
@$(MAKE) _macos_release
|
||||
else
|
||||
@$(MAKE) _linux_release
|
||||
endif
|
||||
endif
|
||||
|
||||
# Nombres para los ficheros de lanzamiento
|
||||
WINDOWS_RELEASE := $(TARGET_NAME)-$(VERSION)-win32-x64.zip
|
||||
MACOS_APPLE_SILICON_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-apple-silicon.dmg
|
||||
LINUX_RELEASE := $(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
||||
clean:
|
||||
@rm -rf $(BUILDDIR) $(DIST_DIR)
|
||||
|
||||
# Lista completa de archivos fuente
|
||||
APP_SOURCES := \
|
||||
source/main.cpp \
|
||||
source/rendering/shader_backend.cpp \
|
||||
source/rendering/opengl_shader_backend.cpp \
|
||||
source/rendering/sdl3gpu/sdl3gpu_shader_backend.cpp \
|
||||
source/audio/jail_audio.cpp \
|
||||
source/external/glad/src/glad.c \
|
||||
source/external/stb_vorbis_impl.cpp
|
||||
# ==============================================================================
|
||||
# RELEASE LINUX
|
||||
# ==============================================================================
|
||||
_linux_release:
|
||||
@echo "Creant release per a Linux - Versió: $(VERSION)"
|
||||
@cmake $(CMAKE_GEN) -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release
|
||||
@cmake --build $(BUILDDIR) -j$(JOBS)
|
||||
@mkdir -p $(DIST_DIR)
|
||||
@rm -rf $(RELEASE_FOLDER)
|
||||
@mkdir -p $(RELEASE_FOLDER)
|
||||
@cp -R data $(RELEASE_FOLDER)/
|
||||
@cp LICENSE $(RELEASE_FOLDER)/
|
||||
@cp README.md $(RELEASE_FOLDER)/
|
||||
@cp $(PROJECT) $(RELEASE_FOLDER)/
|
||||
@strip -s -R .comment -R .gnu.version $(RELEASE_FOLDER)/$(PROJECT) --strip-unneeded
|
||||
@rm -f $(LINUX_RELEASE)
|
||||
@tar -czf $(LINUX_RELEASE) -C $(RELEASE_FOLDER) .
|
||||
@echo "Release creat: $(LINUX_RELEASE)"
|
||||
@rm -rf $(RELEASE_FOLDER)
|
||||
|
||||
# Includes
|
||||
INCLUDES := -Isource -Isource/external/glad/include -Isource/external
|
||||
|
||||
# Variables según el sistema operativo
|
||||
ifeq ($(OS),Windows_NT)
|
||||
FixPath = $(subst /,\\,$1)
|
||||
CXXFLAGS := -std=c++17 -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -static-libgcc -Wl,-Bstatic -lpthread -Wl,-Bdynamic -Wl,-subsystem,windows -DWINDOWS_BUILD
|
||||
CXXFLAGS_DEBUG := -std=c++17 -Wall -g -D_DEBUG -DWINDOWS_BUILD
|
||||
LDFLAGS := -lmingw32 -lws2_32 -lSDL3 -lopengl32
|
||||
RM := del /Q
|
||||
MKDIR := mkdir
|
||||
else
|
||||
FixPath = $1
|
||||
CXXFLAGS := -std=c++17 -Wall -Os -ffunction-sections -fdata-sections
|
||||
CXXFLAGS_DEBUG := -std=c++17 -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, como en CMake)
|
||||
CXXFLAGS += -arch arm64
|
||||
CXXFLAGS_DEBUG += -arch arm64
|
||||
endif
|
||||
endif
|
||||
|
||||
# Reglas para compilación
|
||||
windows:
|
||||
@echo off
|
||||
@echo Compilando para Windows con nombre: "$(APP_NAME).exe"
|
||||
windres release/windows/shadertoy.rc -O coff -o $(RESOURCE_FILE)
|
||||
$(CXX) $(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
|
||||
@echo Compilando version debug para Windows: "$(APP_NAME)_debug.exe"
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(WIN_TARGET_FILE)_debug.exe"
|
||||
|
||||
windows_release:
|
||||
@echo off
|
||||
@echo Creando release para Windows - Version: $(VERSION)
|
||||
|
||||
# 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}
|
||||
|
||||
# Copia la carpeta 'data' (que ahora contiene shaders y music)
|
||||
powershell Copy-Item -Path "data" -Destination "$(RELEASE_FOLDER)" -recurse -Force
|
||||
|
||||
# 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 "release\windows\dll\*.dll" -Destination "$(RELEASE_FOLDER)"
|
||||
|
||||
# Compila el recurso de icono
|
||||
@windres release/windows/shadertoy.rc -O coff -o $(RESOURCE_FILE)
|
||||
|
||||
# Compila
|
||||
$(CXX) $(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
|
||||
|
||||
# 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)
|
||||
|
||||
# Elimina la carpeta temporal 'RELEASE_FOLDER'
|
||||
powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
|
||||
|
||||
macos:
|
||||
@echo "Compilando para macOS: $(TARGET_NAME)"
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
||||
|
||||
macos_debug:
|
||||
@echo "Compilando version debug para macOS: $(TARGET_NAME)_debug"
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
||||
|
||||
macos_release:
|
||||
@echo "Creando release para macOS - Version: $(VERSION)"
|
||||
|
||||
# Verifica dependencias necesarias (create-dmg). Si falta, intenta instalarla
|
||||
# con brew; si brew tampoco está, indica el comando exacto al usuario.
|
||||
# ==============================================================================
|
||||
# RELEASE MACOS (Apple Silicon, .dmg amb .app bundle)
|
||||
# ==============================================================================
|
||||
_macos_release:
|
||||
@echo "Creant release per a macOS - Versió: $(VERSION)"
|
||||
@command -v create-dmg >/dev/null 2>&1 || { \
|
||||
echo ""; \
|
||||
echo "============================================"; \
|
||||
echo " Falta la dependencia: create-dmg"; \
|
||||
echo "============================================"; \
|
||||
if command -v brew >/dev/null 2>&1; then \
|
||||
echo " Instalando con: brew install create-dmg"; \
|
||||
brew install create-dmg || { \
|
||||
echo ""; \
|
||||
echo " ERROR: 'brew install create-dmg' ha fallado."; \
|
||||
echo " Ejecuta el comando manualmente y vuelve a probar."; \
|
||||
exit 1; \
|
||||
}; \
|
||||
else \
|
||||
echo " Homebrew no está instalado."; \
|
||||
echo " Instálalo desde https://brew.sh y luego ejecuta:"; \
|
||||
echo " brew install create-dmg"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "Falta create-dmg. Instal·la amb: brew install create-dmg"; \
|
||||
exit 1; \
|
||||
}
|
||||
|
||||
# Elimina datos de compilaciones anteriores
|
||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||
$(RMFILE) tmp.dmg
|
||||
$(RMFILE) "$(MACOS_APPLE_SILICON_RELEASE)"
|
||||
|
||||
# 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"
|
||||
|
||||
# Copia carpetas y ficheros
|
||||
cp -R data "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources"
|
||||
cp -R release/macos/frameworks/SDL3.xcframework "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks"
|
||||
cp release/icons/icon.icns "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources"
|
||||
cp release/macos/Info.plist "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents"
|
||||
cp LICENSE "$(RELEASE_FOLDER)"
|
||||
cp README.md "$(RELEASE_FOLDER)"
|
||||
|
||||
# Actualiza versión en Info.plist
|
||||
@echo "Actualizando Info.plist con versión $(VERSION)..."
|
||||
@cmake -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release -DMACOS_BUNDLE=ON -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
|
||||
@cmake --build $(BUILDDIR) -j$(JOBS)
|
||||
@mkdir -p $(DIST_DIR)
|
||||
@rm -rf $(RELEASE_FOLDER)
|
||||
@rm -f tmp.dmg "$(MACOS_APPLE_SILICON_RELEASE)" $(DIST_DIR)/rw.*
|
||||
@mkdir -p "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks"
|
||||
@mkdir -p "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS"
|
||||
@mkdir -p "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources"
|
||||
@cp -R data "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources/"
|
||||
@cp -R release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks/"
|
||||
@cp release/icons/icon.icns "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources/"
|
||||
@cp release/macos/Info.plist "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/"
|
||||
@cp $(PROJECT) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(PROJECT)"
|
||||
@cp LICENSE "$(RELEASE_FOLDER)/"
|
||||
@cp README.md "$(RELEASE_FOLDER)/"
|
||||
@RAW_VERSION=$$(echo "$(VERSION)" | sed 's/^v//'); \
|
||||
sed -i '' '/<key>CFBundleShortVersionString<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"; \
|
||||
sed -i '' '/<key>CFBundleVersion<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"
|
||||
sed -i '' '/<key>CFBundleShortVersionString<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"; \
|
||||
sed -i '' '/<key>CFBundleVersion<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"
|
||||
@codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
||||
@create-dmg \
|
||||
--volname "$(APP_NAME)" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 720 300 \
|
||||
--icon-size 96 \
|
||||
--text-size 12 \
|
||||
--icon "$(APP_NAME).app" 278 102 \
|
||||
--icon "LICENSE" 441 102 \
|
||||
--icon "README.md" 604 102 \
|
||||
--app-drop-link 115 102 \
|
||||
--hide-extension "$(APP_NAME).app" \
|
||||
"$(MACOS_APPLE_SILICON_RELEASE)" \
|
||||
"$(RELEASE_FOLDER)" || true
|
||||
@echo "Release creat: $(MACOS_APPLE_SILICON_RELEASE)"
|
||||
@rm -rf $(RELEASE_FOLDER)
|
||||
@rm -f $(DIST_DIR)/rw.*
|
||||
|
||||
# Compila la versión para procesadores Apple Silicon
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11
|
||||
# ==============================================================================
|
||||
# RELEASE WINDOWS (.zip amb DLLs)
|
||||
# ==============================================================================
|
||||
_windows_release:
|
||||
@echo off
|
||||
@echo Creant release per a Windows - Versió: $(VERSION)
|
||||
@cmake $(CMAKE_GEN) -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=Release
|
||||
@cmake --build $(BUILDDIR) -j$(JOBS)
|
||||
@powershell -Command "if (-not (Test-Path '$(DIST_DIR)')) {New-Item '$(DIST_DIR)' -ItemType Directory | Out-Null}"
|
||||
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||
@powershell -Command "New-Item '$(RELEASE_FOLDER)' -ItemType Directory | Out-Null"
|
||||
@powershell -Command "Copy-Item -Path 'data' -Destination '$(RELEASE_FOLDER)' -Recurse"
|
||||
@powershell -Command "Copy-Item 'LICENSE' -Destination '$(RELEASE_FOLDER)'"
|
||||
@powershell -Command "Copy-Item 'README.md' -Destination '$(RELEASE_FOLDER)'"
|
||||
@powershell -Command "Copy-Item 'release\windows\dll\*.dll' -Destination '$(RELEASE_FOLDER)'"
|
||||
@powershell -Command "Copy-Item -Path '$(PROJECT).exe' -Destination '$(RELEASE_FOLDER)/$(APP_NAME).exe'"
|
||||
@strip -s -R .comment -R .gnu.version "$(RELEASE_FOLDER)/$(APP_NAME).exe" --strip-unneeded
|
||||
@powershell -Command "if (Test-Path '$(WINDOWS_RELEASE)') {Remove-Item '$(WINDOWS_RELEASE)'}"
|
||||
@powershell -Command "Compress-Archive -Path '$(RELEASE_FOLDER)/*' -DestinationPath '$(WINDOWS_RELEASE)'"
|
||||
@echo Release creat: $(WINDOWS_RELEASE)
|
||||
@powershell -Command "Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force"
|
||||
|
||||
# Firma la aplicación
|
||||
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
||||
|
||||
# Empaqueta el .dmg de la versión Apple Silicon con create-dmg
|
||||
@echo "Creando DMG Apple Silicon con iconos de 96x96..."
|
||||
create-dmg \
|
||||
--volname "$(APP_NAME)" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 720 300 \
|
||||
--icon-size 96 \
|
||||
--text-size 12 \
|
||||
--icon "$(APP_NAME).app" 278 102 \
|
||||
--icon "LICENSE" 441 102 \
|
||||
--icon "README.md" 604 102 \
|
||||
--app-drop-link 115 102 \
|
||||
--hide-extension "$(APP_NAME).app" \
|
||||
"$(MACOS_APPLE_SILICON_RELEASE)" \
|
||||
"$(RELEASE_FOLDER)" || true
|
||||
@echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)"
|
||||
|
||||
# Elimina las carpetas temporales
|
||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||
|
||||
linux:
|
||||
@echo "Compilando para Linux: $(TARGET_NAME)"
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
||||
|
||||
linux_debug:
|
||||
@echo "Compilando version debug para Linux: $(TARGET_NAME)_debug"
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
||||
|
||||
linux_release:
|
||||
@echo "Creando release para Linux - Version: $(VERSION)"
|
||||
# Elimina carpetas previas
|
||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||
|
||||
# Crea la carpeta temporal para realizar el lanzamiento
|
||||
$(MKDIR) "$(RELEASE_FOLDER)"
|
||||
|
||||
# Copia ficheros
|
||||
cp -R data "$(RELEASE_FOLDER)"
|
||||
cp LICENSE "$(RELEASE_FOLDER)"
|
||||
cp README.md "$(RELEASE_FOLDER)"
|
||||
|
||||
# Compila
|
||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(TARGET_NAME)"
|
||||
strip -s -R .comment -R .gnu.version "$(RELEASE_FOLDER)/$(TARGET_NAME)" --strip-unneeded
|
||||
|
||||
# Empaqueta ficheros
|
||||
$(RMFILE) "$(LINUX_RELEASE)"
|
||||
tar -czvf "$(LINUX_RELEASE)" -C "$(RELEASE_FOLDER)" .
|
||||
@echo "Release creado: $(LINUX_RELEASE)"
|
||||
|
||||
# Elimina la carpeta temporal
|
||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||
|
||||
# Regla para mostrar la versión actual
|
||||
show_version:
|
||||
@echo "Version actual: $(VERSION)"
|
||||
|
||||
# Regla de ayuda
|
||||
# ==============================================================================
|
||||
# AJUDA
|
||||
# ==============================================================================
|
||||
help:
|
||||
@echo "Makefile para Shadertoy"
|
||||
@echo "Comandos disponibles:"
|
||||
@echo " windows - Compilar para Windows"
|
||||
@echo " windows_debug - Compilar debug para Windows"
|
||||
@echo " windows_release - Crear release completo para Windows"
|
||||
@echo " linux - Compilar para Linux"
|
||||
@echo " linux_debug - Compilar debug para Linux"
|
||||
@echo " linux_release - Crear release completo para Linux"
|
||||
@echo " macos - Compilar para macOS"
|
||||
@echo " macos_debug - Compilar debug para macOS"
|
||||
@echo " macos_release - Crear release completo para macOS"
|
||||
@echo " show_version - Mostrar version actual ($(VERSION))"
|
||||
@echo " help - Mostrar esta ayuda"
|
||||
|
||||
.PHONY: windows windows_debug windows_release macos macos_debug macos_release linux linux_debug linux_release show_version help
|
||||
|
||||
FORCE:
|
||||
@echo "Makefile per a $(PROJECT)"
|
||||
@echo ""
|
||||
@echo " make Compilar Release (cmake)"
|
||||
@echo " make debug Compilar Debug (cmake)"
|
||||
@echo " make release Compilar + empaquetar per a distribució a $(DIST_DIR)/"
|
||||
@echo " make clean Esborrar $(BUILDDIR)/ i $(DIST_DIR)/"
|
||||
@echo ""
|
||||
@echo " Versió actual: $(VERSION)"
|
||||
|
||||
Reference in New Issue
Block a user