Source code compiling/Makefiles/Compiling flags
This is a list of flags that can be added when using the Makefiles method of compiling SRB2's source code, as of v2.2.8.
If it is appropriate to do so, these can be added as environment variables for your system, allowing you to omit the flags from the mingw32-make
or make
command to compile SRB2 with.
Platforms and interfaces
- See also: Ports
These determine the platform or interface that SRB2's source code is compiled for. If none of these are given, by default SRB2 will be compiled for DOS using DJGPP, and the compiler will output srb2w16.exe
to bin/Dos
(object files will be sent to objs/djgppdos
).
Note: List may include flags for ports that can no longer be compiled properly.
Main
Name | Description | Default exe name | Output directory | Object file directory | Notes |
---|---|---|---|---|---|
MINGW
|
Compiles for Windows 32-bit with MinGW | srb2dd.exe (or srb2win.exe if compiling with SDL )
|
bin/Mingw
|
objs/Mingw (or objs/Mingw/SDL/ if compiling with SDL )
|
The following are also turned on:
|
MINGW64
|
Compiles for Windows 64-bit with MinGW | srb2dd.exe (or srb2win.exe if compiling with SDL )
|
bin/Mingw64
|
objs/Mingw64 (or objs/Mingw64/SDL if compiling with SDL )
|
The following are also turned on:
|
LINUX
|
Compiles for i686 Linux | lsdl2srb2
|
bin/Linux
|
objs/Linux
|
The following are also turned on:
|
LINUX64
|
Compiles for 64-bit Linux (x86_64 or Itanium) | lsdl2srb2
|
bin/Linux64
|
objs/Linux64
|
The following are also turned on:
|
FREEBSD
|
Compiles for FreeBSD | lsdl2srb2
|
bin/FreeBSD
|
objs/FreeBSD
|
The following are also turned on:
|
SOLARIS
|
Compiles for Solaris | lsdl2srb2
|
bin/Solaris
|
objs/Solaris
|
The following are also turned on:
|
MACOSX
|
Compiles for Mac OS X. This currently builds only a binary of SRB2, not a Mac app. | lsdl2srb2
|
bin/SDL
|
objs/SDL
|
Recommended build instructions:
make -C src MACOSX=1 NONX86=1 SDL=1 The following are also turned on:
|
DJGPPDOS
|
Compiles for DOS using DJGPP | srb2w16.exe
|
bin/Dos
|
objs/djgppdos
|
This is the default option selected if not compiling for any of the other platforms/interfaces |
UNIX
|
Compiles for Unix | lsdl2srb2
|
bin/SDL
|
objs/SDL
|
The SDL flag should also be turned on when using this.[confirm? – discuss]
The following are also turned on:
|
HAIKU
|
Compiles for Haiku | bin/SDL
|
objs/SDL
|
The following are also turned on:
| |
CYGWIN32
|
Compiles for Cygwin 32-bit | lsdl2srb2.exe
|
bin/cygwin
|
objs/cygwin
|
The following are also turned on:
|
DUMMY
|
Compiles with dummy interface code | srb2dummy.exe
|
bin/dummy
|
objs/dummy
|
The following are also turned on:
|
Console ports
It is currently unknown if any of these can compile properly or even function properly as of 2.2. Exe names and directories supplied within parentheses are the intended settings, but are suspected not to be set by the compiler (due to the state of compiling for the corresponding ports).
Name | Description | Default exe name | Output directory | Object file directory | Notes |
---|---|---|---|---|---|
PANDORA
|
Cross-compiles for Pandora on Linux | srb2.pnd
|
bin/pnd
|
N/A [confirm? – discuss] | The following are also turned on:
|
Non-specific
These are not to be used on their own, but in combination with any of the above if needed.
Name | Description |
---|---|
SDL
|
Compiles with SDL (automatically turned on by HAIKU , LINUX , FREEBSD , SOLARIS and CYGWIN32 ) Outputs to the /SDL sub-directory of the bin directory for the port being compiled for, e.g. bin/Mingw/SDL
Builds that need SDL will also be compiled with the files in |
UNIXCOMMON
|
Compiles with code shared by Unix and Unix-like OSes (automatically turned on by UNIX , LINUX , SOLARIS , FREEBSD and MACOSX )
|
Compiler options
These flags toggle on/off various options related to the compiling process itself, including detection of coding errors during compiling.
Miscellaneous
Name | Description |
---|---|
ECHO
|
Gives you detailed information during the compiling process |
STATIC
|
On systems that support dynamic linking, this prevents linking with shared libraries |
WINDOWSHELL
|
Use comptime.bat instead of comptime.sh , don't use certain gzip commands. This should be used if compiling for Windows using Command Prompt (cmd.exe ) rather than through a shell environment (such as MinGW's MSYS).
|
Warnings/errors
Name | Description |
---|---|
WARNINGMODE
|
Compiles with extra warning flags:
|
ERRORMODE
|
All warnings are treated as errors (-Werror ). Automatically turns on WARNINGMODE when set.
|
VCHELP
|
Requires WARNINGMODE
Compiles with declaration-after-statement warnings. (Automatically turned on if Warning flags added:
|
NOCASTALIGNWARN
|
Requires WARNINGMODE
Compiles without pointer cast alignment warnings ( |
NOLDWARNING
|
Adds -Wl,--as-needed to the linker flags
|
GCC flags
Name | Description |
---|---|
GCC29
|
Includes GCC 2.9-only options
Other notes:
|
GCC295
|
Includes GCC 2.95-only options (automatically turns on GCC29 when set)
Disables the following
|
GCC40
|
Includes GCC 4.0-only options
Warning flags added:
|
GCC41
|
Includes GCC 4.1-only options (automatically turns on GCC40 and VCHELP when set)
Warning flags added:
|
GCC42
|
Includes GCC 4.2-only options (automatically turns on GCC41 when set)
|
GCC43
|
Includes GCC 4.3-only options (automatically turns on GCC42 when set)
Warning flags added:
|
GCC44
|
Includes GCC 4.4-only options (automatically turns on GCC43 when set)
Warning flags added:
|
GCC45
|
Includes GCC 4.5-only options (automatically turns on GCC44 when set)
Warning flags added:
|
GCC46
|
Includes GCC 4.6-only options (automatically turns on GCC45 when set)
Warning flags added:
|
GCC47
|
Includes GCC 4.7-only options (automatically turns on GCC46 when set)
|
GCC48
|
Includes GCC 4.8-only options (automatically turns on GCC47 when set)
Other notes:
|
GCC49
|
Includes GCC 4.9-only options (automatically turns on GCC48 when set)
|
GCC51
|
Includes GCC 5.1-only options (automatically turns on GCC49 when set)
|
GCC52
|
Includes GCC 5.2-only options (automatically turns on GCC51 when set)
|
GCC53
|
Includes GCC 5.3-only options (automatically turns on GCC52 when set)
|
GCC54
|
Includes GCC 5.4-only options (automatically turns on GCC53 when set)
Warning flags added:
|
GCC61
|
Includes GCC 6.1-only options (automatically turns on GCC54 when set)
Warning flags added:
|
GCC62
|
Includes GCC 6.2-only options (automatically turns on GCC61 when set)
|
GCC63
|
Includes GCC 6.3-only options (automatically turns on GCC62 when set)
|
GCC64
|
Includes GCC 6.4-only options (automatically turns on GCC63 when set)
|
GCC71
|
Includes GCC 7.1-only options (automatically turns on GCC64 when set)
Warning flags added:
|
GCC72
|
Includes GCC 7.2-only options (automatically turns on GCC71 when set)
|
GCC80
|
Includes GCC 8.0-only options (automatically turns on GCC72 when set)
|
GCC81
|
Includes GCC 8.1-only options (automatically turns on GCC80 when set)
Warning flags added:
|
GCC82
|
Includes GCC 8.2-only options (automatically turns on GCC81 when set)
|
GCC83
|
Includes GCC 8.3-only options (automatically turns on GCC82 when set)
|
GCC91
|
Includes GCC 9.1-only options (automatically turns on GCC83 when set)
Warning flags added:
|
Debugging
These flags toggle on/off compiling of debugging tools and other options for debugging SRB2 after compiling it.
Name | Description |
---|---|
DEBUGMODE
|
Compiles a debug version of SRB2 (Outputs to /Debug instead of /Release in the bin directory for the port being compiled for)
|
PROFILEMODE
|
Compiles with profiling information (see gprof) |
NOOBJDUMP
|
Does not dump debugging info in output folder (if VALGRIND is set, this is not needed)
|
ZDEBUG
|
Compiles with debugging for zone memory allocation code |
VALGRIND
|
Compiles with Valgrind |
RDB
|
Requires DJGPPDOS
Compiles with GDB stubs (for remote debugging) |
MOBJCONSISTANCY
|
Compiles with mobj consistency checking code |
PACKETDROP
|
Compiles with packet drop testing code |
Libraries
These flags toggle on/off compiling of libraries supported by SRB2, or various options linked to them. For manipulating C compiler/linker flags relating to some of these libraries, see the Compiler flags (Libraries) section.
Main dependencies
Name | Description |
---|---|
NOZLIB
|
Compiles without zlib. This will also turn on NOPNG if used, as zlib is required for PNG support.
|
NOPNG
|
Compiles without libpng, will fall back on PCX/TGA code instead of PNG for screenshots |
PNG_STATIC
|
libpng library is statically linked. Not used if compiling with MINGW unless PNG_CONFIG is also defined
|
NOGME
|
If compiling with LINUX , does not compile with HAVE_GME
|
HAVE_LIBGME
|
Compiles with Game Music Emu library (see /libs/gme ); turned on by default if compiling with MINGW , MINGW64 , or LINUX (and not with NOGME , in the last case)
|
NOOPENMPT
|
Compiles without libopenmpt |
NOCURL
|
Compiles without libcurl, note that libcurl is required for the Master Server, so setting this flag will disable master server support too. |
NOUPNP
|
Compiles without HAVE_MINIUPNPC
|
HAVE_MINIUPNPC
|
Compiles with MiniUPnP's client library, MiniUPnPc (see libs/miniupnpc ); turned on by default if compiling with MINGW , but not with MINGW64
|
GETTEXT
|
Compiles with gettext, see libs/gettext
|
CCBS
|
Requires MINGW and GETTEXT
Don't use |
STATIC_GETTEXT
|
Requires MINGW and GETTEXT
gettext libraries are statically linked; turned on by default if compiling with |
SDL libraries
These toggle on/off support for separate libraries designed to work with SDL. Note that by default, compiling with SDL will also include support for SDL_mixer (and SDL_main if compiling for Windows).
Name | Description |
---|---|
NOMIXER
|
Requires SDL
Compiles without SDL_mixer, fall back on |
NOMIXERX
|
Requires SDL
Compiles without SDL Mixer X |
HAVE_MIXERX
|
Requires SDL
Compiles with SDL Mixer X (Advanced Sound and MIDI support) |
SDL_TTF
|
Requires SDL
|
SDL_IMAGE
|
Requires SDL
Compiles with SDL_image (support for multiple image formats) |
SDL_NET
|
Requires SDL
Compiles with SDL_net (networking support) |
SDLMAIN
|
Requires SDL
Compiles with |
NOSDLMAIN
|
If compiling with MINGW and SDL , does not compile with SDLMAIN
|
Sound drivers
Name | Description |
---|---|
OPENAL
|
Requires SDL
OpenAL sound driver |
FMOD
|
Requires SDL
FMOD 3D sound driver |
DS3D
|
Requires SDL and MINGW
DirectSound3D sound driver |
NOHS
|
Compiles without 3D sound support |
STATICHS
|
Requires SDL
3D sound libraries are statically linked |
Other
Name | Description |
---|---|
NOTERMIOS
|
Requires SDL and UNIXCOMMON
Compiles without termios, the Unix API for terminal I/O |
WATTCP
|
Requires DJGPPDOS
Compiles for DOS using WatTCP (Waterloo TCP/IP) |
Miscellaneous
Name | Description |
---|---|
DISTCC
|
Compiles with distcc |
CCACHE
|
Compiles with ccache |
NONET
|
Compiles without netplay |
NOHW
|
Compiles without hardware mode (OpenGL) support |
NOIPX
|
Compiles without IPX |
NOMD5
|
Compiles without MD5 support |
NOUPX
|
Compiles without UPX |
NONX86
|
Compiles for non-x86 processors |
NOPOSTPROCESSING
|
Compiles without support for post-processing effects (including screenshots, movies and screen fades) |
NO_IPV6
|
Compiles without IPv6 support |
X86_64
|
Compiles for x86-64. Turned on by default if compiling with MINGW64 .
|
WITHDATA
|
Requires PANDORA
Downloads SRB2's resource files from a pre-determined URL (Note: the URL currently used contains the files for v2.0.6, an outdated version of SRB2) |
NOTHREADS
|
Compiles without Multithreading support |
Variables
Unlike the flags in the previous sections, these are not simple on/off toggles but are variables that all take string values which determine options such as the names and paths of programs and tools to be used during compiling, compiler/linker flags for including libraries, and the name of the output executable.
Note that variables that specify a path can alternatively take the name of the program with no path, provided the program's path is already in your system's PATH
environment variable.
For instance, when compiling on Windows, C:\MinGW\bin
being in the PATH
variable allows the following flag:
CC="C:\MinGW\bin\gcc.exe"
to be shortened to
CC=gcc
This works because gcc.exe
is a file within C:\MinGW\bin
, so the program can be specified directly instead of through its full path. However, this does not work if MinGW was installed in a different directory.
Compilers
Name | Description |
---|---|
CC=path
|
Determines the path for the program for compiling C programs; defaults to cc . For compiling SRB2 on Windows this should normally be set to gcc
|
Compiler flags (Main)
Name | Description |
---|---|
CFLAGS=flags
|
Extra flags to give to the C compiler |
CPPFLAGS=flags
|
Extra flags to give to the C preprocessor and programs that use it |
LDFLAGS=flags
|
Extra flags to give to compilers when they are supposed to invoke the linker |
ASFLAGS=flags
|
Extra flags to give to the assembler. This is used for compiling vid_copy.o prerequisites vid_copy.s and asm_defs.inc
|
WFLAGS=flags
|
Extra warning flags for the C compiler. This does not overwrite any default warning options set, only adds to them. |
Utilities/tools
Name | Description |
---|---|
PKG_CONFIG=path
|
Determines the path for pkg-config, a programming tool for inserting correct compiler options for libraries. Defaults to pkg-config
|
REMOVE=path_and_options
|
Determines the path and options for rm , the Unix program for removing objects such as files from the filesystem. Defaults to rm -f .
Note: This program is used to remove the temporary file |
MKDIR=path_and_options
|
Determines the path and options for mkdir , the Unix program for making new directories. Defaults to mkdir -p
|
GZIP=path
|
Determines the path for gzip. Defaults to gzip
|
GZIP_OPTS=options
|
Determines options for gzip. Default is -9 -f -n . Note: --rsyncable will be appended onto these options, whether the default options or custom options are used.
|
UPX=path
|
Will not be used if NOUPX is set
Determines the path for UPX. Defaults to |
UPX_OPTS=options
|
Will not be used if NOUPX is set
Determines options for UPX. Defaults to |
MSGFMT=path
|
Requires GETTEXT
Determines the path for |
Compiler flags (Libraries)
Name | Description |
---|---|
SDL_CFLAGS=flags
|
Requires SDL
Extra C compiler flags for compiling with SDL libraries Default values:
If not compiling with either of the above, |
SDL_LDFLAGS=flags
|
Requires SDL
Extra linker flags for compiling with SDL libraries Default values:
If not compiling with either of the above, |
SDL_PKGCONFIG=name
|
Requires SDL
Name of |
SDL_CONFIG=name
|
Requires SDL
Name of script to use to get compiler and linker flags for SDL libraries. Defaults to If Cross-Compiling, setting this to Note: this is only used if |
ZLIB_CFLAGS=flags
|
Extra C compiler flags for compiling with zlib
Default value:
|
ZLIB_LDFLAGS=flags
|
Extra linker flags for compiling with zlib
Default values:
If not compiling with either of the above, |
ZLIB_PKGCONFIG=name
|
Name of .pc file for pkg-config to use to get compiler and linker flags for zlib. Defaults to zlib
|
PNG_CFLAGS=flags
|
Will not be used if NOPNG is set
Extra C compiler flags for compiling with libpng Default value:
If not compiling with the above, |
PNG_LDFLAGS=flags
|
Will not be used if NOPNG is set
Extra linker flags for compiling with libpng Default values:
If not compiling with either of the above, |
PNG_PKGCONFIG=name
|
Will not be used if NOPNG is set
Name of |
PNG_CONFIG=text
|
Will not be used if NOPNG is set
Name of script to use to get compiler and linker flags for libpng. Defaults to Note: this is only used as a fallback if |
VALGRIND_PKGCONFIG=name
|
Requires VALGRIND
Name of |
VALGRIND_CFLAGS=flags
|
Requires VALGRIND
Extra C compiler flags for compiling with Valgrind. These are only used when compiling |
VALGRIND_LDFLAGS=flags
|
Requires VALGRIND
Extra linker flags for compiling with Valgrind |
LIBGME_CFLAGS=flags
|
Requires HAVE_LIBGME
Extra C compiler flags for compiling with the Game Music Emu library Default values:
If not compiling with the above, |
LIBGME_LDFLAGS=flags
|
Requires HAVE_LIBGME
Extra linker flags for compiling with the Game Music Emu library Default values:
If not compiling with the above, |
LIBGME_PKGCONFIG=name
|
Requires HAVE_LIBGME
Name of |
LIBOPENMPT_PKGCONFIG=name
|
Will not be used if NOOPENMPT is set
Name of |
LIBOPENMPT_CFLAGS=flags
|
Will not be used if NOOPENMPT is set
Extra C compiler flags for compiling with the libopenmpt library Default values:
If not compiling with the above, |
LIBOPENMPT_LDFLAGS=flags
|
Will not be used if NOOPENMPT is set
Extra linker flags for compiling with the libopenmpt library Default values:
If not compiling with the above, |
LUA_CFLAGS=flags
|
Extra C compiler flags for compiling files from the src/blua directory. If compiling with UNIXCOMMON (or anything that automatically sets it) or LINUX , -DLUA_USE_POSIX will be appended onto this variable
|
Miscellaneous
Name | Description | ||
---|---|---|---|
D_DIR=path
|
Determines the path to use as the resources directory; i.e. where the game's data files are kept. Defaults to ../bin/Resources
Note: This variable is only used in SRB2's Makefile when compiling for Pandora ( | ||
EXENAME=name
|
Name of the output executable. Default depends on the compilation options (listed by order of precedence):
| ||
DBGNAME=name
|
Name of the output debug file to go with the executable. Defaults to $(EXENAME).debug
| ||
PREFIX=name
|
Used for cross-compiling. The compiler or assembler you're using is automatically appended to the end of this variable.
Usage on Linux
| ||
ARCHNAME=name
|
If set, this overrides the default output and object file directories with a user-defined subfolder name in both bin and objs , i.e. the output and object file directories are set to bin/name and objs/name instead.
| ||
ARCHOPTS=options
|
Determines architecture-related options.
Default values:
|