diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 11:09:56 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 11:09:56 +0200 |
| commit | 123144c93bfc77883c8fb517828b47bbe13b8671 (patch) | |
| tree | 762739afedb5f3f168051367515cb9b9a06ec68d /raylib/src/Makefile | |
| download | minesweeper-123144c93bfc77883c8fb517828b47bbe13b8671.tar.gz minesweeper-123144c93bfc77883c8fb517828b47bbe13b8671.zip | |
Diffstat (limited to 'raylib/src/Makefile')
| -rw-r--r-- | raylib/src/Makefile | 873 |
1 files changed, 873 insertions, 0 deletions
diff --git a/raylib/src/Makefile b/raylib/src/Makefile new file mode 100644 index 0000000..7dde52f --- /dev/null +++ b/raylib/src/Makefile | |||
| @@ -0,0 +1,873 @@ | |||
| 1 | #****************************************************************************** | ||
| 2 | # | ||
| 3 | # raylib makefile | ||
| 4 | # | ||
| 5 | # This file supports building raylib library for the following platforms: | ||
| 6 | # | ||
| 7 | # > PLATFORM_DESKTOP | ||
| 8 | # - Defaults to PLATFORM_DESKTOP_GLFW | ||
| 9 | # > PLATFORM_DESKTOP_GLFW (GLFW backend): | ||
| 10 | # - Windows (Win32, Win64) | ||
| 11 | # - Linux (X11/Wayland desktop mode) | ||
| 12 | # - macOS/OSX (x64, arm64) | ||
| 13 | # - FreeBSD, OpenBSD, NetBSD, DragonFly (X11 desktop) | ||
| 14 | # > PLATFORM_DESKTOP_SDL (SDL backend): | ||
| 15 | # - Windows (Win32, Win64) | ||
| 16 | # - Linux (X11/Wayland desktop mode) | ||
| 17 | # - Others (not tested) | ||
| 18 | # > PLATFORM_DESKTOP_RGFW (RGFW backend): | ||
| 19 | # - Windows (Win32, Win64) | ||
| 20 | # - Linux (X11 desktop mode) | ||
| 21 | # - macOS/OSX (x64, arm64 (not tested)) | ||
| 22 | # - Others (not tested) | ||
| 23 | # > PLATFORM_WEB: | ||
| 24 | # - HTML5 (WebAssembly) | ||
| 25 | # > PLATFORM_DRM: | ||
| 26 | # - Raspberry Pi 0-5 (DRM/KMS) | ||
| 27 | # - Linux DRM subsystem (KMS mode) | ||
| 28 | # > PLATFORM_ANDROID: | ||
| 29 | # - Android (ARM, ARM64) | ||
| 30 | # | ||
| 31 | # Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline. | ||
| 32 | # Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline. | ||
| 33 | # | ||
| 34 | # Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) | ||
| 35 | # | ||
| 36 | # This software is provided "as-is", without any express or implied warranty. In no event | ||
| 37 | # will the authors be held liable for any damages arising from the use of this software. | ||
| 38 | # | ||
| 39 | # Permission is granted to anyone to use this software for any purpose, including commercial | ||
| 40 | # applications, and to alter it and redistribute it freely, subject to the following restrictions: | ||
| 41 | # | ||
| 42 | # 1. The origin of this software must not be misrepresented; you must not claim that you | ||
| 43 | # wrote the original software. If you use this software in a product, an acknowledgment | ||
| 44 | # in the product documentation would be appreciated but is not required. | ||
| 45 | # | ||
| 46 | # 2. Altered source versions must be plainly marked as such, and must not be misrepresented | ||
| 47 | # as being the original software. | ||
| 48 | # | ||
| 49 | # 3. This notice may not be removed or altered from any source distribution. | ||
| 50 | # | ||
| 51 | #************************************************************************************************** | ||
| 52 | |||
| 53 | # NOTE: Highly recommended to read the raylib Wiki to know how to compile raylib for different platforms | ||
| 54 | # https://github.com/raysan5/raylib/wiki | ||
| 55 | |||
| 56 | .PHONY: all clean install uninstall | ||
| 57 | |||
| 58 | # Define required environment variables | ||
| 59 | #------------------------------------------------------------------------------------------------ | ||
| 60 | # Define target platform | ||
| 61 | PLATFORM ?= PLATFORM_DESKTOP | ||
| 62 | |||
| 63 | ifeq ($(PLATFORM), PLATFORM_DESKTOP) | ||
| 64 | TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW | ||
| 65 | else | ||
| 66 | TARGET_PLATFORM = $(PLATFORM) | ||
| 67 | endif | ||
| 68 | |||
| 69 | # Define required raylib variables | ||
| 70 | RAYLIB_VERSION = 5.5.0 | ||
| 71 | RAYLIB_API_VERSION = 550 | ||
| 72 | |||
| 73 | # Define raylib source code path | ||
| 74 | RAYLIB_SRC_PATH ?= ../src | ||
| 75 | |||
| 76 | # Define output directory for compiled library, defaults to src directory | ||
| 77 | # NOTE: If externally provided, make sure directory exists | ||
| 78 | RAYLIB_RELEASE_PATH ?= $(RAYLIB_SRC_PATH) | ||
| 79 | |||
| 80 | # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) | ||
| 81 | RAYLIB_LIBTYPE ?= STATIC | ||
| 82 | |||
| 83 | # Build mode for library: DEBUG or RELEASE | ||
| 84 | RAYLIB_BUILD_MODE ?= RELEASE | ||
| 85 | |||
| 86 | # Build output name for the library | ||
| 87 | RAYLIB_LIB_NAME ?= raylib | ||
| 88 | |||
| 89 | # Define resource file for DLL properties | ||
| 90 | RAYLIB_RES_FILE ?= ./raylib.dll.rc.data | ||
| 91 | |||
| 92 | # Define external config flags | ||
| 93 | # NOTE: It will override config.h flags with the provided ones, | ||
| 94 | # if NONE, default config.h flags are used | ||
| 95 | RAYLIB_CONFIG_FLAGS ?= NONE | ||
| 96 | |||
| 97 | # To define additional cflags: Use make CUSTOM_CFLAGS="" | ||
| 98 | |||
| 99 | # Include raylib modules on compilation | ||
| 100 | # NOTE: Some programs like tools could not require those modules | ||
| 101 | RAYLIB_MODULE_AUDIO ?= TRUE | ||
| 102 | RAYLIB_MODULE_MODELS ?= TRUE | ||
| 103 | RAYLIB_MODULE_RAYGUI ?= FALSE | ||
| 104 | |||
| 105 | # NOTE: Additional libraries have been moved to their own repos: | ||
| 106 | # raygui: https://github.com/raysan5/raygui | ||
| 107 | RAYLIB_MODULE_RAYGUI_PATH ?= $(RAYLIB_SRC_PATH)/../../raygui/src | ||
| 108 | |||
| 109 | # Use external GLFW library instead of rglfw module | ||
| 110 | USE_EXTERNAL_GLFW ?= FALSE | ||
| 111 | |||
| 112 | # Enable support for X11 by default on Linux when using GLFW | ||
| 113 | # NOTE: Wayland is disabled by default, only enable if you are sure | ||
| 114 | GLFW_LINUX_ENABLE_WAYLAND ?= FALSE | ||
| 115 | GLFW_LINUX_ENABLE_X11 ?= TRUE | ||
| 116 | |||
| 117 | # PLATFORM_DESKTOP_SDL: It requires SDL library to be provided externally | ||
| 118 | # WARNING: Library is not included in raylib, it MUST be configured by users | ||
| 119 | SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include | ||
| 120 | SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib | ||
| 121 | SDL_LIBRARIES ?= -lSDL2 -lSDL2main | ||
| 122 | |||
| 123 | |||
| 124 | # Determine if the file has root access (only required to install raylib) | ||
| 125 | # "whoami" prints the name of the user that calls him (so, if it is the root user, "whoami" prints "root") | ||
| 126 | ROOT = $(shell whoami) | ||
| 127 | |||
| 128 | # By default we suppose we are working on Windows | ||
| 129 | HOST_PLATFORM_OS ?= WINDOWS | ||
| 130 | PLATFORM_OS ?= WINDOWS | ||
| 131 | |||
| 132 | # Determine PLATFORM_OS when required | ||
| 133 | ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_ANDROID)) | ||
| 134 | # No uname.exe on MinGW!, but OS=Windows_NT on Windows! | ||
| 135 | # ifeq ($(UNAME),Msys) -> Windows | ||
| 136 | ifeq ($(OS),Windows_NT) | ||
| 137 | PLATFORM_OS = WINDOWS | ||
| 138 | ifndef PLATFORM_SHELL | ||
| 139 | PLATFORM_SHELL = cmd | ||
| 140 | endif | ||
| 141 | else | ||
| 142 | UNAMEOS = $(shell uname) | ||
| 143 | ifeq ($(UNAMEOS),Linux) | ||
| 144 | PLATFORM_OS = LINUX | ||
| 145 | endif | ||
| 146 | ifeq ($(UNAMEOS),FreeBSD) | ||
| 147 | PLATFORM_OS = BSD | ||
| 148 | endif | ||
| 149 | ifeq ($(UNAMEOS),OpenBSD) | ||
| 150 | PLATFORM_OS = BSD | ||
| 151 | endif | ||
| 152 | ifeq ($(UNAMEOS),NetBSD) | ||
| 153 | PLATFORM_OS = BSD | ||
| 154 | endif | ||
| 155 | ifeq ($(UNAMEOS),DragonFly) | ||
| 156 | PLATFORM_OS = BSD | ||
| 157 | endif | ||
| 158 | ifeq ($(UNAMEOS),Darwin) | ||
| 159 | PLATFORM_OS = OSX | ||
| 160 | endif | ||
| 161 | ifndef PLATFORM_SHELL | ||
| 162 | PLATFORM_SHELL = sh | ||
| 163 | endif | ||
| 164 | endif | ||
| 165 | endif | ||
| 166 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 167 | UNAMEOS = $(shell uname) | ||
| 168 | ifeq ($(UNAMEOS),Linux) | ||
| 169 | PLATFORM_OS = LINUX | ||
| 170 | endif | ||
| 171 | ifndef PLATFORM_SHELL | ||
| 172 | PLATFORM_SHELL = sh | ||
| 173 | endif | ||
| 174 | endif | ||
| 175 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 176 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 177 | ifndef PLATFORM_SHELL | ||
| 178 | PLATFORM_SHELL = sh | ||
| 179 | endif | ||
| 180 | endif | ||
| 181 | endif | ||
| 182 | |||
| 183 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 184 | ifeq ($(PLATFORM_OS), WINDOWS) | ||
| 185 | # Emscripten required variables | ||
| 186 | EMSDK_PATH ?= C:/raylib/emsdk | ||
| 187 | EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten | ||
| 188 | CLANG_PATH := $(EMSDK_PATH)/upstream/bin | ||
| 189 | PYTHON_PATH := $(EMSDK_PATH)/python/3.9.2-nuget_64bit | ||
| 190 | NODE_PATH := $(EMSDK_PATH)/node/20.18.0_64bit/bin | ||
| 191 | export PATH := $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:/raylib/MinGW/bin;$(PATH) | ||
| 192 | endif | ||
| 193 | endif | ||
| 194 | |||
| 195 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 196 | # Android architecture | ||
| 197 | # Starting at 2019 using arm64 is mandatory for published apps, | ||
| 198 | # Starting on August 2020, minimum required target API is Android 10 (API level 29) | ||
| 199 | ANDROID_ARCH ?= arm64 | ||
| 200 | ANDROID_API_VERSION ?= 29 | ||
| 201 | |||
| 202 | # Android required path variables | ||
| 203 | # NOTE: Starting with Android NDK r21, no more toolchain generation is required, NDK is the toolchain on itself | ||
| 204 | ifeq ($(OS),Windows_NT) | ||
| 205 | ANDROID_NDK ?= C:/android-ndk | ||
| 206 | ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64 | ||
| 207 | else | ||
| 208 | ANDROID_NDK ?= /usr/lib/android/ndk | ||
| 209 | ifeq ($(PLATFORM_OS), OSX) | ||
| 210 | ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64 | ||
| 211 | else | ||
| 212 | ANDROID_TOOLCHAIN = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64 | ||
| 213 | endif | ||
| 214 | endif | ||
| 215 | |||
| 216 | # NOTE: Sysroot can also be reference from $(ANDROID_NDK)/sysroot | ||
| 217 | ANDROID_SYSROOT ?= $(ANDROID_TOOLCHAIN)/sysroot | ||
| 218 | |||
| 219 | ifeq ($(ANDROID_ARCH),arm) | ||
| 220 | ANDROID_COMPILER_ARCH = armv7a | ||
| 221 | endif | ||
| 222 | ifeq ($(ANDROID_ARCH),arm64) | ||
| 223 | ANDROID_COMPILER_ARCH = aarch64 | ||
| 224 | endif | ||
| 225 | ifeq ($(ANDROID_ARCH),x86) | ||
| 226 | ANDROID_COMPILER_ARCH = i686 | ||
| 227 | endif | ||
| 228 | ifeq ($(ANDROID_ARCH),x86_64) | ||
| 229 | ANDROID_COMPILER_ARCH = x86_64 | ||
| 230 | endif | ||
| 231 | |||
| 232 | endif | ||
| 233 | |||
| 234 | # Define raylib graphics api depending on selected platform | ||
| 235 | # NOTE: By default use OpenGL 3.3 on desktop platforms | ||
| 236 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 237 | GRAPHICS ?= GRAPHICS_API_OPENGL_33 | ||
| 238 | #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 | ||
| 239 | #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1 | ||
| 240 | #GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3 | ||
| 241 | #GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE) | ||
| 242 | endif | ||
| 243 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL) | ||
| 244 | GRAPHICS ?= GRAPHICS_API_OPENGL_33 | ||
| 245 | endif | ||
| 246 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW) | ||
| 247 | GRAPHICS ?= GRAPHICS_API_OPENGL_33 | ||
| 248 | #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 | ||
| 249 | #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1 | ||
| 250 | #GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3 | ||
| 251 | #GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE) | ||
| 252 | endif | ||
| 253 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 254 | # On DRM OpenGL ES 2.0 must be used | ||
| 255 | GRAPHICS = GRAPHICS_API_OPENGL_ES2 | ||
| 256 | endif | ||
| 257 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 258 | # On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 | ||
| 259 | GRAPHICS = GRAPHICS_API_OPENGL_ES2 | ||
| 260 | #GRAPHICS = GRAPHICS_API_OPENGL_ES3 | ||
| 261 | endif | ||
| 262 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 263 | # By default use OpenGL ES 2.0 on Android | ||
| 264 | GRAPHICS = GRAPHICS_API_OPENGL_ES2 | ||
| 265 | endif | ||
| 266 | |||
| 267 | # Define default C compiler and archiver to pack library: CC, AR | ||
| 268 | #------------------------------------------------------------------------------------------------ | ||
| 269 | CC = gcc | ||
| 270 | AR = ar | ||
| 271 | |||
| 272 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 273 | ifeq ($(PLATFORM_OS),OSX) | ||
| 274 | # OSX default compiler | ||
| 275 | CC = clang | ||
| 276 | GLFW_OSX = -x objective-c | ||
| 277 | endif | ||
| 278 | ifeq ($(PLATFORM_OS),BSD) | ||
| 279 | # FreeBSD, OpenBSD, NetBSD, DragonFly default compiler | ||
| 280 | CC = clang | ||
| 281 | endif | ||
| 282 | endif | ||
| 283 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 284 | ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) | ||
| 285 | # Define RPI cross-compiler | ||
| 286 | #CC = armv6j-hardfloat-linux-gnueabi-gcc | ||
| 287 | CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc | ||
| 288 | AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar | ||
| 289 | endif | ||
| 290 | endif | ||
| 291 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 292 | # HTML5 emscripten compiler | ||
| 293 | CC = emcc | ||
| 294 | AR = emar | ||
| 295 | endif | ||
| 296 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 297 | # Android toolchain (must be provided for desired architecture and compiler) | ||
| 298 | ifeq ($(ANDROID_ARCH),arm) | ||
| 299 | CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-androideabi$(ANDROID_API_VERSION)-clang | ||
| 300 | endif | ||
| 301 | ifeq ($(ANDROID_ARCH),arm64) | ||
| 302 | CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-android$(ANDROID_API_VERSION)-clang | ||
| 303 | endif | ||
| 304 | ifeq ($(ANDROID_ARCH),x86) | ||
| 305 | CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-android$(ANDROID_API_VERSION)-clang | ||
| 306 | endif | ||
| 307 | ifeq ($(ANDROID_ARCH),x86_64) | ||
| 308 | CC = $(ANDROID_TOOLCHAIN)/bin/$(ANDROID_COMPILER_ARCH)-linux-android$(ANDROID_API_VERSION)-clang | ||
| 309 | endif | ||
| 310 | # It seems from Android NDK r22 onwards we need to use llvm-ar | ||
| 311 | AR = $(ANDROID_TOOLCHAIN)/bin/llvm-ar | ||
| 312 | endif | ||
| 313 | |||
| 314 | # Define compiler flags: CFLAGS | ||
| 315 | #------------------------------------------------------------------------------------------------ | ||
| 316 | # -O1 defines optimization level | ||
| 317 | # -g include debug information on compilation | ||
| 318 | # -s strip unnecessary data from build --> linker | ||
| 319 | # -Wall turns on most, but not all, compiler warnings | ||
| 320 | # -std=c99 defines C language mode (standard C from 1999 revision) | ||
| 321 | # -std=gnu99 defines C language mode (GNU C from 1999 revision) | ||
| 322 | # -Wno-missing-braces ignore invalid warning (GCC bug 53119) | ||
| 323 | # -Wno-unused-value ignore unused return values of some functions (i.e. fread()) | ||
| 324 | # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec | ||
| 325 | # -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions | ||
| 326 | # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers | ||
| 327 | # -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing) | ||
| 328 | CFLAGS = -Wall -D_GNU_SOURCE -D$(TARGET_PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing | ||
| 329 | |||
| 330 | ifneq ($(RAYLIB_CONFIG_FLAGS), NONE) | ||
| 331 | CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS) | ||
| 332 | endif | ||
| 333 | |||
| 334 | ifeq ($(TARGET_PLATFORM), PLATFORM_WEB) | ||
| 335 | # NOTE: When using multi-threading in the user code, it requires -pthread enabled | ||
| 336 | CFLAGS += -std=gnu99 | ||
| 337 | else | ||
| 338 | CFLAGS += -std=c99 | ||
| 339 | endif | ||
| 340 | |||
| 341 | ifeq ($(PLATFORM_OS), LINUX) | ||
| 342 | CFLAGS += -fPIC | ||
| 343 | endif | ||
| 344 | |||
| 345 | ifeq ($(RAYLIB_BUILD_MODE),DEBUG) | ||
| 346 | CFLAGS += -g -D_DEBUG | ||
| 347 | endif | ||
| 348 | |||
| 349 | ifeq ($(RAYLIB_BUILD_MODE),RELEASE) | ||
| 350 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 351 | CFLAGS += -Os | ||
| 352 | endif | ||
| 353 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 354 | CFLAGS += -O1 | ||
| 355 | endif | ||
| 356 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 357 | CFLAGS += -O2 | ||
| 358 | endif | ||
| 359 | endif | ||
| 360 | |||
| 361 | # Additional flags for compiler (if desired) | ||
| 362 | # -Wextra enables some extra warning flags that are not enabled by -Wall | ||
| 363 | # -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration | ||
| 364 | # -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types | ||
| 365 | # -Werror=implicit-function-declaration catch function calls without prior declaration | ||
| 366 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 367 | CFLAGS += -Werror=implicit-function-declaration | ||
| 368 | endif | ||
| 369 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 370 | # -Os # size optimization | ||
| 371 | # -O2 # optimization level 2, if used, also set --memory-init-file 0 | ||
| 372 | # -sUSE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker! | ||
| 373 | # -sALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! | ||
| 374 | # -sTOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) | ||
| 375 | # -sUSE_PTHREADS=1 # multithreading support | ||
| 376 | # -sFORCE_FILESYSTEM=1 # force filesystem to load/save files data | ||
| 377 | # -sASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) | ||
| 378 | # -sGL_ENABLE_GET_PROC_ADDRESS # enable using the *glGetProcAddress() family of functions, required for extensions loading | ||
| 379 | # --profiling # include information for code profiling | ||
| 380 | # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) | ||
| 381 | # --preload-file resources # specify a resources folder for data compilation | ||
| 382 | ifeq ($(RAYLIB_BUILD_MODE),DEBUG) | ||
| 383 | CFLAGS += -sASSERTIONS=1 --profiling | ||
| 384 | endif | ||
| 385 | #CFLAGS += -sGL_ENABLE_GET_PROC_ADDRESS | ||
| 386 | endif | ||
| 387 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 388 | # Compiler flags for arquitecture | ||
| 389 | ifeq ($(ANDROID_ARCH),arm) | ||
| 390 | CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 | ||
| 391 | endif | ||
| 392 | ifeq ($(ANDROID_ARCH),arm64) | ||
| 393 | CFLAGS += -target aarch64 -mfix-cortex-a53-835769 | ||
| 394 | endif | ||
| 395 | ifeq ($(ANDROID_ARCH),x86) | ||
| 396 | CFLAGS += -march=i686 | ||
| 397 | endif | ||
| 398 | ifeq ($(ANDROID_ARCH),x86_64) | ||
| 399 | CFLAGS += -march=x86-64 | ||
| 400 | endif | ||
| 401 | # Compilation functions attributes options | ||
| 402 | CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIE -fPIC | ||
| 403 | # Compiler options for the linker | ||
| 404 | # -Werror=format-security | ||
| 405 | CFLAGS += -Wa,--noexecstack -Wformat -no-canonical-prefixes | ||
| 406 | # Preprocessor macro definitions | ||
| 407 | CFLAGS += -D__ANDROID__ -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION) | ||
| 408 | endif | ||
| 409 | |||
| 410 | # Define required compilation flags for raylib SHARED lib | ||
| 411 | ifeq ($(RAYLIB_LIBTYPE),SHARED) | ||
| 412 | # make sure code is compiled as position independent | ||
| 413 | # BE CAREFUL: It seems that for gcc -fpic is not the same as -fPIC | ||
| 414 | # MinGW32 just doesn't need -fPIC, it shows warnings | ||
| 415 | CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED | ||
| 416 | |||
| 417 | # hide all symbols by default, so RLAPI can expose them | ||
| 418 | ifeq ($(PLATFORM_OS),$(filter $(PLATFORM_OS), LINUX BSD OSX)) | ||
| 419 | CFLAGS += -fvisibility=hidden | ||
| 420 | endif | ||
| 421 | endif | ||
| 422 | |||
| 423 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 424 | # without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in | ||
| 425 | # which contains a conflicting type Font | ||
| 426 | CFLAGS += -DEGL_NO_X11 | ||
| 427 | CFLAGS += -Werror=implicit-function-declaration | ||
| 428 | endif | ||
| 429 | # Use Wayland display on Linux desktop | ||
| 430 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 431 | ifeq ($(PLATFORM_OS), LINUX) | ||
| 432 | ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE) | ||
| 433 | CFLAGS += -D_GLFW_X11 | ||
| 434 | endif | ||
| 435 | ifeq ($(GLFW_LINUX_ENABLE_WAYLAND),TRUE) | ||
| 436 | CFLAGS += -D_GLFW_WAYLAND | ||
| 437 | LDFLAGS += $(shell pkg-config wayland-client wayland-cursor wayland-egl xkbcommon --libs) | ||
| 438 | |||
| 439 | WL_PROTOCOLS_DIR := external/glfw/deps/wayland | ||
| 440 | |||
| 441 | wl_generate = \ | ||
| 442 | $(eval protocol=$(1)) \ | ||
| 443 | $(eval basename=$(2)) \ | ||
| 444 | $(shell wayland-scanner client-header $(protocol) $(RAYLIB_SRC_PATH)/$(basename).h) \ | ||
| 445 | $(shell wayland-scanner private-code $(protocol) $(RAYLIB_SRC_PATH)/$(basename)-code.h) | ||
| 446 | |||
| 447 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/wayland.xml, wayland-client-protocol) | ||
| 448 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-shell.xml, xdg-shell-client-protocol) | ||
| 449 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-decoration-unstable-v1.xml, xdg-decoration-unstable-v1-client-protocol) | ||
| 450 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/viewporter.xml, viewporter-client-protocol) | ||
| 451 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/relative-pointer-unstable-v1.xml, relative-pointer-unstable-v1-client-protocol) | ||
| 452 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/pointer-constraints-unstable-v1.xml, pointer-constraints-unstable-v1-client-protocol) | ||
| 453 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/fractional-scale-v1.xml, fractional-scale-v1-client-protocol) | ||
| 454 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/xdg-activation-v1.xml, xdg-activation-v1-client-protocol) | ||
| 455 | $(call wl_generate, $(WL_PROTOCOLS_DIR)/idle-inhibit-unstable-v1.xml, idle-inhibit-unstable-v1-client-protocol) | ||
| 456 | endif | ||
| 457 | endif | ||
| 458 | endif | ||
| 459 | |||
| 460 | CFLAGS += $(CUSTOM_CFLAGS) | ||
| 461 | |||
| 462 | # Define include paths for required headers: INCLUDE_PATHS | ||
| 463 | # NOTE: Several external required libraries (stb and others) | ||
| 464 | #------------------------------------------------------------------------------------------------ | ||
| 465 | INCLUDE_PATHS = -I. $(EXTRA_INCLUDE_PATHS) | ||
| 466 | |||
| 467 | # Define additional directories containing required header files | ||
| 468 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 469 | INCLUDE_PATHS += -Iexternal/glfw/include | ||
| 470 | ifeq ($(PLATFORM_OS),BSD) | ||
| 471 | INCLUDE_PATHS += -I/usr/local/include -I/usr/pkg/include -I/usr/X11R7/include | ||
| 472 | endif | ||
| 473 | endif | ||
| 474 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL) | ||
| 475 | INCLUDE_PATHS += -I$(SDL_INCLUDE_PATH) | ||
| 476 | endif | ||
| 477 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 478 | INCLUDE_PATHS += -Iexternal/glfw/include | ||
| 479 | endif | ||
| 480 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 481 | INCLUDE_PATHS += -I/usr/include/libdrm | ||
| 482 | ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) | ||
| 483 | INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/usr/include | ||
| 484 | INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include | ||
| 485 | endif | ||
| 486 | endif | ||
| 487 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 488 | NATIVE_APP_GLUE = $(ANDROID_NDK)/sources/android/native_app_glue | ||
| 489 | # Include android_native_app_glue.h | ||
| 490 | INCLUDE_PATHS += -I$(NATIVE_APP_GLUE) | ||
| 491 | |||
| 492 | # Android required libraries | ||
| 493 | INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include | ||
| 494 | ifeq ($(ANDROID_ARCH),arm) | ||
| 495 | INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/arm-linux-androideabi | ||
| 496 | endif | ||
| 497 | ifeq ($(ANDROID_ARCH),arm64) | ||
| 498 | INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/aarch64-linux-android | ||
| 499 | endif | ||
| 500 | ifeq ($(ANDROID_ARCH),x86) | ||
| 501 | INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/i686-linux-android | ||
| 502 | endif | ||
| 503 | ifeq ($(ANDROID_ARCH),x86_64) | ||
| 504 | INCLUDE_PATHS += -I$(ANDROID_SYSROOT)/usr/include/x86_64-linux-android | ||
| 505 | endif | ||
| 506 | endif | ||
| 507 | |||
| 508 | # Define library paths containing required libs: LDFLAGS | ||
| 509 | # NOTE: This is only required for dynamic library generation | ||
| 510 | #------------------------------------------------------------------------------------------------ | ||
| 511 | LDFLAGS = $(CUSTOM_LDFLAGS) -L. -L$(RAYLIB_RELEASE_PATH) | ||
| 512 | |||
| 513 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 514 | ifeq ($(PLATFORM_OS),WINDOWS) | ||
| 515 | ifneq ($(CC), tcc) | ||
| 516 | LDFLAGS += -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME)dll.a | ||
| 517 | endif | ||
| 518 | endif | ||
| 519 | ifeq ($(PLATFORM_OS),OSX) | ||
| 520 | LDFLAGS += -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) | ||
| 521 | endif | ||
| 522 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 523 | LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) | ||
| 524 | endif | ||
| 525 | ifeq ($(PLATFORM_OS),BSD) | ||
| 526 | LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -Lsrc -L/usr/local/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib | ||
| 527 | endif | ||
| 528 | endif | ||
| 529 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL) | ||
| 530 | LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) | ||
| 531 | LDFLAGS += -L$(SDL_LIBRARY_PATH) | ||
| 532 | endif | ||
| 533 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 534 | LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) | ||
| 535 | ifeq ($(USE_RPI_CROSSCOMPILER), TRUE) | ||
| 536 | LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib -L$(RPI_TOOLCHAIN_SYSROOT)/usr/lib | ||
| 537 | endif | ||
| 538 | endif | ||
| 539 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 540 | LDFLAGS += -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -Wl,--exclude-libs,libatomic.a | ||
| 541 | LDFLAGS += -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings | ||
| 542 | # Force linking of library module to define symbol | ||
| 543 | LDFLAGS += -u ANativeActivity_onCreate | ||
| 544 | # Library paths containing required libs | ||
| 545 | LDFLAGS += -Lsrc | ||
| 546 | # Avoid unresolved symbol pointing to external main() | ||
| 547 | LDFLAGS += -Wl,-undefined,dynamic_lookup | ||
| 548 | endif | ||
| 549 | |||
| 550 | # Define libraries required on linking: LDLIBS | ||
| 551 | # NOTE: This is only required for dynamic library generation | ||
| 552 | #------------------------------------------------------------------------------------------------ | ||
| 553 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 554 | ifeq ($(PLATFORM_OS),WINDOWS) | ||
| 555 | ifeq ($(CC), tcc) | ||
| 556 | LDLIBS = -lopengl32 -lgdi32 -lwinmm -lshell32 | ||
| 557 | else | ||
| 558 | LDLIBS = -static-libgcc -lopengl32 -lgdi32 -lwinmm | ||
| 559 | endif | ||
| 560 | endif | ||
| 561 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 562 | LDLIBS = -lGL -lc -lm -lpthread -ldl -lrt | ||
| 563 | ifeq ($(GLFW_LINUX_ENABLE_X11),TRUE) | ||
| 564 | LDLIBS += -lX11 | ||
| 565 | endif | ||
| 566 | # TODO: On ARM 32bit arch, miniaudio requires atomics library | ||
| 567 | #LDLIBS += -latomic | ||
| 568 | endif | ||
| 569 | ifeq ($(PLATFORM_OS),OSX) | ||
| 570 | LDLIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo | ||
| 571 | endif | ||
| 572 | ifeq ($(PLATFORM_OS),BSD) | ||
| 573 | LDLIBS = -lGL -lpthread | ||
| 574 | endif | ||
| 575 | ifeq ($(USE_EXTERNAL_GLFW),TRUE) | ||
| 576 | # Check the version name. If GLFW3 was built manually, it may have produced | ||
| 577 | # a static library known as libglfw3.a. In that case, the name should be -lglfw3 | ||
| 578 | LDLIBS = -lglfw | ||
| 579 | endif | ||
| 580 | endif | ||
| 581 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL) | ||
| 582 | ifeq ($(PLATFORM_OS),WINDOWS) | ||
| 583 | LDLIBS = -static-libgcc -lopengl32 -lgdi32 | ||
| 584 | endif | ||
| 585 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 586 | LDLIBS = -lGL -lc -lm -lpthread -ldl -lrt | ||
| 587 | ifeq ($(USE_WAYLAND_DISPLAY),FALSE) | ||
| 588 | LDLIBS += -lX11 | ||
| 589 | endif | ||
| 590 | endif | ||
| 591 | LDLIBS += $(SDL_LIBRARIES) | ||
| 592 | endif | ||
| 593 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_RGFW) | ||
| 594 | ifeq ($(PLATFORM_OS),WINDOWS) | ||
| 595 | # Libraries for Windows desktop compilation | ||
| 596 | LDLIBS = -lgdi32 -lwinmm -lopengl32 | ||
| 597 | endif | ||
| 598 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 599 | # Libraries for Debian GNU/Linux desktop compipling | ||
| 600 | # NOTE: Required packages: libegl1-mesa-dev | ||
| 601 | LDLIBS = -lGL -lX11 -lXrandr -lXinerama -lXi -lXcursor -lm -lpthread -ldl -lrt | ||
| 602 | |||
| 603 | # Explicit link to libc | ||
| 604 | ifeq ($(RAYLIB_LIBTYPE),SHARED) | ||
| 605 | LDLIBS += -lc | ||
| 606 | endif | ||
| 607 | |||
| 608 | # NOTE: On ARM 32bit arch, miniaudio requires atomics library | ||
| 609 | LDLIBS += -latomic | ||
| 610 | endif | ||
| 611 | ifeq ($(PLATFORM_OS),OSX) | ||
| 612 | # Libraries for Debian MacOS desktop compiling | ||
| 613 | # NOTE: Required packages: libegl1-mesa-dev | ||
| 614 | LDLIBS += -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo | ||
| 615 | endif | ||
| 616 | endif | ||
| 617 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 618 | LDLIBS = -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl | ||
| 619 | ifeq ($(RAYLIB_MODULE_AUDIO),TRUE) | ||
| 620 | LDLIBS += -latomic | ||
| 621 | endif | ||
| 622 | endif | ||
| 623 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 624 | LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm | ||
| 625 | endif | ||
| 626 | |||
| 627 | # Define source code object files required | ||
| 628 | #------------------------------------------------------------------------------------------------ | ||
| 629 | OBJS = rcore.o \ | ||
| 630 | rshapes.o \ | ||
| 631 | rtextures.o \ | ||
| 632 | rtext.o \ | ||
| 633 | utils.o | ||
| 634 | |||
| 635 | ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) | ||
| 636 | ifeq ($(USE_EXTERNAL_GLFW),FALSE) | ||
| 637 | OBJS += rglfw.o | ||
| 638 | endif | ||
| 639 | endif | ||
| 640 | ifeq ($(RAYLIB_MODULE_MODELS),TRUE) | ||
| 641 | OBJS += rmodels.o | ||
| 642 | endif | ||
| 643 | ifeq ($(RAYLIB_MODULE_AUDIO),TRUE) | ||
| 644 | OBJS += raudio.o | ||
| 645 | endif | ||
| 646 | ifeq ($(RAYLIB_MODULE_RAYGUI),TRUE) | ||
| 647 | OBJS += raygui.o | ||
| 648 | endif | ||
| 649 | |||
| 650 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 651 | OBJS += android_native_app_glue.o | ||
| 652 | endif | ||
| 653 | |||
| 654 | # Define processes to execute | ||
| 655 | #------------------------------------------------------------------------------------------------ | ||
| 656 | # Default target entry | ||
| 657 | all: raylib | ||
| 658 | |||
| 659 | # Compile raylib library | ||
| 660 | # NOTE: Release directory is created if not exist | ||
| 661 | raylib: $(OBJS) | ||
| 662 | ifeq ($(TARGET_PLATFORM),PLATFORM_WEB) | ||
| 663 | # Compile raylib libray for web | ||
| 664 | #$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc | ||
| 665 | $(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS) | ||
| 666 | @echo "raylib library generated (lib$(RAYLIB_LIB_NAME).a)!" | ||
| 667 | else | ||
| 668 | ifeq ($(RAYLIB_LIBTYPE),SHARED) | ||
| 669 | ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW)) | ||
| 670 | ifeq ($(PLATFORM_OS),WINDOWS) | ||
| 671 | # NOTE: Linking with provided resource file | ||
| 672 | $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS) | ||
| 673 | @echo "raylib dynamic library ($(RAYLIB_LIB_NAME).dll) and import library (lib$(RAYLIB_LIB_NAME)dll.a) generated!" | ||
| 674 | endif | ||
| 675 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 676 | # Compile raylib shared library version $(RAYLIB_VERSION). | ||
| 677 | # WARNING: you should type "make clean" before doing this target | ||
| 678 | $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS) | ||
| 679 | @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" | ||
| 680 | cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) | ||
| 681 | cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so | ||
| 682 | endif | ||
| 683 | ifeq ($(PLATFORM_OS),OSX) | ||
| 684 | $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib $(OBJS) $(LDFLAGS) $(LDLIBS) | ||
| 685 | install_name_tool -id "@rpath/lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib" $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib | ||
| 686 | @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib)!" | ||
| 687 | cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).dylib | ||
| 688 | cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).dylib lib$(RAYLIB_LIB_NAME).dylib | ||
| 689 | endif | ||
| 690 | ifeq ($(PLATFORM_OS),BSD) | ||
| 691 | # WARNING: you should type "gmake clean" before doing this target | ||
| 692 | $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) | ||
| 693 | @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!" | ||
| 694 | cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so | ||
| 695 | cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so | ||
| 696 | endif | ||
| 697 | endif | ||
| 698 | ifeq ($(TARGET_PLATFORM),PLATFORM_DRM) | ||
| 699 | # Compile raylib shared library version $(RAYLIB_VERSION). | ||
| 700 | # WARNING: you should type "make clean" before doing this target | ||
| 701 | $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS) | ||
| 702 | @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" | ||
| 703 | cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) | ||
| 704 | cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so | ||
| 705 | endif | ||
| 706 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 707 | $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) | ||
| 708 | @echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so)!" | ||
| 709 | # WARNING: symbolic links creation on Windows should be done using mklink command, no ln available | ||
| 710 | ifeq ($(HOST_PLATFORM_OS),LINUX) | ||
| 711 | cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so | ||
| 712 | cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so | ||
| 713 | endif | ||
| 714 | endif | ||
| 715 | else | ||
| 716 | # Compile raylib static library version $(RAYLIB_VERSION) | ||
| 717 | # WARNING: You should type "make clean" before doing this target. | ||
| 718 | $(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS) | ||
| 719 | @echo "raylib static library generated (lib$(RAYLIB_LIB_NAME).a) in $(RAYLIB_RELEASE_PATH)!" | ||
| 720 | endif | ||
| 721 | endif | ||
| 722 | |||
| 723 | # Compile all modules with their prerequisites | ||
| 724 | |||
| 725 | # Prerequisites of core module | ||
| 726 | rcore.o : platforms/*.c | ||
| 727 | |||
| 728 | # Compile core module | ||
| 729 | rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h | ||
| 730 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 731 | |||
| 732 | # Compile rglfw module | ||
| 733 | rglfw.o : rglfw.c | ||
| 734 | $(CC) $(GLFW_OSX) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 735 | |||
| 736 | # Compile shapes module | ||
| 737 | rshapes.o : rshapes.c raylib.h rlgl.h | ||
| 738 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 739 | |||
| 740 | # Compile textures module | ||
| 741 | rtextures.o : rtextures.c raylib.h rlgl.h utils.h | ||
| 742 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 743 | |||
| 744 | # Compile text module | ||
| 745 | rtext.o : rtext.c raylib.h utils.h | ||
| 746 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 747 | |||
| 748 | # Compile utils module | ||
| 749 | utils.o : utils.c utils.h | ||
| 750 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 751 | |||
| 752 | # Compile models module | ||
| 753 | rmodels.o : rmodels.c raylib.h rlgl.h raymath.h | ||
| 754 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 755 | |||
| 756 | # Compile audio module | ||
| 757 | raudio.o : raudio.c raylib.h | ||
| 758 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 759 | |||
| 760 | # Compile raygui module | ||
| 761 | # NOTE: raygui header should be distributed with raylib.h | ||
| 762 | raygui.o : raygui.c | ||
| 763 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 764 | raygui.c: | ||
| 765 | ifeq ($(PLATFORM_SHELL), cmd) | ||
| 766 | @echo #define RAYGUI_IMPLEMENTATION > raygui.c | ||
| 767 | @echo #include "$(RAYLIB_MODULE_RAYGUI_PATH)/raygui.h" >> raygui.c | ||
| 768 | else | ||
| 769 | @echo "#define RAYGUI_IMPLEMENTATION" > raygui.c | ||
| 770 | @echo "#include \"$(RAYLIB_MODULE_RAYGUI_PATH)/raygui.h\"" >> raygui.c | ||
| 771 | endif | ||
| 772 | |||
| 773 | # Compile android_native_app_glue module | ||
| 774 | android_native_app_glue.o : $(NATIVE_APP_GLUE)/android_native_app_glue.c | ||
| 775 | $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) | ||
| 776 | |||
| 777 | # Install generated and needed files to desired directories. | ||
| 778 | # On GNU/Linux and BSDs, there are some standard directories that contain extra | ||
| 779 | # libraries and header files. These directories (often /usr/local/lib and | ||
| 780 | # /usr/local/include) are for libraries that are installed manually | ||
| 781 | # (without a package manager). We'll use /usr/local/lib/raysan5 and /usr/local/include/raysan5 | ||
| 782 | # for our -L and -I specification to simplify management of the raylib source package. | ||
| 783 | # Customize these locations if you like but don't forget to pass them to make | ||
| 784 | # for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig. | ||
| 785 | # HINT: Add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles. | ||
| 786 | # See below and ../examples/Makefile for more information. | ||
| 787 | |||
| 788 | # RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths. | ||
| 789 | DESTDIR ?= /usr/local | ||
| 790 | RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib | ||
| 791 | # RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files. | ||
| 792 | RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include | ||
| 793 | |||
| 794 | install : | ||
| 795 | ifeq ($(ROOT),root) | ||
| 796 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 797 | # Attention! You are root, writing files to $(RAYLIB_INSTALL_PATH) | ||
| 798 | # and $(RAYLIB_H_INSTALL_PATH). Consult this Makefile for more information. | ||
| 799 | # Prepare the environment as needed. | ||
| 800 | mkdir --parents --verbose $(RAYLIB_INSTALL_PATH) | ||
| 801 | mkdir --parents --verbose $(RAYLIB_H_INSTALL_PATH) | ||
| 802 | ifeq ($(RAYLIB_LIBTYPE),SHARED) | ||
| 803 | # Installing raylib to $(RAYLIB_INSTALL_PATH). | ||
| 804 | cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(RAYLIB_INSTALL_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) | ||
| 805 | cd $(RAYLIB_INSTALL_PATH); ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) | ||
| 806 | cd $(RAYLIB_INSTALL_PATH); ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so | ||
| 807 | # Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH. | ||
| 808 | # Not necessary if later embedding RPATH in your executable. See examples/Makefile. | ||
| 809 | ldconfig $(RAYLIB_INSTALL_PATH) | ||
| 810 | else | ||
| 811 | # Installing raylib to $(RAYLIB_INSTALL_PATH). | ||
| 812 | cp --update --verbose $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_INSTALL_PATH)/lib$(RAYLIB_LIB_NAME).a | ||
| 813 | endif | ||
| 814 | # Copying raylib development files to $(RAYLIB_H_INSTALL_PATH). | ||
| 815 | cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h | ||
| 816 | cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h | ||
| 817 | cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h | ||
| 818 | @echo "raylib development files installed/updated!" | ||
| 819 | else | ||
| 820 | @echo "This function currently works on GNU/Linux systems. Add yours today (^;" | ||
| 821 | endif | ||
| 822 | else | ||
| 823 | @echo "Error: Root permissions needed for installation. Try sudo make install" | ||
| 824 | endif | ||
| 825 | |||
| 826 | # Remove raylib dev files installed on the system | ||
| 827 | # NOTE: see 'install' target. | ||
| 828 | uninstall : | ||
| 829 | ifeq ($(ROOT),root) | ||
| 830 | # WARNING: You are root, about to delete items from $(RAYLIB_INSTALL_PATH). | ||
| 831 | # and $(RAYLIB_H_INSTALL_PATH). Please confirm each item. | ||
| 832 | ifeq ($(PLATFORM_OS),LINUX) | ||
| 833 | ifeq ($(RAYLIB_LIBTYPE),SHARED) | ||
| 834 | rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so | ||
| 835 | rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_API_VERSION) | ||
| 836 | rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) | ||
| 837 | # Uncomment to clean up the runtime linker cache. See install target. | ||
| 838 | ldconfig | ||
| 839 | else | ||
| 840 | rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.a | ||
| 841 | endif | ||
| 842 | rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raylib.h | ||
| 843 | rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raymath.h | ||
| 844 | rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.h | ||
| 845 | @echo "raylib development files removed!" | ||
| 846 | else | ||
| 847 | @echo "This function currently works on GNU/Linux systems. Add yours today (^;" | ||
| 848 | endif | ||
| 849 | else | ||
| 850 | @echo "Error: Root permissions needed for uninstallation. Try sudo make uninstall" | ||
| 851 | endif | ||
| 852 | |||
| 853 | .PHONY: clean_shell_cmd clean_shell_sh | ||
| 854 | |||
| 855 | # Clean everything | ||
| 856 | clean: clean_shell_$(PLATFORM_SHELL) | ||
| 857 | @echo "removed all generated files!" | ||
| 858 | |||
| 859 | clean_shell_sh: | ||
| 860 | rm -fv *.o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so* raygui.c $(RAYLIB_RELEASE_PATH)/*-protocol.h $(RAYLIB_RELEASE_PATH)/*-protocol-code.h | ||
| 861 | ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID) | ||
| 862 | rm -fv $(NATIVE_APP_GLUE)/android_native_app_glue.o | ||
| 863 | endif | ||
| 864 | |||
| 865 | # Set specific target variable | ||
| 866 | clean_shell_cmd: SHELL=cmd | ||
| 867 | clean_shell_cmd: | ||
| 868 | del *.o /s | ||
| 869 | cd $(RAYLIB_RELEASE_PATH) & \ | ||
| 870 | del lib$(RAYLIB_LIB_NAME).a /s & \ | ||
| 871 | del lib$(RAYLIB_LIB_NAME)dll.a /s & \ | ||
| 872 | del $(RAYLIB_LIB_NAME).dll /s & \ | ||
| 873 | del raygui.c /s & \ | ||
