Makefile examples and compiler considerations for using RetroFlat.
Certain options can be configured when a RetroFlat program is compiled by passing definitions with the compiler using the -D flag, or by #define-ing them before
retroflt.h is included in the source files.
OS Selection Definitions
These are mutually exclusive. It's best to specify them, in case RetroFlat can't figure it out from the compiler options.
Define | Description |
RETROFLAT_OS_WIN | Specify that the program will run on Windows. |
RETROFLAT_OS_DOS | Specify that the program will run on DOS DPMI. |
RETROFLAT_OS_DOS_REAL | Specify that the program will run DOS real mode. |
RETROFLAT_OS_UNIX | Specify that the program will run on UNIX/Linux. |
API/Library Selection Definitions
These are mutually exclusive.
RetroGLU API is only supported on some (32-bit and up) platforms.
Define | Description | Supports OpenGL |
RETROFLAT_API_ALLEGRO | Allegro | No |
RETROFLAT_API_SDL1 | SDL 1.2 | Yes |
RETROFLAT_API_SDL2 | SDL 2 | No |
RETROFLAT_API_WIN16 | Windows 3.1x API | No |
RETROFLAT_API_WIN32 | Win32/NT API | Yes |
RETROFLAT_API_LIBNDS | Nintendo DS | Yes (Limited) |
RETROFLAT_API_PC_BIOS | MS-DOS w/ PC BIOS | No |
RETROFLAT_API_GLUT | GLUT (OpenGL-Only) | Yes |
Option Definitions
These are
NOT mutually exclusive.
Define | Description |
RETROFLAT_MOUSE | Force-enable mouse on broken APIs (DANGEROUS!) |
RETROFLAT_TXP_R | Specify R component of bitmap transparent color. |
RETROFLAT_TXP_G | Specify G component of bitmap transparent color. |
RETROFLAT_TXP_B | Specify B component of bitmap transparent color. |
RETROFLAT_BITMAP_EXT | Specify file extension for bitmap assets. |
RETROFLAT_NO_RESIZABLE | Disallow resizing the RetroFlat window. |
RETROFLAT_NO_BLANK_INIT | Do not blank screen on retroflat_ini(). |
Win16 (OpenWatcom)
Compiling projects for Win16 requires the OpenWatcom compiler from
https://github.com/open-watcom/open-watcom-v2. Other compilers may work, but this is the only one that has been tested. No other specific libraries are required. The Windows API is used directly.The Watcom Makefile includes assume the following variable definitions from the environment:
- $WATCOM should be set to the path where the OpenWatcom compiler has been extracted, containing the binw, binl, h, and lib386 directories (among others).
- $PATH should contain $WATCOM/bin, so that the wcc386 and accompanying tools below can be executed.
For an example of the main.c file, please see
RetroFlat Example.
Makefile
An example to use the unified Makefile include follows. Please name it "Makefile" in the root directory of the project and replace "exampl" with a 6-character binary name for best results!
# A list of C files included in the project. These must be provided
# by you. In this example, our program only has one file.
C_FILES := main.c
# Project-specific defines to pass to EVERY target.
GLOBAL_DEFINES :=
# Include the template Makefile that will create targets for
# platforms as specified below.
include maug/Makefile.inc
# Build these targets by default.
all: exampl.sdl examplb.exe examplnt.exe
# Create an icon from exampl.bmp for SDL to use for its window.
$(eval $(call TGTSDLICO,mdemo))
$(eval $(call TGTUNIXSDL,mdemo))
# Build a DOS real-mode target.
$(eval $(call TGTDOSBIOS,exampl))
# Create an icon and resource file from exampl.bmp for Windows
# targets to use.
$(eval $(call TGTWINICO,exampl))
# Build a Windows NT 32-bit target.
$(eval $(call TGTWINNT,exampl))
# Remove built files from previously defined targets.
clean:
rm -rf $(CLEAN_TARGETS)