1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
#**************************************************************************************************
#
# raylib makefile for Desktop platforms, Web (Wasm), Raspberry Pi (DRM mode) and Android
#
# Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose, including commercial
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you
# wrote the original software. If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
# as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#
#**************************************************************************************************
:
# Define required environment variables
#------------------------------------------------------------------------------------------------
# Define target platform: PLATFORM_DESKTOP, PLATFORM_WEB, PLATFORM_DRM, PLATFORM_ANDROID
PLATFORM ?=
# Define project variables
PROJECT_NAME ?=
PROJECT_VERSION ?=
PROJECT_BUILD_PATH ?=
PROJECT_SOURCE_FILES ?=
# raylib library variables
RAYLIB_SRC_PATH ?=
RAYLIB_INCLUDE_PATH ?=
RAYLIB_LIB_PATH ?=
# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
RAYLIB_LIBTYPE ?=
# Define compiler path on Windows
:
# Build mode for project: DEBUG or RELEASE
BUILD_MODE ?=
# PLATFORM_WEB: Default properties
BUILD_WEB_ASYNCIFY ?=
BUILD_WEB_SHELL ?=
BUILD_WEB_HEAP_SIZE ?=
BUILD_WEB_STACK_SIZE ?=
BUILD_WEB_ASYNCIFY_STACK_SIZE ?=
BUILD_WEB_RESOURCES ?=
BUILD_WEB_RESOURCES_PATH ?=
# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
PLATFORM_OS =
export PATH :=
else
UNAMEOS =
PLATFORM_OS =
endif
PLATFORM_OS =
endif
PLATFORM_OS =
endif
PLATFORM_OS =
endif
PLATFORM_OS =
endif
PLATFORM_OS =
endif
endif
endif
UNAMEOS =
PLATFORM_OS =
endif
endif
# Emscripten required variables
:# Define default C compiler: CC
#------------------------------------------------------------------------------------------------
CC =
# OSX default compiler
CC =
endif
# FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
CC =
endif
endif
# HTML5 emscripten compiler
# WARNING: To compile to HTML5, code must be redesigned
# to use emscripten.h and emscripten_set_main_loop()
CC =
endif
# Define RPI cross-compiler
#CC = armv6j-hardfloat-linux-gnueabi-gcc
CC =
endif
endif
# Define default make program: MAKE
#------------------------------------------------------------------------------------------------
MAKE ?=
MAKE =
endif
endif
# Define compiler flags: CFLAGS
#------------------------------------------------------------------------------------------------
# -O1 defines optimization level
# -g include debug information on compilation
# -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -Wno-unused-value ignore unused return values of some functions (i.e. fread())
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS =
#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
CFLAGS +=
else
CFLAGS +=
else
CFLAGS +=
endif
else
CFLAGS +=
else
CFLAGS +=
endif
endif
endif
CFLAGS +=
endif
# Define include paths for required headers: INCLUDE_PATHS
#------------------------------------------------------------------------------------------------
INCLUDE_PATHS +=
# Define additional directories containing required header files
# DRM required libraries
INCLUDE_PATHS +=
endif
# Consider -L$(RAYLIB_H_INSTALL_PATH)
INCLUDE_PATHS +=
endif
endif
# Define library paths containing required libs: LDFLAGS
#------------------------------------------------------------------------------------------------
LDFLAGS =
# NOTE: The resource .rc file contains windows executable icon and properties
LDFLAGS +=
# -Wl,--subsystem,windows hides the console window
#LDFLAGS += -Wl,--subsystem,windows
endif
endif
# Consider -L$(RAYLIB_INSTALL_PATH)
LDFLAGS +=
endif
# Reset everything.
# Precedence: immediately local, installed version, raysan5 provided libs
#LDFLAGS += -L$(RAYLIB_RELEASE_PATH)
endif
endif
# -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
# -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
# -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
# -sUSE_PTHREADS=1 # multithreading support
# -sWASM=0 # disable Web Assembly, emitted by default
# -sASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
# -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data
# -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
# -sMINIFY_HTML=0 # minify generated html from shell.html
# --profiling # include information for code profiling
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map
# --shell-file shell.html # define a custom shell .html and output extension
LDFLAGS +=
# Build using asyncify
LDFLAGS +=
endif
# Add resources building if required
LDFLAGS +=
endif
# Add debug mode flags if required
LDFLAGS +=
endif
# Define a custom shell .html and output extension
LDFLAGS +=
EXT =
endif
# Define libraries required on linking: LDLIBS
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
#------------------------------------------------------------------------------------------------
# Libraries for Windows desktop compilation
# NOTE: WinMM library required to set high-res timer resolution
LDLIBS =
# Required for physac examples
#LDLIBS += -static -lpthread
endif
# Libraries for Debian GNU/Linux desktop compiling
# NOTE: Required packages: libegl1-mesa-dev
LDLIBS =
# On Wayland windowing system, additional libraries requires
LDLIBS +=
else
# On X11 requires also below libraries
LDLIBS +=
# NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
#LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
# Explicit link to libc
LDLIBS +=
endif
endif
# Libraries for OSX 10.9 desktop compiling
# NOTE: Required packages: libopenal-dev libegl1-mesa-dev
LDLIBS =
endif
# Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
# NOTE: Required packages: mesa-libs
LDLIBS =
# On XWindow requires also below libraries
LDLIBS +=
endif
endif
# Libraries for web (HTML5) compiling
LDLIBS =
endif
# Libraries for DRM compiling
# NOTE: Required packages: libasound2-dev (ALSA)
LDLIBS =
endif
# Define all object files from source files
#------------------------------------------------------------------------------------------------
OBJS =
# Define processes to execute
#------------------------------------------------------------------------------------------------
# For Android platform we call a custom Makefile.Android
MAKEFILE_TARGET =
export PROJECT_NAME
export PROJECT_SOURCE_FILES
else
MAKEFILE_TARGET =
endif
# Default target entry
# NOTE: We call this Makefile target or Makefile.Android target
:
# Project target defined by PROJECT_NAME
: # Compile source files
# NOTE: This pattern will compile every module defined on $(OBJS)
: # Clean everything
: