Actualizado Makefile para crear releases. Ejecutable pasa a estar en la raíz
This commit is contained in:
123
Makefile
123
Makefile
@@ -1,19 +1,118 @@
|
||||
executable = coffee_crisis
|
||||
source = source/*.cpp source/common/*.cpp
|
||||
appName = Coffee Crisis
|
||||
releaseFolder = cc_release
|
||||
version = v2.1b
|
||||
|
||||
windows:
|
||||
@echo off
|
||||
if not exist bin\ (mkdir bin)
|
||||
g++ $(source) -std=c++11 -Wall -O2 -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o bin/$(executable).exe
|
||||
strip -s -R .comment -R .gnu.version bin/$(executable).exe --strip-unneeded
|
||||
powershell if (Test-Path data\config\config.bin) {Remove-Item data\config\config.bin -Recurse -Force}
|
||||
powershell if (Test-Path data\config\score.bin) {Remove-Item data\config\score.bin -Recurse -Force}
|
||||
g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -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
|
||||
|
||||
windows_release:
|
||||
@echo off
|
||||
|
||||
# Remove data
|
||||
powershell if (Test-Path data\config\config.bin) {Remove-Item data\config\config.bin -Recurse -Force}
|
||||
powershell if (Test-Path data\config\score.bin) {Remove-Item data\config\score.bin -Recurse -Force}
|
||||
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force}
|
||||
|
||||
# Create folders
|
||||
powershell if (-not (Test-Path $(releaseFolder))) {New-Item $(releaseFolder) -ItemType Directory}
|
||||
|
||||
# Copy data
|
||||
powershell Copy-Item -Path "data" -Destination "$(releaseFolder)" -recurse -Force
|
||||
powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "release/SDL2.dll" -Destination "$(releaseFolder)"
|
||||
|
||||
# Build
|
||||
g++ $(source) -D RELEASE -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -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
|
||||
|
||||
# Create ZIP
|
||||
powershell if (Test-Path $(executable)_win_$(version).zip) {Remove-Item $(executable)_win_$(version).zip}
|
||||
powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(executable)_win_$(version).zip
|
||||
|
||||
# Remove folder
|
||||
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force}
|
||||
|
||||
macos:
|
||||
mkdir -p bin
|
||||
g++ $(source) -std=c++11 -Wall -O2 -lSDL2 -ffunction-sections -fdata-sections -o bin/$(executable)_macos
|
||||
rm -f data/config/config.bin
|
||||
rm -f data/config/score.bin
|
||||
clang++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o $(executable)_macos -target arm64-apple-macos11
|
||||
|
||||
macos_release:
|
||||
# Remove data
|
||||
rm -f data/config/config.bin
|
||||
rm -f data/config/score.bin
|
||||
rm -rdf "$(releaseFolder)"
|
||||
|
||||
# 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 folders
|
||||
cp -R data "$(releaseFolder)/$(appName).app/Contents/Resources"
|
||||
cp -R /Library/Frameworks/SDL2.framework "$(releaseFolder)/$(appName).app/Contents/Frameworks"
|
||||
cp -R /Library/Frameworks/SDL2.framework Frameworks
|
||||
|
||||
# Copy files
|
||||
cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources"
|
||||
cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents"
|
||||
|
||||
# Build INTEL
|
||||
clang++ $(source) -D RELEASE -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
|
||||
|
||||
# Build INTEL DMG
|
||||
rm -f "$(executable)_macos_intel_$(version).dmg"
|
||||
hdiutil create tmp.dmg -ov -volname "$(appName)" -fs HFS+ -srcfolder "$(releaseFolder)"
|
||||
hdiutil convert tmp.dmg -format UDZO -o "$(executable)_macos_intel_$(version).dmg"
|
||||
rm tmp.dmg
|
||||
|
||||
# Build APPLE SILICON
|
||||
clang++ $(source) -D RELEASE -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11
|
||||
|
||||
# Build APPLE SILICON DMG
|
||||
rm -f "$(executable)_macos_apple_silicon_$(version).dmg"
|
||||
hdiutil create tmp.dmg -ov -volname "$(appName)" -fs HFS+ -srcfolder "$(releaseFolder)"
|
||||
hdiutil convert tmp.dmg -format UDZO -o "$(executable)_macos_apple_silicon_$(version).dmg"
|
||||
rm tmp.dmg
|
||||
|
||||
# Remove data
|
||||
rm -rdf Frameworks
|
||||
rm -rdf "$(releaseFolder)"
|
||||
|
||||
linux:
|
||||
mkdir -p bin
|
||||
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux
|
||||
strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded
|
||||
opendingux:
|
||||
mkdir -p bin
|
||||
/opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc -D GCWZERO -O2 -std=c++11 -I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL2 -D_GNU_SOURCE=1 -D_REENTRANT -lSDL2 -lSDL2_mixer -lstdc++ source/*.cpp -o bin/$(executable)_opendingux
|
||||
/opt/gcw0-toolchain/usr/bin/mksquashfs ./default.gcw0.desktop ./icon.png ./bin ./data ./media coffee_crisis.opk -all-root -noappend -no-exports -no-xattrs
|
||||
rm -f data/config/config.bin
|
||||
rm -f data/config/score.bin
|
||||
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(executable)_linux
|
||||
strip -s -R .comment -R .gnu.version $(executable)_linux --strip-unneeded
|
||||
|
||||
linux_release:
|
||||
# Remove data
|
||||
rm -f data/config/config.bin
|
||||
rm -f data/config/score.bin
|
||||
rm -rdf $(releaseFolder)
|
||||
|
||||
# Create folders
|
||||
mkdir -p $(releaseFolder)
|
||||
|
||||
# Copy data
|
||||
cp -R data $(releaseFolder)
|
||||
cp LICENSE $(releaseFolder)
|
||||
cp README.md $(releaseFolder)
|
||||
|
||||
# Build
|
||||
g++ $(source) -D RELEASE -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(releaseFolder)/$(executable)
|
||||
strip -s -R .comment -R .gnu.version $(releaseFolder)/$(executable) --strip-unneeded
|
||||
|
||||
# Pack files
|
||||
cd $(releaseFolder) && tar -czvf ../$(executable)_linux_$(version).tar.gz *
|
||||
|
||||
# Remove data
|
||||
rm -rdf $(releaseFolder)
|
||||
Reference in New Issue
Block a user