Backport 2021 SRB2 makefile overhaul

This is a squashed commit of the following commits from
upstream:

James R <justsomejames2@gmail.com> on 2021-05-01
Commit 44d217807f71d15bd7ca69dad226458e7060ccab
> Collect makefiles

James R <justsomejames2@gmail.com> on 2021-05-04
Commit f637e28d0c1877c44acd7b01f7130625d5ea4099
> Remove bin, objs and dep directories

James R <justsomejames2@gmail.com> on 2021-05-02
Commit b31056c7d977fe3c2a5e0637589fd9521f1f6c04
> Rewrite Makefile to be modular as well as more automated
>
> Some key points for programmers:
> - Source code files are mostly listed in a 'Sourcefile'.
>   So you no longer directly edit the object list. There
>   can be multiple Sourcefiles and they can even live in
>   subdirectories--the directory name will be prepended to
>   every filename in the list. Of course, the Makefile
>   still needs to be edited to read from each Sourcefile.
> - Different rules are no longer required for source code
>   files that live in subdirectories (such as sdl/ or
>   hardware/). Subdirectories Just Work so go ham!
>
> In addition to those points, another important change is
> that the bin directory is no longer divided into platform
> subdirectories (Linux64, Mingw, etc). Executables now go
> directly into bin. If you use DEBUGMODE or target 64-bit,
> then subdirectories for 'debug' and '64' will be made
> though.
>
> Oh by the way, I don't think make clean actually removed
> files before on Windows. It should now. I also fixed as
> many little inconsistencies like that as I noticed.
>
> And now just an overview of the technical aspects that
> shouldn't affect anyone who doesn't REALLY care about the
> Makefile...
>
> objs and dep directories have been moved to a make
> directory. Makefile.cfg and its variants have been moved
> out of their various subdirectories to src/Makefile.d
> make distclean removes the bin and make directories
> entirely, but make clean and cleandep still only affect
> the current build target.
>
> When I say automation, I mean that a lot of copy pasting
> in the Makefile has been reduced.

James R <justsomejames2@gmail.com> on 2021-05-04
Commit 53d1cbe8264196e46911c86bc4be13d44aa35dfe
> Appveyor: update executable directory

James R <justsomejames2@gmail.com> on 2021-05-04
Commit 888073d64d1885cae0ad8b5d54bfec31e9793e0a
> Fix make clean printing header

James R <justsomejames2@gmail.com> on 2021-05-04
Commit 3d7205d4942d1e1b2627fdf5acf9d9c82437a97b
> Fix minor errors with Windows ECHO, DEL, MD
>
> - Quotes were not removed by ECHO.
> - DEL would print an error on nonexistent file.
> - MD would do this plus return a nonzero exit code.

James R <justsomejames2@gmail.com> on 2021-05-05
Commit f9813844e7f0dfa6229062b1ebd83e4e8150c120
> Update CMakeLists.txt to use Sourcefiles
>
> This establishes (near) parity of source code file lists
> between the Makefile and CMakeLists.txt
>
> To make that change I messed around CMakeLists.txt a bit.
> It now uses target_sources and target_compile_definitions.
> I also removed some MSVC stuff since we don't actually
> care about MSVC--it made things easier.
>
> CMake minimum version 3.0 -> 3.13 for target_sources.

James R <justsomejames2@gmail.com> on 2021-05-05
Commit ec8b63d6759f0c124693ea6d5a521e8d82efd566
> Makefile: remove last of unused flags

James R <justsomejames2@gmail.com> on 2021-05-07
Commit c06817d0085ee77b0027917bca91a24e60c7deba
> Makefile: fix mingw/64 swapped with 32-bit

James R <justsomejames2@gmail.com> on 2021-05-07
Commit 9e7d80c2c44199126fa451c59fca0f98d23ad14d
> Makefile: suppress DEL error

James R <justsomejames2@gmail.com> on 2021-05-07
Commit 87afa7655a71539c7cbc7db12df18c4253187fbc
> CMake: fix ASM compile
>
> - target_sources from correct directory
> - enable_language must be used in add_executable directory

James R <justsomejames2@gmail.com> on 2021-05-08
Commit 210c9419e4bddd1fe8e9be7cb66de31119fa0d68
> Ignore -Wtrigraphs

James R <justsomejames2@gmail.com> on 2021-06-16
Commit 3a044e71cc7cf6c80d9836189511c1a58c108370
> Disable EXE disassembly and compression by default
>
> NOOBJDUMP=1 and NOUPX=1 have been removed. Make 'dump'
> target to disassemble. UPX=upx to compress executable.
>
> Setting UPX used to cause it to fail. That has been fixed.

James R <justsomejames2@gmail.com> on 2021-06-16
Commit c142b3241ddb8f1ea9b5090d20dffa43a17129ab
> Makefile: alert full path of final executable
>
> With added textual contrast.

James R <justsomejames2@gmail.com> on 2021-06-16
Commit b04c79d8a7ba4ae8f888ab94d394b6714699e107
> Say 'at'

James R <justsomejames2@gmail.com> on 2021-06-21
Commit 2d7a8c3c571bcc5335437e9db074c75af00408ce
> Makefile: use shell commands to read in Sourcefile
>
> File function is not supported < Make 4.2.

James R <justsomejames2@gmail.com> on 2021-06-21
Commit d5146945a69ebf30e6fc1fbb64558e456e0b7459
> Makefile: don't automatically set WINDOWSHELL unless PATH matches Windows norms
>
> This is for MSYS2, which requires unix shell commands.

James R <justsomejames2@gmail.com> on 2021-06-22
Commit 5f4d7e3c5b013afe03ae2a441c82ad79bae7c66c
> Makefile: fail if old build directories exist
>
> After a checkout from before revision, old directories
> such as bin/Linux64 only remain if untracked files exist
> within. This may be confusing to the user. They may even
> use an outdated executable if it is one of those untracked
> files.

James R <justsomejames2@gmail.com> on 2021-06-22
Commit c3ad5de912fccfdd64c510f5684883afceaa7d36
> Makefile: let variables be defined on Make line
>
> If a variable is defined as in 'make CC=gcc-10', then that
> definition overrides anything other definition in the
> Makefile.

James R <justsomejames2@gmail.com> on 2021-06-22
Commit ed85e994a46ace07cf022b38a9abac1698a8667e
> Remove misplaced parentheses

James R <justsomejames2@gmail.com> on 2021-06-29
Commit c1ecfa306f6a0b168d4f6cbc3224ebebd4deec51
> Makefile: 'dep' not 'deps'

James R <justsomejames2@gmail.com> on 2021-06-29
Commit 6c03f9b5b3590e01773f05bc1c31cc67a2d88fc2
> fuck

James R <justsomejames2@gmail.com> on 2021-06-29
Commit abdf5c101cbe80657f210c0b90800e2c4c6f0c05
> Makefile: report SHELL

James R <justsomejames2@gmail.com> on 2021-06-29
Commit 22ab611daa17bd23225f3afeeba39147c0d0fe17
> Makefile: do not automatically set WINDOWSHELL
>
> According to this answer--
> https://stackoverflow.com/a/45952425
> --Make will always prefer a unix shell, even on Windows,
> if one can be found in Path. So we can't check PATH to
> determine if it's a Windows shell... this is just too much
> bother.

James R <justsomejames2@gmail.com> on 2021-06-29
Commit f79e0ee540564fcec5da7c0dc4006906492a7f30
> Appveyor: remove 64-bit target

James R <justsomejames2@gmail.com> on 2021-06-29
Commit faee657572f23cd6f8b68c077873e01c4278414e
> Appveyor: update for new Makefile

James R <justsomejames2@gmail.com> on 2021-06-29
Commit 44b82dea58612e6f07830647e2b08555f54a7caa
> Appveyor: remove redundant CFLAGS
>
> Also changed -Wno-error=implicit-fallthrough to
> -Wno-implicit-fallthrough. For some reason Appveyor's
> version of GCC is triggering these warnings despite the
> comments, so just shut it up.

James R <justsomejames2@gmail.com> on 2021-06-29
Commit db919accd22350c087c1fd0e5122d8e490e2f171
> Appveyor: suppress real time file names

James R <justsomejames2@gmail.com> on 2021-07-12
Commit 58fa44e8dc0444eecbe701f31872fad9fa563a6a
> CMP0115

SteelT <steeltitanium1@gmail.com> on 2021-07-16
Commit 71f905f95bd4fe62dbca87208cf71b7309f12de1
> Fix gme support being effectively disabled
>
> I found this easier than trying to adjust the makefile, as it uses the same thing to automatically generate the various NO* compile options.

James R <justsomejames2@gmail.com> on 2021-08-14
Commit 824b1ab28cdddfd1c018454a9af14dabaab49fcd
> Makefile: use full stem in dependency generation
>
> Previously took only the filename, so the directory
> component was stripped. This broke dependencies for
> basically every file.

GoldenTails <milestailsprower101n2@gmail.com> on 2021-08-28
Commit 1a8ec7975c20e1d652cbbdb7a9e366192e41c05f
> Makefile: Improve gcc detection
>
> Wasn't working for me until I fixed it.
> Turns out gcc really doesn't like giving its name out.
> Most of the time it reads argv[0].
This commit is contained in:
James R 2021-11-25 02:09:01 -08:00
parent 8109bc8e61
commit d5c08ac034
88 changed files with 1318 additions and 2411 deletions

4
.gitignore vendored
View file

@ -13,11 +13,11 @@ Win32_LIB_ASM_Release
*.dgb
*.debug
*.debug.txt
/bin/VC10/
/objs/VC10/
*.user
*.db
*.opendb
/.vs
/debian
/assets/debian
/make
/bin

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.13)
# Enable CCache early
set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache")
@ -34,12 +34,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
### Useful functions
# Prepend sources with current source directory
function(prepend_sources SOURCE_FILES)
foreach(SOURCE_FILE ${${SOURCE_FILES}})
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
endforeach()
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
# Add sources from Sourcefile
function(target_sourcefile type)
file(STRINGS Sourcefile list
REGEX "[-0-9A-Za-z_]+\.${type}")
target_sources(SRB2SDL2 PRIVATE ${list})
endfunction()
# Macro to add OSX framework

View file

@ -2,15 +2,11 @@ version: 2.0.{branch}-{build}
os: MinGW
environment:
CC: ccache
CCACHE_CC: i686-w64-mingw32-gcc
CCACHE_CC_64: x86_64-w64-mingw32-gcc
CC: i686-w64-mingw32-gcc
WINDRES: windres
# c:\mingw-w64 i686 has gcc 6.3.0, so use c:\msys64 7.3.0 instead
MINGW_SDK: c:\msys64\mingw32
# c:\msys64 x86_64 has gcc 8.2.0, so use c:\mingw-w64 7.3.0 instead
MINGW_SDK_64: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
CFLAGS: -Wall -W -Werror -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3 -Wno-tautological-compare -Wno-error=suggest-attribute=noreturn
CFLAGS: -Wno-implicit-fallthrough
NASM_ZIP: nasm-2.12.01
NASM_URL: http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip
UPX_ZIP: upx391w
@ -19,8 +15,6 @@ environment:
CCACHE_URL: http://alam.srb2.org/ccache.exe
CCACHE_COMPRESS: true
CCACHE_DIR: C:\Users\appveyor\.ccache
# Disable UPX by default. The user can override this in their Appveyor project settings
NOUPX: 1
##############################
# DEPLOYER VARIABLES
# DPL_ENABLED=1 builds installers for branch names starting with `deployer`.
@ -53,11 +47,6 @@ cache:
- C:\Users\appveyor\srb2_cache
install:
- if [%CONFIGURATION%] == [SDL64] ( set "X86_64=1" )
- if [%CONFIGURATION%] == [SDL64] ( set "CONFIGURATION=SDL" )
- if [%X86_64%] == [1] ( set "MINGW_SDK=%MINGW_SDK_64%" )
- if [%X86_64%] == [1] ( set "CCACHE_CC=%CCACHE_CC_64%" )
- if not exist "%NASM_ZIP%.zip" appveyor DownloadFile "%NASM_URL%" -FileName "%NASM_ZIP%.zip"
- 7z x -y "%NASM_ZIP%.zip" -o%TMP% >null
- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs "%TMP%\%NASM_ZIP%" "%MINGW_SDK%\bin" nasm.exe || exit 0
@ -72,39 +61,27 @@ install:
configuration:
- SDL
- SDL64
before_build:
- set "Path=%MINGW_SDK%\bin;%Path%"
- if [%X86_64%] == [1] ( x86_64-w64-mingw32-gcc --version ) else ( i686-w64-mingw32-gcc --version )
- mingw32-make --version
- if not [%X86_64%] == [1] ( nasm -v )
- nasm -v
- if not [%NOUPX%] == [1] ( upx -V )
- ccache -V
- ccache -s
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
- if defined [%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%] ( set "COMMIT=%APPVEYOR_PULL_REQUEST_HEAD_COMMIT%" ) else ( set "COMMIT=%APPVEYOR_REPO_COMMIT%" )
- cmd: git rev-parse --short %COMMIT%>%TMP%/gitshort.txt
- cmd: set /P GITSHORT=<%TMP%/gitshort.txt
# for pull requests, take the owner's name only, if this isn't the same repo of course
- set "REPO=%APPVEYOR_REPO_BRANCH%"
- if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [] ( if not [%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%] == [%APPVEYOR_REPO_NAME%] ( for /f "delims=/" %%a in ("%APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME%") do set "REPO=%%a-%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%" ) )
- set "EXENAME=EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 NOOBJDUMP=1 %NOUPX% %EXENAME%"
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1 GCC81=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" )
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"
- set "SRB2_MFLAGS=-C src NOECHOFILENAMES=1 CCACHE=1 EXENAME=srb2win-%REPO%-%GITSHORT%.exe"
build_script:
- cmd: mingw32-make.exe %SRB2_MFLAGS% clean
- cmd: mingw32-make.exe %SRB2_MFLAGS% ERRORMODE=1 -k
after_build:
- if [%X86_64%] == [1] (
set "BUILD_PATH=bin\Mingw64\Release"
) else (
set "BUILD_PATH=bin\Mingw\Release"
)
- if [%X86_64%] == [1] ( set "CONFIGURATION=%CONFIGURATION%64" )
- ccache -s
- set BUILD_ARCHIVE=%REPO%-%GITSHORT%-%CONFIGURATION%.7z
- set BUILDSARCHIVE=%REPO%-%CONFIGURATION%.7z
@ -139,3 +116,4 @@ test: off
on_finish:
#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:<ip>:<port>
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# vim: et ts=1

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1,3 +0,0 @@
/lsdlsrb2
/pnd
/*.mo

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1 +0,0 @@
/lsdlsrb2

View file

@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat

View file

@ -1,4 +0,0 @@
*.exe
*.mo
r_opengl.dll
*.bat

View file

@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll

View file

@ -1,3 +0,0 @@
/srb2sdl.exe
/srb2win.exe
/r_opengl.dll

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
bin/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
/Release
/Debug

2
bin/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
/Win32
/x64

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/.gitignore vendored
View file

@ -1,2 +0,0 @@
#All folders
*.d

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
dep/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

8
objs/.gitignore vendored
View file

@ -1,8 +0,0 @@
#All folders
SRB2.res
depend.dep
depend.ped
*.o
#VC9 folder only
/VC9/Win32
/VC9/x64

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/VC/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

2
objs/VC9/.gitignore vendored
View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,2 +0,0 @@
# DON'T REMOVE
# This keeps the folder from disappearing

View file

@ -1,269 +1,14 @@
# SRB2 Core
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
# Core sources
set(SRB2_CORE_SOURCES
am_map.c
command.c
comptime.c
console.c
d_clisrv.c
d_main.c
d_net.c
d_netcmd.c
d_netfil.c
dehacked.c
deh_soc.c
deh_lua.c
deh_tables.c
f_finale.c
f_wipe.c
filesrch.c
g_demo.c
g_game.c
g_input.c
g_splitscreen.c
font.c
hu_stuff.c
i_tcp.c
info.c
lzf.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_cond.c
m_fixed.c
m_menu.c
m_misc.c
m_perfstats.c
m_queue.c
m_random.c
md5.c
mserv.c
http-mserv.c
s_sound.c
screen.c
sounds.c
st_stuff.c
#string.c
tables.c
v_video.c
w_wad.c
y_inter.c
z_zone.c
)
target_sourcefile(c)
target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h.in)
set(SRB2_CORE_HEADERS
am_map.h
byteptr.h
command.h
console.h
d_clisrv.h
d_event.h
d_main.h
d_net.h
d_netcmd.h
d_netfil.h
d_player.h
d_think.h
d_ticcmd.h
dehacked.h
deh_soc.h
deh_lua.h
deh_tables.h
doomdata.h
doomdef.h
doomstat.h
doomtype.h
endian.h
f_finale.h
fastcmp.h
filesrch.h
g_demo.h
g_game.h
g_input.h
g_state.h
font.h
hu_stuff.h
i_joy.h
i_net.h
i_sound.h
i_system.h
i_tcp.h
i_video.h
info.h
keys.h
lzf.h
m_aatree.h
m_anigif.h
m_argv.h
m_bbox.h
m_cheat.h
m_cond.h
m_dllist.h
m_fixed.h
m_menu.h
m_misc.h
m_perfstats.h
m_queue.h
m_random.h
m_swap.h
md5.h
mserv.h
p5prof.h
s_sound.h
screen.h
sounds.h
st_stuff.h
tables.h
v_video.h
w_wad.h
y_inter.h
z_zone.h
config.h.in
)
set(SRB2_CORE_RENDER_SOURCES
r_bsp.c
r_data.c
r_draw.c
r_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.c
r_textures.c
r_patch.c
r_patchrotation.c
r_picformats.c
r_portal.c
r_bsp.h
r_data.h
r_defs.h
r_draw.h
r_local.h
r_main.h
r_plane.h
r_segs.h
r_skins.h
r_sky.h
r_splats.h
r_state.h
r_things.h
r_textures.h
r_patch.h
r_patchrotation.h
r_picformats.h
r_portal.h
)
set(SRB2_CORE_GAME_SOURCES
p_ceilng.c
p_enemy.c
p_floor.c
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_mobj.c
p_polyobj.c
p_saveg.c
p_setup.c
p_sight.c
p_slopes.c
p_spec.c
p_telept.c
p_tick.c
p_user.c
taglist.c
k_race.c
k_battle.c
k_bheap.c
k_collide.c
k_kart.c
k_pathfind.c
k_pwrlv.c
k_waypoint.c
k_color.c
k_bot.c
k_botitem.c
k_botsearch.c
k_respawn.c
k_grandprix.c
k_hud.c
p_local.h
p_maputl.h
p_mobj.h
p_polyobj.h
p_pspr.h
p_saveg.h
p_setup.h
p_slopes.h
p_spec.h
p_tick.h
taglist.h
k_race.h
k_battle.h
k_bheap.h
k_collide.h
k_kart.h
k_pathfind.h
k_pwrlv.h
k_waypoint.h
k_color.h
k_bot.h
k_respawn.h
k_grandprix.h
k_hud.h
)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
prepend_sources(SRB2_CORE_SOURCES)
prepend_sources(SRB2_CORE_HEADERS)
prepend_sources(SRB2_CORE_RENDER_SOURCES)
prepend_sources(SRB2_CORE_GAME_SOURCES)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
set(SRB2_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/vid_copy.s
)
set(SRB2_NASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/tmap_mmx.nas
${CMAKE_CURRENT_SOURCE_DIR}/tmap.nas
)
if(MSVC)
list(APPEND SRB2_NASM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tmap_vc.nas)
endif()
set(SRB2_NASM_OBJECTS
${CMAKE_CURRENT_BINARY_DIR}/tmap_mmx.obj
${CMAKE_CURRENT_BINARY_DIR}/tmap.obj
)
if(MSVC)
list(APPEND SRB2_NASM_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/tmap_vc.obj)
endif()
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
set(SRB2_ASM_SOURCES vid_copy.s)
set(SRB2_NASM_SOURCES tmap_mmx.nas tmap.nas)
### Configuration
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
@ -303,92 +48,7 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2Kart's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT, cURL).")
endif()
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_taglib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_polyobjlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
add_subdirectory(blua)
if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
@ -404,7 +64,7 @@ if(${SRB2_CONFIG_HAVE_GME})
endif()
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
else()
message(WARNING "You have specified that GME is available but it was not found.")
endif()
@ -424,7 +84,7 @@ if(${SRB2_CONFIG_HAVE_OPENMPT})
endif()
if(${OPENMPT_FOUND})
set(SRB2_HAVE_OPENMPT ON)
add_definitions(-DHAVE_OPENMPT)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
else()
message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif()
@ -447,8 +107,7 @@ if(${SRB2_CONFIG_HAVE_MIXERX})
endif()
if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
add_definitions(-DHAVE_MIXERX)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXERX)
else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif()
@ -495,7 +154,7 @@ if(${SRB2_CONFIG_HAVE_ZLIB})
endif()
if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON)
add_definitions(-DHAVE_ZLIB)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
else()
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2Kart may not compile correctly.")
endif()
@ -516,14 +175,9 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
endif()
if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON)
add_definitions(-DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE)
set(SRB2_PNG_SOURCES apng.c)
set(SRB2_PNG_HEADERS apng.h)
prepend_sources(SRB2_PNG_SOURCES)
prepend_sources(SRB2_PNG_HEADERS)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
target_sources(SRB2SDL2 PRIVATE apng.c)
else()
message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart may not compile correctly.")
endif()
@ -544,7 +198,7 @@ if(${SRB2_CONFIG_HAVE_CURL})
endif()
if(${CURL_FOUND})
set(SRB2_HAVE_CURL ON)
add_definitions(-DHAVE_CURL)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_CURL)
else()
message(WARNING "You have specified that CURL is available but it was not found. SRB2Kart may not compile correctly.")
endif()
@ -552,59 +206,19 @@ endif()
if(${SRB2_CONFIG_HAVE_THREADS})
set(SRB2_HAVE_THREADS ON)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/i_threads.h)
add_definitions(-DHAVE_THREADS)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
endif()
if(${SRB2_CONFIG_HWRENDER})
add_definitions(-DHWRENDER)
set(SRB2_HWRENDER_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
)
set (SRB2_HWRENDER_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.h
)
set(SRB2_R_OPENGL_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
)
set(SRB2_R_OPENGL_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
)
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_subdirectory(hardware)
endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
find_package(OpenGL)
if(${OPENGL_FOUND})
add_definitions(-DHWRENDER)
add_definitions(-DSTATIC_OPENGL)
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
endif()
@ -625,12 +239,16 @@ if(${SRB2_CONFIG_USEASM})
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
enable_language(ASM_NASM)
endif()
set(SRB2_USEASM ON)
add_definitions(-DUSEASM)
target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse")
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES})
else()
set(SRB2_USEASM OFF)
add_definitions(-DNONX86 -DNORUSEASM)
target_compile_definitions(SRB2SDL2 PRIVATE -DNONX86 -DNORUSEASM)
endif()
# Targets
@ -666,7 +284,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
endif()
add_definitions(-DCMAKECONFIG)
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs)
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
#add_library(SRB2Core STATIC
# ${SRB2_CORE_SOURCES}

File diff suppressed because it is too large Load diff

View file

@ -1,482 +0,0 @@
# vim: ft=make
#
# Makefile.cfg for SRB2
#
#
# GNU compiler & tools' flags
# and other things
#
# See the following variable don't start with 'GCC'. This is
# to avoid a false positive with the version detection...
SUPPORTED_GCC_VERSIONS:=\
101 102\
91 92 93\
81 82 83 84\
71 72 73 74 75\
61 62 63 64\
51 52 53 54 55\
40 41 42 43 44 45 46 47 48 49
LATEST_GCC_VERSION=10.2
# gcc or g++
ifdef PREFIX
CC=$(PREFIX)-gcc
CXX=$(PREFIX)-g++
OBJCOPY=$(PREFIX)-objcopy
OBJDUMP=$(PREFIX)-objdump
STRIP=$(PREFIX)-strip
WINDRES=$(PREFIX)-windres
else
OBJCOPY=objcopy
OBJDUMP=objdump
STRIP=strip
WINDRES=windres
endif
# because Apple screws with us on this
# need to get bintools from homebrew
ifdef MACOSX
CC=clang
CXX=clang
OBJCOPY=gobjcopy
OBJDUMP=gobjdump
endif
# Automatically set version flag, but not if one was manually set
# And don't bother if this is a clean only run
ifeq (,$(filter GCC% CLEANONLY,$(.VARIABLES)))
version:=$(shell $(CC) --version)
# check if this is in fact GCC
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
version:=$(shell $(CC) -dumpversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list, default to the latest supported
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
define line =
Your compiler version, GCC $(version), is not supported by the Makefile.
The Makefile will assume GCC $(LATEST_GCC_VERSION).))
endef
$(call print,$(line))
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
else
$(call print,Detected GCC $(version) (GCC$(v)))
GCC$(v)=1
endif
endif
endif
ifdef GCC102
GCC101=1
endif
ifdef GCC101
GCC93=1
endif
ifdef GCC93
GCC92=1
endif
ifdef GCC92
GCC91=1
endif
ifdef GCC91
GCC84=1
endif
ifdef GCC84
GCC83=1
endif
ifdef GCC83
GCC82=1
endif
ifdef GCC82
GCC81=1
endif
ifdef GCC81
GCC75=1
endif
ifdef GCC75
GCC74=1
endif
ifdef GCC74
GCC73=1
endif
ifdef GCC73
GCC72=1
endif
ifdef GCC72
GCC71=1
endif
ifdef GCC71
GCC64=1
endif
ifdef GCC64
GCC63=1
endif
ifdef GCC63
GCC62=1
endif
ifdef GCC62
GCC61=1
endif
ifdef GCC61
GCC55=1
endif
ifdef GCC55
GCC54=1
endif
ifdef GCC54
GCC53=1
endif
ifdef GCC53
GCC52=1
endif
ifdef GCC52
GCC51=1
endif
ifdef GCC51
GCC49=1
endif
ifdef GCC49
GCC48=1
endif
ifdef GCC48
GCC47=1
endif
ifdef GCC47
GCC46=1
endif
ifdef GCC46
GCC45=1
endif
ifdef GCC45
GCC44=1
endif
ifdef GCC44
GCC43=1
endif
ifdef GCC43
GCC42=1
endif
ifdef GCC42
GCC41=1
endif
ifdef GCC41
GCC40=1
VCHELP=1
endif
ifdef GCC295
GCC29=1
endif
OLDWFLAGS:=$(WFLAGS)
# -W -Wno-unused
WFLAGS=-Wall
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
WFLAGS+=-Wno-div-by-zero
endif
#WFLAGS+=-Wsystem-headers
WFLAGS+=-Wfloat-equal
#WFLAGS+=-Wtraditional
ifdef VCHELP
WFLAGS+=-Wdeclaration-after-statement
WFLAGS+=-Wno-error=declaration-after-statement
endif
WFLAGS+=-Wundef
ifndef GCC295
WFLAGS+=-Wendif-labels
endif
ifdef GCC40
WFLAGS+=-std=gnu89
endif
ifdef GCC41
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
WFLAGS+=-Wcast-qual
ifndef NOCASTALIGNWARN
WFLAGS+=-Wcast-align
endif
WFLAGS+=-Wwrite-strings
ifndef ERRORMODE
#WFLAGS+=-Wconversion
ifdef GCC43
#WFLAGS+=-Wno-sign-conversion
endif
endif
WFLAGS+=-Wsign-compare
ifdef GCC91
WFLAGS+=-Wno-error=address-of-packed-member
endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
WFLAGS+=-Wmissing-noreturn
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef GCC43
WFLAGS+=-funit-at-a-time
WFLAGS+=-Wlogical-op
endif
ifndef GCC295
WFLAGS+=-Wdisabled-optimization
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifdef NOLDWARNING
LDFLAGS+=-Wl,--as-needed
endif
ifdef ERRORMODE
WFLAGS+=-Werror
endif
WFLAGS+=$(OLDWFLAGS)
ifdef GCC43
#WFLAGS+=-Wno-error=clobbered
endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
ifdef GCC54
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
ifdef GCC71
WFLAGS+=-Wimplicit-fallthrough=4
WFLAGS+=-Wno-format-truncation
endif
ifdef GCC81
WFLAGS+=-Wno-error=format-overflow
WFLAGS+=-Wno-error=stringop-truncation
WFLAGS+=-Wno-error=stringop-overflow
WFLAGS+=-Wno-format-overflow
WFLAGS+=-Wno-stringop-truncation
WFLAGS+=-Wno-stringop-overflow
WFLAGS+=-Wno-error=multistatement-macros
endif
#indicate platform and what interface use with
ifndef LINUX
ifndef FREEBSD
ifndef CYGWIN32
ifndef MINGW
ifndef MINGW64
ifndef SDL
ifndef DUMMY
$(error No interface or platform flag defined)
endif
endif
endif
endif
endif
endif
endif
#determine the interface directory (where you put all i_*.c)
i_net_o=$(OBJDIR)/i_net.o
i_system_o=$(OBJDIR)/i_system.o
i_sound_o=$(OBJDIR)/i_sound.o
i_main_o=$(OBJDIR)/i_main.o
#set OBJDIR and BIN's starting place
OBJDIR=../objs
BIN=../bin
DEPDIR=../dep
#Nasm ASM and rm
ifdef YASM
NASM?=yasm
else
NASM?=nasm
endif
REMOVE?=rm -f
MKDIR?=mkdir -p
GZIP?=gzip
GZIP_OPTS?=-9 -f -n
GZIP_OPT2=$(GZIP_OPTS) --rsyncable
UPX?=upx
UPX_OPTS?=--best --preserve-build-id
ifndef ECHO
UPX_OPTS+=-q
endif
#Interface Setup
ifdef DUMMY
INTERFACE=dummy
OBJDIR:=$(OBJDIR)/dummy
BIN:=$(BIN)/dummy
DEPDIR:=$(DEPDIR)/dummy
else
ifdef LINUX
NASMFORMAT=elf -DLINUX
SDL=1
ifdef LINUX64
OBJDIR:=$(OBJDIR)/Linux64
BIN:=$(BIN)/Linux64
DEPDIR:=$(DEPDIR)/Linux64
else
OBJDIR:=$(OBJDIR)/Linux
BIN:=$(BIN)/Linux
DEPDIR:=$(DEPDIR)/Linux
endif
else
ifdef FREEBSD
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/FreeBSD
BIN:=$(BIN)/FreeBSD
DEPDIR:=$(DEPDIR)/Linux
else
ifdef SOLARIS
INTERFACE=sdl
NASMFORMAT=elf -DLINUX
SDL=1
OBJDIR:=$(OBJDIR)/Solaris
BIN:=$(BIN)/Solaris
DEPDIR:=$(DEPDIR)/Solaris
else
ifdef CYGWIN32
INTERFACE=sdl
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/cygwin
BIN:=$(BIN)/Cygwin
DEPDIR:=$(DEPDIR)/Cygwin
else
ifdef MINGW64
#NASMFORMAT=win64
SDL=1
OBJDIR:=$(OBJDIR)/Mingw64
BIN:=$(BIN)/Mingw64
DEPDIR:=$(DEPDIR)/Mingw64
else
ifdef MINGW
NASMFORMAT=win32
SDL=1
OBJDIR:=$(OBJDIR)/Mingw
BIN:=$(BIN)/Mingw
DEPDIR:=$(DEPDIR)/Mingw
endif
endif
endif
endif
endif
endif
endif
ifdef ARCHNAME
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
BIN:=$(BIN)/$(ARCHNAME)
DEPDIR:=$(DEPDIR)/$(ARCHNAME)
endif
OBJDUMP_OPTS?=--wide --source --line-numbers
LD=$(CC)
ifdef SDL
INTERFACE=sdl
OBJDIR:=$(OBJDIR)/SDL
DEPDIR:=$(DEPDIR)/SDL
endif
ifndef DUMMY
ifdef DEBUGMODE
OBJDIR:=$(OBJDIR)/Debug
BIN:=$(BIN)/Debug
DEPDIR:=$(DEPDIR)/Debug
else
OBJDIR:=$(OBJDIR)/Release
BIN:=$(BIN)/Release
DEPDIR:=$(DEPDIR)/Release
endif
endif

107
src/Makefile.d/detect.mk Normal file
View file

@ -0,0 +1,107 @@
#
# Detect the host system and compiler version.
#
# Previously featured:\
PANDORA\
HAIKU\
DUMMY\
DJGPPDOS\
SOLARIS\
MACOSX\
all_systems:=\
LINUX64\
MINGW64\
MINGW\
UNIX\
LINUX\
FREEBSD\
SDL\
# check for user specified system
ifeq (,$(filter $(all_systems),$(.VARIABLES)))
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
_m=Detected a Windows system,\
compiling for 32-bit MinGW SDL...)
$(call Print,$(_m))
# go for a 32-bit sdl mingw exe by default
MINGW:=1
else # if you on the *nix
system:=$(shell uname -s)
ifeq ($(system),Linux)
new_system:=LINUX
else
$(error \
Could not automatically detect your system,\
try specifying a system manually)
endif
ifeq ($(shell getconf LONG_BIT),64)
system+=64-bit
new_system:=$(new_system)64
endif
$(call Print,Detected $(system) ($(new_system))...)
$(new_system):=1
endif
endif
# This must have high to low order.
gcc_versions:=\
102 101\
93 92 91\
84 83 82 81\
75 74 73 72 71\
64 63 62 61\
55 54 53 52 51\
49 48 47 46 45 44 43 42 41 40
latest_gcc_version:=10.2
# Automatically set version flag, but not if one was
# manually set. And don't bother if this is a clean only
# run.
ifeq (,$(call Wildvar,GCC% destructive))
# can't use $(CC) --version here since that uses argv[0] to display the name
# also gcc outputs the information to stderr, so I had to do 2>&1
# this program really doesn't like identifying itself
version:=$(shell $(CC) -v 2>&1)
# check if this is in fact GCC
ifneq (,$(findstring gcc version,$(version)))
# in stark contrast to the name, gcc will give me a nicely formatted version number for free
version:=$(shell $(CC) -dumpfullversion)
# Turn version into words of major, minor
v:=$(subst ., ,$(version))
# concat. major minor
v:=$(word 1,$(v))$(word 2,$(v))
# If this version is not in the list,
# default to the latest supported
ifeq (,$(filter $(v),$(gcc_versions)))
define line =
Your compiler version, GCC $(version), \
is not supported by the Makefile.
The Makefile will assume GCC $(latest_gcc_version).
endef
$(call Print,$(line))
GCC$(subst .,,$(latest_gcc_version)):=1
else
$(call Print,Detected GCC $(version) (GCC$(v)))
GCC$(v):=1
endif
endif
endif

View file

@ -0,0 +1,76 @@
#
# Makefile for feature flags.
#
passthru_opts+=\
NONET NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
MOBJCONSISTANCY PACKETDROP ZDEBUG\
HAVE_MINIUPNPC\
# build with debugging information
ifdef DEBUGMODE
MOBJCONSISTANCY=1
PACKETDROP=1
opts+=-DPARANOIA -DRANGECHECK
endif
ifndef NOHW
opts+=-DHWRENDER
sources+=$(call List,hardware/Sourcefile)
endif
ifndef NOASM
ifndef NONX86
sources+=tmap.nas tmap_mmx.nas
opts+=-DUSEASM
endif
endif
ifndef NOMD5
sources+=md5.c
endif
ifndef NOZLIB
ifndef NOPNG
ifdef PNG_PKGCONFIG
$(eval $(call Use_pkg_config,PNG_PKGCONFIG))
else
PNG_CONFIG?=$(call Prefix,libpng-config)
$(eval $(call Configure,PNG,$(PNG_CONFIG) \
$(if $(PNG_STATIC),--static),,--ldflags))
endif
ifdef LINUX
opts+=-D_LARGFILE64_SOURCE
endif
opts+=-DHAVE_PNG
sources+=apng.c
endif
endif
ifndef NONET
ifndef NOCURL
CURLCONFIG?=curl-config
$(eval $(call Configure,CURL,$(CURLCONFIG)))
opts+=-DHAVE_CURL
endif
endif
ifdef HAVE_MINIUPNPC
libs+=-lminiupnpc
endif
# (Valgrind is a memory debugger.)
ifdef VALGRIND
VALGRIND_PKGCONFIG?=valgrind
$(eval $(call Use_pkg_config,VALGRIND))
ZDEBUG=1
opts+=-DHAVE_VALGRIND
endif
default_packages:=\
GME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\
$(foreach p,$(default_packages),\
$(eval $(call Check_pkg_config,$(p))))

40
src/Makefile.d/nix.mk Normal file
View file

@ -0,0 +1,40 @@
#
# Makefile options for unices (linux, bsd...)
#
EXENAME?=lsdl2srb2kart
opts+=-DUNIXCOMMON -DLUA_USE_POSIX
libs+=-lm
ifndef nasm_format
nasm_format:=elf -DLINUX
endif
ifndef NOHW
opts+=-I/usr/X11R6/include
libs+=-L/usr/X11R6/lib
endif
SDL=1
# In common usage.
ifdef LINUX
libs+=-lrt
passthru_opts+=NOTERMIOS
endif
# Tested by Steel, as of release 2.2.8.
ifdef FREEBSD
opts+=-I/usr/X11R6/include -DLINUX -DFREEBSD
libs+=-L/usr/X11R6/lib -lipx -lkvm
endif
# FIXME: UNTESTED
#ifdef SOLARIS
#NOIPX=1
#NOASM=1
#opts+=-I/usr/local/include -I/opt/sfw/include \
# -DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
#libs+=-L/opt/sfw/lib -lsocket -lnsl
#endif

16
src/Makefile.d/old.mk Normal file
View file

@ -0,0 +1,16 @@
#
# Warn about old build directories and offer to purge.
#
_old:=$(wildcard $(addprefix ../bin/,FreeBSD Linux \
Linux64 Mingw Mingw64 SDL dummy) ../objs ../dep)
ifdef _old
$(foreach v,$(_old),$(info $(abspath $(v))))
$(info )
$(info These directories are no longer\
required and should be removed.)
$(info You may remove them manually or\
by using 'make distclean')
$(error )
endif

View file

@ -0,0 +1,69 @@
#
# Platform specific options.
#
PKG_CONFIG?=pkg-config
ifdef WINDOWSHELL
rmrf=-2>NUL DEL /S /Q
mkdir=-2>NUL MD
cat=TYPE
else
rmrf=rm -rf
mkdir=mkdir -p
cat=cat
endif
ifdef LINUX64
LINUX=1
endif
ifdef MINGW64
MINGW=1
endif
ifdef LINUX
UNIX=1
ifdef LINUX64
NONX86=1
# LINUX64 does not imply X86_64=1;
# could mean ARM64 or Itanium
platform=linux/64
else
platform=linux
endif
else ifdef FREEBSD
UNIX=1
platform=freebsd
else ifdef SOLARIS # FIXME: UNTESTED
UNIX=1
platform=solaris
else ifdef CYGWIN32 # FIXME: UNTESTED
nasm_format=win32
platform=cygwin
else ifdef MINGW
ifdef MINGW64
NONX86=1
NOASM=1
# MINGW64 should not necessarily imply X86_64=1,
# but we make that assumption elsewhere
# Once that changes, remove this
X86_64=1
platform=mingw/64
else
platform=mingw
endif
include Makefile.d/win32.mk
endif
ifdef platform
makedir:=$(makedir)/$(platform)
endif
ifdef UNIX
include Makefile.d/nix.mk
endif
ifdef SDL
include Makefile.d/sdl.mk
endif

79
src/Makefile.d/sdl.mk Normal file
View file

@ -0,0 +1,79 @@
#
# Makefile options for SDL2 backend.
#
#
# SDL...., *looks at Alam*, THIS IS A MESS!
#
# ...a little bird flexes its muscles...
#
makedir:=$(makedir)/SDL
sources+=$(call List,sdl/Sourcefile)
opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
# FIXME: UNTESTED
#ifdef PANDORA
#include sdl/SRB2Pandora/Makefile.cfg
#endif #ifdef PANDORA
# FIXME: UNTESTED
#ifdef CYGWIN32
#include sdl/MakeCYG.cfg
#endif #ifdef CYGWIN32
ifndef NOHW
sources+=sdl/ogl_sdl.c
endif
ifdef NOMIXER
sources+=sdl/sdl_sound.c
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
ifdef HAVE_MIXERX
opts+=-DHAVE_MIXERX
libs+=-lSDL2_mixer_ext
else
libs+=-lSDL2_mixer
endif
endif
ifndef NOTHREADS
opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
$(eval $(call Use_pkg_config,SDL))
else
SDL_CONFIG?=$(call Prefix,sdl2-config)
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
$(if $(STATIC),--static-libs,--libs))
$(eval $(call Propogate_flags,SDL))
endif
# use the x86 asm code
ifndef CYGWIN32
ifndef NOASM
USEASM=1
endif
endif
ifdef MINGW
ifndef NOSDLMAIN
SDLMAIN=1
endif
endif
ifdef SDLMAIN
opts+=-DSDLMAIN
else
ifdef MINGW
opts+=-Umain
libs+=-mconsole
endif
endif

93
src/Makefile.d/util.mk Normal file
View file

@ -0,0 +1,93 @@
#
# Utility macros for the rest of the Makefiles.
#
Ifnot=$(if $(1),$(3),$(2))
Ifndef=$(call Ifnot,$($(1)),$(2),$(3))
# Match and expand a list of variables by pattern.
Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v)))
# Read a list of words from file and prepend each with the
# directory of the file.
_cat=$(shell $(cat) $(call Windows_path,$(1)))
List=$(addprefix $(dir $(1)),$(call _cat,$(1)))
# Convert path separators to backslash on Windows.
Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1))
define Propogate_flags =
opts+=$$($(1)_CFLAGS)
libs+=$$($(1)_LDFLAGS)
endef
# Set library's _CFLAGS and _LDFLAGS from some command.
# Automatically propogates the flags too.
# 1: variable prefix (e.g. CURL)
# 2: start of command (e.g. curl-config)
# --- optional ----
# 3: CFLAGS command arguments, default '--cflags'
# 4: LDFLAGS command arguments, default '--libs'
# 5: common command arguments at the end of command
define Configure =
$(1)_CFLAGS?=$$(shell $(2) $(or $(3),--cflags) $(5))
$(1)_LDFLAGS?=$$(shell $(2) $(or $(4),--libs) $(5))
$(call Propogate_flags,$(1))
endef
# Configure library with pkg-config. The package name is
# taken from a _PKGCONFIG variable.
# 1: variable prefix
#
# LIBGME_PKGCONFIG=libgme
# $(eval $(call Use_pkg_config,LIBGME))
define Use_pkg_config =
$(call Configure,$(1),$(PKG_CONFIG),,,$($(1)_PKGCONFIG))
endef
# Check disabling flag and configure package in one step
# according to delimited argument.
# (There is only one argument, but it split by slash.)
# 1/: short form library name (uppercase). This is
# prefixed with 'NO' and 'HAVE_'. E.g. NOGME, HAVE_GME
# /2: package name (e.g. libgme)
# /3: variable prefix
#
# The following example would check if NOGME is not
# defined before attempting to define LIBGME_CFLAGS and
# LIBGME_LDFLAGS as with Use_pkg_config.
#
# $(eval $(call Check_pkg_config,GME/libgme/LIBGME))
define Check_pkg_config =
_p:=$(subst /, ,$(1))
_v1:=$$(word 1,$$(_p))
_v2:=$$(or $$(word 3,$$(_p)),$$(_v1))
ifndef NO$$(_v1)
$$(_v2)_PKGCONFIG?=$$(word 2,$$(_p))
$$(eval $$(call Use_pkg_config,$$(_v2)))
opts+=-DHAVE_$$(_v1)
endif
endef
# $(call Prefix,gcc)
Prefix=$(if $(PREFIX),$(PREFIX)-)$(1)
Echo=
Echo_name=
Print=
ifndef SILENT
Echo=@echo $(1)
ifndef ECHO
ifndef NOECHOFILENAMES
Echo_name=$(call Echo,-- $(1) ...)
endif
endif
ifndef MAKE_RESTARTS
ifndef destructive
Print=$(info $(1))
endif
endif
endif
.=$(call Ifndef,ECHO,@)

181
src/Makefile.d/versions.mk Normal file
View file

@ -0,0 +1,181 @@
#
# Flags to put a sock in GCC!
#
# See the versions list in detect.mk
# This will define all version flags going backward.
# Yes, it's magic.
define _predecessor =
ifdef GCC$(firstword $(1))
GCC$(lastword $(1)):=1
endif
endef
_n:=$(words $(gcc_versions))
$(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
$(addprefix =,$(wordlist 2,$(_n),$(gcc_versions)))),\
$(and $(findstring =,$(v)),\
$(eval $(call _predecessor,$(subst =, ,$(v))))))
# -W -Wno-unused
WFLAGS:=-Wall -Wno-trigraphs
ifndef GCC295
#WFLAGS+=-Wno-packed
endif
ifndef RELAXWARNINGS
WFLAGS+=-W
#WFLAGS+=-Wno-sign-compare
ifndef GCC295
WFLAGS+=-Wno-div-by-zero
endif
#WFLAGS+=-Wsystem-headers
WFLAGS+=-Wfloat-equal
#WFLAGS+=-Wtraditional
WFLAGS+=-Wundef
ifndef GCC295
WFLAGS+=-Wendif-labels
endif
ifdef GCC40
WFLAGS+=-std=gnu89
endif
ifdef GCC41
WFLAGS+=-Wdeclaration-after-statement
WFLAGS+=-Wno-error=declaration-after-statement
WFLAGS+=-Wshadow
endif
#WFLAGS+=-Wlarger-than-%len%
WFLAGS+=-Wpointer-arith -Wbad-function-cast
ifdef GCC45
#WFLAGS+=-Wc++-compat
endif
WFLAGS+=-Wcast-qual
ifndef NOCASTALIGNWARN
WFLAGS+=-Wcast-align
endif
WFLAGS+=-Wwrite-strings
ifndef ERRORMODE
#WFLAGS+=-Wconversion
ifdef GCC43
#WFLAGS+=-Wno-sign-conversion
endif
endif
WFLAGS+=-Wsign-compare
ifdef GCC91
WFLAGS+=-Wno-error=address-of-packed-member
endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
endif
endif
#WFLAGS+=-Wstrict-prototypes
ifdef GCC40
WFLAGS+=-Wold-style-definition
endif
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
ifdef GCC40
WFLAGS+=-Wmissing-field-initializers
endif
WFLAGS+=-Wmissing-noreturn
#WFLAGS+=-Wmissing-format-attribute
#WFLAGS+=-Wno-multichar
#WFLAGS+=-Wno-deprecated-declarations
#WFLAGS+=-Wpacked
#WFLAGS+=-Wpadded
#WFLAGS+=-Wredundant-decls
WFLAGS+=-Wnested-externs
#WFLAGS+=-Wunreachable-code
WFLAGS+=-Winline
ifdef GCC43
WFLAGS+=-funit-at-a-time
WFLAGS+=-Wlogical-op
endif
ifndef GCC295
WFLAGS+=-Wdisabled-optimization
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
endif
ifdef GCC46
WFLAGS+=-Wno-suggest-attribute=noreturn
endif
ifdef NOLDWARNING
LDFLAGS+=-Wl,--as-needed
endif
ifdef ERRORMODE
WFLAGS+=-Werror
endif
ifdef GCC43
#WFLAGS+=-Wno-error=clobbered
endif
ifdef GCC44
WFLAGS+=-Wno-error=array-bounds
endif
ifdef GCC46
WFLAGS+=-Wno-error=suggest-attribute=noreturn
endif
ifdef GCC54
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
endif
ifdef GCC61
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
endif
ifdef GCC71
WFLAGS+=-Wimplicit-fallthrough=4
WFLAGS+=-Wno-format-truncation
endif
ifdef GCC81
WFLAGS+=-Wno-error=format-overflow
WFLAGS+=-Wno-error=stringop-truncation
WFLAGS+=-Wno-error=stringop-overflow
WFLAGS+=-Wno-format-overflow
WFLAGS+=-Wno-stringop-truncation
WFLAGS+=-Wno-stringop-overflow
WFLAGS+=-Wno-error=multistatement-macros
endif
ifdef NONX86
ifdef X86_64 # yeah that SEEMS contradictory
opts+=-march=nocona
endif
else
ifndef GCC29
opts+=-msse3 -mfpmath=sse
else
opts+=-mpentium
endif
endif
ifdef DEBUGMODE
ifdef GCC48
opts+=-Og
else
opts+=O0
endif
endif
ifdef VALGRIND
ifdef GCC46
WFLAGS+=-Wno-error=unused-but-set-variable
WFLAGS+=-Wno-unused-but-set-variable
endif
endif
# Lua
ifdef GCC43
ifndef GCC44
WFLAGS+=-Wno-logical-op
endif
endif

99
src/Makefile.d/win32.mk Normal file
View file

@ -0,0 +1,99 @@
#
# Mingw, if you don't know, that's Win32/Win64
#
ifndef MINGW64
EXENAME?=srb2kart.exe
else
EXENAME?=srb2kart64.exe
endif
sources+=win32/Srb2win.rc
opts+=-DSTDC_HEADERS
libs+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
nasm_format:=win32
SDL=1
ifndef NOHW
opts+=-DUSE_WGL_SWAP
endif
ifdef MINGW64
libs+=-lws2_32
else
ifdef NO_IPV6
libs+=-lwsock32
else
libs+=-lws2_32
endif
endif
ifndef NONET
ifndef MINGW64 # miniupnc is broken with MINGW64
opts+=-I../libs -DSTATIC_MINIUPNPC
libs+=-L../libs/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
endif
endif
ifndef MINGW64
32=32
x86=x86
i686=i686
else
32=64
x86=x86_64
i686=x86_64
endif
mingw:=$(i686)-w64-mingw32
define _set =
$(1)_CFLAGS?=$($(1)_opts)
$(1)_LDFLAGS?=$($(1)_libs)
endef
lib:=../libs/gme
LIBGME_opts:=-I$(lib)/include
LIBGME_libs:=-L$(lib)/win$(32) -lgme
$(eval $(call _set,LIBGME))
lib:=../libs/libopenmpt
LIBOPENMPT_opts:=-I$(lib)/inc
LIBOPENMPT_libs:=-L$(lib)/lib/$(x86)/mingw -lopenmpt
$(eval $(call _set,LIBOPENMPT))
ifndef NOMIXERX
HAVE_MIXERX=1
lib:=../libs/SDLMixerX/$(mingw)
else
lib:=../libs/SDL2_mixer/$(mingw)
endif
mixer_opts:=-I$(lib)/include/SDL2
mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL2\
$(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows
$(eval $(call _set,SDL))
lib:=../libs/zlib
ZLIB_opts:=-I$(lib)
ZLIB_libs:=-L$(lib)/win32 -lz$(32)
$(eval $(call _set,ZLIB))
ifndef PNG_CONFIG
lib:=../libs/libpng-src
PNG_opts:=-I$(lib)
PNG_libs:=-L$(lib)/projects -lpng$(32)
$(eval $(call _set,PNG))
endif
lib:=../libs/curl
CURL_opts:=-I$(lib)/include
CURL_libs:=-L$(lib)/lib$(32) -lcurl
$(eval $(call _set,CURL))

87
src/Sourcefile Normal file
View file

@ -0,0 +1,87 @@
string.c
d_main.c
d_clisrv.c
d_net.c
d_netfil.c
d_netcmd.c
dehacked.c
z_zone.c
f_finale.c
f_wipe.c
g_demo.c
g_game.c
g_input.c
am_map.c
command.c
console.c
hu_stuff.c
y_inter.c
st_stuff.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_cond.c
m_fixed.c
m_menu.c
m_misc.c
m_random.c
m_queue.c
info.c
p_ceilng.c
p_enemy.c
p_floor.c
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_mobj.c
p_polyobj.c
p_saveg.c
p_setup.c
p_sight.c
p_spec.c
p_telept.c
p_tick.c
p_user.c
p_slopes.c
tables.c
r_bsp.c
r_data.c
r_draw.c
r_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.c
r_textures.c
r_picformats.c
r_portal.c
screen.c
v_video.c
s_sound.c
sounds.c
w_wad.c
filesrch.c
mserv.c
http-mserv.c
i_tcp.c
lzf.c
vid_copy.s
b_bot.c
lua_script.c
lua_baselib.c
lua_mathlib.c
lua_hooklib.c
lua_consolelib.c
lua_infolib.c
lua_mobjlib.c
lua_playerlib.c
lua_skinlib.c
lua_thinkerlib.c
lua_maplib.c
lua_blockmaplib.c
lua_hudlib.c

1
src/blua/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
target_sourcefile(c)

View file

@ -1,53 +0,0 @@
ifdef UNIXCOMMON
LUA_CFLAGS+=-DLUA_USE_POSIX
endif
ifdef LINUX
LUA_CFLAGS+=-DLUA_USE_POSIX
endif
ifdef GCC43
ifndef GCC44
WFLAGS+=-Wno-logical-op
endif
endif
OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.o \
$(OBJDIR)/ldo.o \
$(OBJDIR)/lfunc.o \
$(OBJDIR)/linit.o \
$(OBJDIR)/liolib.o \
$(OBJDIR)/llex.o \
$(OBJDIR)/lmem.o \
$(OBJDIR)/lobject.o \
$(OBJDIR)/lstate.o \
$(OBJDIR)/lstrlib.o \
$(OBJDIR)/ltablib.o \
$(OBJDIR)/lundump.o \
$(OBJDIR)/lzio.o \
$(OBJDIR)/lauxlib.o \
$(OBJDIR)/lcode.o \
$(OBJDIR)/ldebug.o \
$(OBJDIR)/ldump.o \
$(OBJDIR)/lgc.o \
$(OBJDIR)/lopcodes.o \
$(OBJDIR)/lparser.o \
$(OBJDIR)/lstring.o \
$(OBJDIR)/ltable.o \
$(OBJDIR)/ltm.o \
$(OBJDIR)/lvm.o \
$(OBJDIR)/lua_script.o \
$(OBJDIR)/lua_baselib.o \
$(OBJDIR)/lua_mathlib.o \
$(OBJDIR)/lua_hooklib.o \
$(OBJDIR)/lua_consolelib.o \
$(OBJDIR)/lua_infolib.o \
$(OBJDIR)/lua_mobjlib.o \
$(OBJDIR)/lua_playerlib.o \
$(OBJDIR)/lua_skinlib.o \
$(OBJDIR)/lua_thinkerlib.o \
$(OBJDIR)/lua_maplib.o \
$(OBJDIR)/lua_taglib.o \
$(OBJDIR)/lua_polyobjlib.o \
$(OBJDIR)/lua_blockmaplib.o \
$(OBJDIR)/lua_hudlib.o

25
src/blua/Sourcefile Normal file
View file

@ -0,0 +1,25 @@
lapi.c
lbaselib.c
ldo.c
lfunc.c
linit.c
liolib.c
llex.c
lmem.c
lobject.c
lstate.c
lstrlib.c
ltablib.c
lundump.c
lzio.c
lauxlib.c
lcode.c
ldebug.c
ldump.c
lgc.c
lopcodes.c
lparser.c
lstring.c
ltable.c
ltm.c
lvm.c

View file

@ -0,0 +1 @@
target_sourcefile(c)

13
src/hardware/Sourcefile Normal file
View file

@ -0,0 +1,13 @@
hw_bsp.c
hw_draw.c
hw_light.c
hw_main.c
hw_clip.c
hw_md2.c
hw_cache.c
hw_md2load.c
hw_md3load.c
hw_model.c
u_list.c
hw_batching.c
r_opengl/r_opengl.c

View file

@ -21,46 +21,25 @@ if(${SRB2_CONFIG_SDL2_USEMIXER})
endif()
if(${SDL2_MIXER_FOUND})
set(SRB2_HAVE_MIXER ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
target_sources(SRB2SDL2 PRIVATE mixer_sound.c)
else()
message(WARNING "You specified that SDL2_mixer is available, but it was not found. Falling back to sdl sound.")
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
target_sources(SRB2SDL2 PRIVATE sdl_sound.c)
endif()
elseif(${MIXERX_FOUND})
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
target_sources(SRB2SDL2 PRIVATE mixer_sound.c)
else()
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
target_sources(SRB2SDL2 PRIVATE sdl_sound.c)
endif()
set(SRB2_SDL2_SOURCES
dosstr.c
endtxt.c
hwsym_sdl.c
i_main.c
i_net.c
i_system.c
i_ttf.c
i_video.c
#IMG_xpm.c
ogl_sdl.c
target_sourcefile(c)
${SRB2_SDL2_SOUNDIMPL}
)
set(SRB2_SDL2_HEADERS
endtxt.h
hwsym_sdl.h
i_ttf.h
ogl_sdl.h
sdlmain.h
)
target_sources(SRB2SDL2 PRIVATE ogl_sdl.c)
if(${SRB2_CONFIG_HAVE_THREADS})
set(SRB2_SDL2_SOURCES ${SRB2_SDL2_SOURCES} i_threads.c)
target_sources(SRB2SDL2 PRIVATE i_threads.c)
endif()
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
# Dependency
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(SDL2_FOUND ON)
@ -76,83 +55,29 @@ else()
endif()
if(${SDL2_FOUND})
set(SRB2_SDL2_TOTAL_SOURCES
${SRB2_CORE_SOURCES}
${SRB2_CORE_HEADERS}
${SRB2_DISCORDRPC_SOURCES}
${SRB2_DISCORDRPC_HEADERS}
${SRB2_PNG_SOURCES}
${SRB2_PNG_HEADERS}
${SRB2_CORE_RENDER_SOURCES}
${SRB2_CORE_GAME_SOURCES}
${SRB2_LUA_SOURCES}
${SRB2_LUA_HEADERS}
${SRB2_BLUA_SOURCES}
${SRB2_BLUA_HEADERS}
${SRB2_SDL2_SOURCES}
${SRB2_SDL2_HEADERS}
)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${SRB2_CONFIG_HWRENDER})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${SRB2_HWRENDER_SOURCES}
${SRB2_HWRENDER_HEADERS}
${SRB2_R_OPENGL_SOURCES}
${SRB2_R_OPENGL_HEADERS}
)
source_group("Hardware" FILES ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS})
source_group("Hardware\\OpenGL Renderer" FILES ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS})
endif()
if(${SRB2_USEASM})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${SRB2_NASM_SOURCES}
)
if(MSVC)
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${SRB2_NASM_OBJECTS}
)
set_source_files_properties(${SRB2_NASM_OBJECTS} PROPERTIES GENERATED ON)
else()
list(APPEND SRB2_SDL2_TOTAL_SOURCES ${SRB2_ASM_SOURCES})
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES LANGUAGE C)
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
endif()
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES LANGUAGE C)
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
endif()
if(${CMAKE_SYSTEM} MATCHES Windows)
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${CMAKE_SOURCE_DIR}/src/win32/win_dbg.c
${CMAKE_SOURCE_DIR}/src/win32/Srb2win.rc
)
target_sources(SRB2SDL2 PRIVATE
../win32/win_dbg.c
../win32/Srb2win.rc)
endif()
if(${CMAKE_SYSTEM} MATCHES Darwin)
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(SRB2_SDL2_MAC_SOURCES
target_sources(SRB2SDL2 PRIVATE
macosx/mac_alert.c
macosx/mac_alert.h
macosx/mac_resources.c
macosx/mac_resources.h
macosx/Srb2mac.icns
)
source_group("Interface Code\\OSX Compatibility" FILES ${SRB2_SDL2_MAC_SOURCES})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} ${SRB2_SDL2_MAC_SOURCES})
endif()
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
if(${CMAKE_SYSTEM} MATCHES Windows)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2win)
elseif(${CMAKE_SYSTEM} MATCHES Linux)
@ -211,18 +136,6 @@ if(${SDL2_FOUND})
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_NASM_OBJECT_FORMAT})
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_NASM)
endif()
if(MSVC)
# using assembler with msvc doesn't work, must do it manually
foreach(ASMFILE ${SRB2_NASM_SOURCES})
get_filename_component(ASMFILE_NAME ${ASMFILE} NAME_WE)
set(ASMFILE_NAME ${ASMFILE_NAME}.obj)
add_custom_command(TARGET SRB2SDL2 PRE_LINK
COMMAND ${ASM_ASSEMBLER_TEMP} ARGS -f ${ASM_ASSEMBLER_OBJFORMAT} -o ${CMAKE_CURRENT_BINARY_DIR}/${ASMFILE_NAME} ${ASMFILE}
COMMENT "assemble ${ASMFILE_NAME}."
)
endforeach()
endif()
endif()
set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION})
@ -236,31 +149,6 @@ if(${SDL2_FOUND})
)
endif()
if(MSVC)
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(SDL2_MAIN_FOUND ON)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2main")
else() # 32-bit
set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2main")
endif()
else()
find_package(SDL2_MAIN REQUIRED)
endif()
target_link_libraries(SRB2SDL2 PRIVATE
${SDL2_MAIN_LIBRARIES}
)
target_compile_options(SRB2SDL2 PRIVATE
/Umain
/D_CRT_SECURE_NO_WARNINGS # something about string functions.
/D_CRT_NONSTDC_NO_DEPRECATE
/DSDLMAIN
/D_WINSOCK_DEPRECATED_NO_WARNINGS # Don't care
)
endif()
target_include_directories(SRB2SDL2 PRIVATE
${SDL2_INCLUDE_DIRS}
${SDL2_MIXER_INCLUDE_DIRS}

View file

@ -1,74 +0,0 @@
#
# sdl/makeNIX.cfg for SRB2/?nix
#
#Valgrind support
ifdef VALGRIND
VALGRIND_PKGCONFIG?=valgrind
VALGRIND_CFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --cflags)
VALGRIND_LDFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --libs)
ZDEBUG=1
LIBS+=$(VALGRIND_LDFLAGS)
ifdef GCC46
WFLAGS+=-Wno-error=unused-but-set-variable
WFLAGS+=-Wno-unused-but-set-variable
endif
endif
#
#here is GNU/Linux and other
#
OPTS=-DUNIXCOMMON
#LDFLAGS = -L/usr/local/lib
LIBS=-lm
ifdef LINUX
LIBS+=-lrt
ifdef NOTERMIOS
OPTS+=-DNOTERMIOS
endif
endif
ifdef LINUX64
OPTS+=-DLINUX64
endif
#
#here is Solaris
#
ifdef SOLARIS
NOIPX=1
NOASM=1
OPTS+=-DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
OPTS+=-I/usr/local/include -I/opt/sfw/include
LDFLAGS+=-L/opt/sfw/lib
LIBS+=-lsocket -lnsl
endif
#
#here is FreeBSD
#
ifdef FREEBSD
OPTS+=-DLINUX -DFREEBSD -I/usr/X11R6/include
SDL_CONFIG?=sdl11-config
LDFLAGS+=-L/usr/X11R6/lib
LIBS+=-lipx -lkvm
endif
#
#here is Mac OS X
#
ifdef MACOSX
OBJS+=$(OBJDIR)/mac_resources.o
OBJS+=$(OBJDIR)/mac_alert.o
LIBS+=-framework CoreFoundation
endif
ifndef NOHW
OPTS+=-I/usr/X11R6/include
LDFLAGS+=-L/usr/X11R6/lib
endif
# name of the exefile
EXENAME?=lsdl2srb2kart

View file

@ -1,125 +0,0 @@
#
# sdl/makefile.cfg for SRB2/SDL
#
#
#SDL...., *looks at Alam*, THIS IS A MESS!
#
ifdef UNIXCOMMON
include sdl/MakeNIX.cfg
endif
ifdef PANDORA
include sdl/SRB2Pandora/Makefile.cfg
endif #ifdef PANDORA
ifdef CYGWIN32
include sdl/MakeCYG.cfg
endif #ifdef CYGWIN32
ifdef SDL_PKGCONFIG
SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
else
ifdef PREFIX
SDL_CONFIG?=$(PREFIX)-sdl2-config
else
SDL_CONFIG?=sdl2-config
endif
ifdef STATIC
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --static-libs)
else
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --libs)
endif
endif
#use the x86 asm code
ifndef CYGWIN32
ifndef NOASM
USEASM=1
endif
endif
OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
ifndef NOHW
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
endif
ifdef NOMIXER
i_sound_o=$(OBJDIR)/sdl_sound.o
else
i_sound_o=$(OBJDIR)/mixer_sound.o
OPTS+=-DHAVE_MIXER
ifdef HAVE_MIXERX
OPTS+=-DHAVE_MIXERX
SDL_LDFLAGS+=-lSDL2_mixer_ext
else
SDL_LDFLAGS+=-lSDL2_mixer
endif
endif
ifndef NOTHREADS
OPTS+=-DHAVE_THREADS
OBJS+=$(OBJDIR)/i_threads.o
endif
ifdef SDL_TTF
OPTS+=-DHAVE_TTF
SDL_LDFLAGS+=-lSDL2_ttf -lfreetype -lz
OBJS+=$(OBJDIR)/i_ttf.o
endif
ifdef SDL_IMAGE
OPTS+=-DHAVE_IMAGE
SDL_LDFLAGS+=-lSDL2_image
endif
ifdef SDL_NET
OPTS+=-DHAVE_SDLNET
SDL_LDFLAGS+=-lSDL2_net
endif
ifdef MINGW
ifndef NOSDLMAIN
SDLMAIN=1
endif
endif
ifdef SDLMAIN
OPTS+=-DSDLMAIN
else
ifdef MINGW
SDL_CFLAGS+=-Umain
SDL_LDFLAGS+=-mconsole
endif
endif
ifndef NOHW
ifdef OPENAL
ifdef MINGW
LIBS:=-lopenal32 $(LIBS)
else
LIBS:=-lopenal $(LIBS)
endif
else
ifdef MINGW
ifdef DS3D
LIBS:=-ldsound -luuid $(LIBS)
endif
endif
endif
endif
CFLAGS+=$(SDL_CFLAGS)
LIBS:=$(SDL_LDFLAGS) $(LIBS)
ifdef STATIC
LIBS+=$(shell $(SDL_CONFIG) --static-libs)
endif

7
src/sdl/Sourcefile Normal file
View file

@ -0,0 +1,7 @@
i_net.c
i_system.c
i_main.c
i_video.c
dosstr.c
endtxt.c
hwsym_sdl.c

View file

@ -9,7 +9,7 @@
/// \file
/// \brief SDL Mixer interface for sound
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
#ifdef HAVE_ZLIB
#ifndef _MSC_VER
#ifndef _LARGEFILE64_SOURCE
@ -27,7 +27,7 @@
#include <zlib.h>
#endif // HAVE_ZLIB
#endif // HAVE_LIBGME
#endif // HAVE_GME
#include "../doomdef.h"
#include "../doomstat.h" // menuactive
@ -79,11 +79,11 @@ write netcode into the sound code, OKAY?
#define MUS_MODPLUG MUS_MODPLUG_UNUSED
#endif
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
#include "gme/gme.h"
#define GME_TREBLE 5.0f
#define GME_BASS 1.0f
#endif // HAVE_LIBGME
#endif // HAVE_GME
static UINT16 BUFFERSIZE = 2048;
static UINT16 SAMPLERATE = 44100;
@ -123,7 +123,7 @@ static INT32 fading_id;
static void (*fading_callback)(void);
static boolean fading_nocleanup;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
static Music_Emu *gme;
static UINT16 current_track;
#endif
@ -157,7 +157,7 @@ static void var_cleanup(void)
internal_volume = 100;
}
#if defined (HAVE_LIBGME) && defined (HAVE_ZLIB)
#if defined (HAVE_GME) && defined (HAVE_ZLIB)
static const char* get_zlib_error(int zErr)
{
switch (zErr)
@ -250,7 +250,7 @@ void I_ShutdownSound(void)
SDL_QuitSubSystem(SDL_INIT_AUDIO);
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
gme_delete(gme);
#endif
@ -394,7 +394,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
void *lump;
Mix_Chunk *chunk;
SDL_RWops *rw;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
Music_Emu *emu;
gme_info_t *info;
#endif
@ -414,7 +414,7 @@ void *I_GetSfx(sfxinfo_t *sfx)
}
// Not a doom sound? Try something else.
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
// VGZ format
if (((UINT8 *)lump)[0] == 0x1F
&& ((UINT8 *)lump)[1] == 0x8B)
@ -700,7 +700,7 @@ static UINT32 music_fade(UINT32 interval, void *param)
}
}
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
static void mix_gme(void *udata, Uint8 *stream, int len)
{
int i;
@ -760,7 +760,7 @@ void I_ShutdownMusic(void)
musictype_t I_SongType(void)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
return MU_GME;
else
@ -791,7 +791,7 @@ musictype_t I_SongType(void)
boolean I_SongPlaying(void)
{
return (
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
(I_SongType() == MU_GME && gme) ||
#endif
#ifdef HAVE_OPENMPT
@ -814,7 +814,7 @@ boolean I_SetSongSpeed(float speed)
{
if (speed > 250.0f)
speed = 250.0f; //limit speed up to 250x
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
SDL_LockAudio();
@ -856,7 +856,7 @@ UINT32 I_GetSongLength(void)
{
INT32 length;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
gme_info_t *info;
@ -926,7 +926,7 @@ boolean I_SetSongLoopPoint(UINT32 looppoint)
UINT32 I_GetSongLoopPoint(void)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
INT32 looppoint;
@ -955,7 +955,7 @@ UINT32 I_GetSongLoopPoint(void)
boolean I_SetSongPosition(UINT32 position)
{
UINT32 length;
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
// this is unstable, so fail silently
@ -1020,7 +1020,7 @@ boolean I_SetSongPosition(UINT32 position)
UINT32 I_GetSongPosition(void)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
INT32 position = gme_tell(gme);
@ -1105,7 +1105,7 @@ boolean I_LoadSong(char *data, size_t len)
SDL_RWops *rw;
if (music
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
|| gme
#endif
#ifdef HAVE_OPENMPT
@ -1117,7 +1117,7 @@ boolean I_LoadSong(char *data, size_t len)
// always do this whether or not a music already exists
var_cleanup();
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if ((UINT8)data[0] == 0x1F
&& (UINT8)data[1] == 0x8B)
{
@ -1244,7 +1244,7 @@ void I_UnloadSong(void)
{
I_StopSong();
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
gme_delete(gme);
@ -1267,7 +1267,7 @@ void I_UnloadSong(void)
boolean I_PlaySong(boolean looping)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
@ -1333,7 +1333,7 @@ void I_StopSong(void)
if (!fading_nocleanup)
I_StopFadingSong();
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
if (gme)
{
Mix_HookMusic(NULL, NULL);
@ -1395,7 +1395,7 @@ void I_SetMusicVolume(int volume)
boolean I_SetSongTrack(int track)
{
#ifdef HAVE_LIBGME
#ifdef HAVE_GME
// If the specified track is within the number of tracks playing, then change it
if (gme)
{

View file

@ -1,161 +0,0 @@
#
# win32/Makefile.cfg for SRB2/Minwgw
#
#
#Mingw, if you don't know, that's Win32/Win64
#
ifdef MINGW64
HAVE_LIBGME=1
LIBGME_CFLAGS=-I../libs/gme/include
LIBGME_LDFLAGS=-L../libs/gme/win64 -lgme
ifdef HAVE_OPENMPT
LIBOPENMPT_CFLAGS?=-I../libs/libopenmpt/inc
LIBOPENMPT_LDFLAGS?=-L../libs/libopenmpt/lib/x86_64/mingw -lopenmpt
endif
ifndef NOMIXERX
HAVE_MIXERX=1
SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDLMixerX/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main
SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDLMixerX/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
else
SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main
SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDL2_mixer/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
endif
else
HAVE_LIBGME=1
LIBGME_CFLAGS=-I../libs/gme/include
LIBGME_LDFLAGS=-L../libs/gme/win32 -lgme
ifdef HAVE_OPENMPT
LIBOPENMPT_CFLAGS?=-I../libs/libopenmpt/inc
LIBOPENMPT_LDFLAGS?=-L../libs/libopenmpt/lib/x86/mingw -lopenmpt
endif
ifndef NOMIXERX
HAVE_MIXERX=1
SDL_CFLAGS?=-I../libs/SDL2/i686-w64-mingw32/include/SDL2 -I../libs/SDLMixerX/i686-w64-mingw32/include/SDL2 -Dmain=SDL_main
SDL_LDFLAGS?=-L../libs/SDL2/i686-w64-mingw32/lib -L../libs/SDLMixerX/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
else
SDL_CFLAGS?=-I../libs/SDL2/i686-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/i686-w64-mingw32/include/SDL2 -Dmain=SDL_main
SDL_LDFLAGS?=-L../libs/SDL2/i686-w64-mingw32/lib -L../libs/SDL2_mixer/i686-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
endif
endif
ifndef NOASM
USEASM=1
endif
ifndef NONET
ifndef MINGW64 #miniupnc is broken with MINGW64
HAVE_MINIUPNPC=1
endif
endif
ifndef NO_DISCORDRPC
HAVE_DISCORDRPC=1
endif
OPTS=-DSTDC_HEADERS
ifndef GCC44
#OPTS+=-mms-bitfields
endif
LIBS+=-ladvapi32 -lkernel32 -lmsvcrt -luser32
ifdef MINGW64
LIBS+=-lws2_32
else
ifdef NO_IPV6
LIBS+=-lwsock32
else
LIBS+=-lws2_32
endif
endif
ifndef MINGW64
CPPFLAGS+=-I../libs/drmingw/include
LDFLAGS+=-L../libs/drmingw/lib/win32
LIBS+=-lmgwhelp -lexchndl
endif
# name of the exefile
EXENAME?=srb2kart.exe
ifdef SDL
i_system_o+=$(OBJDIR)/SRB2.res
#i_main_o+=$(OBJDIR)/win_dbg.o
ifndef NOHW
OPTS+=-DUSE_WGL_SWAP
endif
endif
ZLIB_CFLAGS?=-I../libs/zlib
ifdef MINGW64
ZLIB_LDFLAGS?=-L../libs/zlib/win32 -lz64
else
ZLIB_LDFLAGS?=-L../libs/zlib/win32 -lz32
endif
ifndef NOPNG
ifndef PNG_CONFIG
PNG_CFLAGS?=-I../libs/libpng-src
ifdef MINGW64
PNG_LDFLAGS?=-L../libs/libpng-src/projects -lpng64
else
PNG_LDFLAGS?=-L../libs/libpng-src/projects -lpng32
endif #MINGW64
endif #PNG_CONFIG
endif #NOPNG
ifdef GETTEXT
ifndef CCBS
MSGFMT?=../libs/gettext/bin32/msgfmt.exe
endif
ifdef MINGW64
CPPFLAGS+=-I../libs/gettext/include64
LDFLAGS+=-L../libs/gettext/lib64
LIBS+=-lmingwex
else
CPPFLAGS+=-I../libs/gettext/include32
LDFLAGS+=-L../libs/gettext/lib32
STATIC_GETTEXT=1
endif #MINGW64
ifdef STATIC_GETTEXT
LIBS+=-lasprintf -lintl
else
LIBS+=-lintl.dll
endif #STATIC_GETTEXT
endif #GETTEXT
ifdef HAVE_MINIUPNPC
CPPFLAGS+=-I../libs/ -DSTATIC_MINIUPNPC
ifdef MINGW64
LDFLAGS+=-L../libs/miniupnpc/mingw64
else
LDFLAGS+=-L../libs/miniupnpc/mingw32
endif #MINGW64
endif
ifndef NOCURL
CURL_CFLAGS+=-I../libs/curl/include
ifdef MINGW64
CURL_LDFLAGS+=-L../libs/curl/lib64 -lcurl
else
CURL_LDFLAGS+=-L../libs/curl/lib32 -lcurl
endif #MINGW64
endif
ifdef HAVE_DISCORDRPC
ifdef MINGW64
CPPFLAGS+=-I../libs/discord-rpc/win64-dynamic/include
LDFLAGS+=-L../libs/discord-rpc/win64-dynamic/lib
else
CPPFLAGS+=-I../libs/discord-rpc/win32-dynamic/include
LDFLAGS+=-L../libs/discord-rpc/win32-dynamic/lib
endif
LIBS+=-ldiscord-rpc
endif
ifndef MINGW64
LDFLAGS+=-Wl,--large-address-aware
endif