You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

559 lines
20 KiB

7 years ago
7 years ago
5 years ago
5 years ago
  1. #**************************************************************************************************
  2. #
  3. # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5
  4. #
  5. # Copyright (c) 2013-2020 Ramon Santamaria (@raysan5)
  6. #
  7. # This software is provided "as-is", without any express or implied warranty. In no event
  8. # will the authors be held liable for any damages arising from the use of this software.
  9. #
  10. # Permission is granted to anyone to use this software for any purpose, including commercial
  11. # applications, and to alter it and redistribute it freely, subject to the following restrictions:
  12. #
  13. # 1. The origin of this software must not be misrepresented; you must not claim that you
  14. # wrote the original software. If you use this software in a product, an acknowledgment
  15. # in the product documentation would be appreciated but is not required.
  16. #
  17. # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  18. # as being the original software.
  19. #
  20. # 3. This notice may not be removed or altered from any source distribution.
  21. #
  22. #**************************************************************************************************
  23. .PHONY: all clean
  24. # Define required raylib variables
  25. PROJECT_NAME ?= raylib_examples
  26. RAYLIB_VERSION ?= 3.0.0
  27. RAYLIB_API_VERSION ?= 3
  28. RAYLIB_PATH ?= ..
  29. # Define default options
  30. # One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
  31. PLATFORM ?= PLATFORM_DESKTOP
  32. # Locations of your newly installed library and associated headers. See ../src/Makefile
  33. # On Linux, if you have installed raylib but cannot compile the examples, check that
  34. # the *_INSTALL_PATH values here are the same as those in src/Makefile or point to known locations.
  35. # To enable system-wide compile-time and runtime linking to libraylib.so, run ../src/$ sudo make install RAYLIB_LIBTYPE_SHARED.
  36. # To enable compile-time linking to a special version of libraylib.so, change these variables here.
  37. # To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below.
  38. # If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime,
  39. # the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH.
  40. # RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths.
  41. DESTDIR ?= /usr/local
  42. RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib
  43. # RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files.
  44. RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include
  45. # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll)
  46. RAYLIB_LIBTYPE ?= STATIC
  47. # Build mode for project: DEBUG or RELEASE
  48. BUILD_MODE ?= RELEASE
  49. # Use external GLFW library instead of rglfw module
  50. # TODO: Review usage on Linux. Target version of choice. Switch on -lglfw or -lglfw3
  51. USE_EXTERNAL_GLFW ?= FALSE
  52. # Use Wayland display server protocol on Linux desktop
  53. # by default it uses X11 windowing system
  54. USE_WAYLAND_DISPLAY ?= FALSE
  55. # Determine PLATFORM_OS in case PLATFORM_DESKTOP selected
  56. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  57. # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
  58. # ifeq ($(UNAME),Msys) -> Windows
  59. ifeq ($(OS),Windows_NT)
  60. PLATFORM_OS=WINDOWS
  61. else
  62. UNAMEOS=$(shell uname)
  63. ifeq ($(UNAMEOS),Linux)
  64. PLATFORM_OS=LINUX
  65. endif
  66. ifeq ($(UNAMEOS),FreeBSD)
  67. PLATFORM_OS=BSD
  68. endif
  69. ifeq ($(UNAMEOS),OpenBSD)
  70. PLATFORM_OS=BSD
  71. endif
  72. ifeq ($(UNAMEOS),NetBSD)
  73. PLATFORM_OS=BSD
  74. endif
  75. ifeq ($(UNAMEOS),DragonFly)
  76. PLATFORM_OS=BSD
  77. endif
  78. ifeq ($(UNAMEOS),Darwin)
  79. PLATFORM_OS=OSX
  80. endif
  81. endif
  82. endif
  83. ifeq ($(PLATFORM),PLATFORM_RPI)
  84. UNAMEOS=$(shell uname)
  85. ifeq ($(UNAMEOS),Linux)
  86. PLATFORM_OS=LINUX
  87. endif
  88. endif
  89. ifeq ($(PLATFORM),PLATFORM_DRM)
  90. UNAMEOS=$(shell uname)
  91. ifeq ($(UNAMEOS),Linux)
  92. PLATFORM_OS=LINUX
  93. endif
  94. endif
  95. # RAYLIB_PATH adjustment for different platforms.
  96. # If using GNU make, we can get the full path to the top of the tree. Windows? BSD?
  97. # Required for ldconfig or other tools that do not perform path expansion.
  98. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  99. ifeq ($(PLATFORM_OS),LINUX)
  100. RAYLIB_PREFIX ?= ..
  101. RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX))
  102. endif
  103. endif
  104. # Default path for raylib on Raspberry Pi, if installed in different path, update it!
  105. # This is not currently used by src/Makefile. Not sure of its origin or usage. Refer to wiki.
  106. # TODO: update install: target in src/Makefile for RPI, consider relation to LINUX.
  107. ifeq ($(PLATFORM),PLATFORM_RPI)
  108. RAYLIB_PATH ?= /home/pi/raylib
  109. endif
  110. ifeq ($(PLATFORM),PLATFORM_DRM)
  111. RAYLIB_PATH ?= /home/pi/raylib
  112. endif
  113. ifeq ($(PLATFORM),PLATFORM_WEB)
  114. # Emscripten required variables
  115. EMSDK_PATH ?= C:/emsdk
  116. EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
  117. CLANG_PATH = $(EMSDK_PATH)/upstream/bin
  118. PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4-pywin32_64bit
  119. NODE_PATH = $(EMSDK_PATH)/node/12.18.1_64bit/bin
  120. export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
  121. endif
  122. # Define raylib release directory for compiled library.
  123. # RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version
  124. RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
  125. # EXAMPLE_RUNTIME_PATH embeds a custom runtime location of libraylib.so or other desired libraries
  126. # into each example binary compiled with RAYLIB_LIBTYPE=SHARED. It defaults to RAYLIB_RELEASE_PATH
  127. # so that these examples link at runtime with your version of libraylib.so in ../release/libs/linux
  128. # without formal installation from ../src/Makefile. It aids portability and is useful if you have
  129. # multiple versions of raylib, have raylib installed to a non-standard location, or want to
  130. # bundle libraylib.so with your game. Change it to your liking.
  131. # NOTE: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH,
  132. # The library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over RAYLIB_INSTALL_PATH,
  133. # Implemented for LINUX below with CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH)
  134. # To see the result, run readelf -d core/core_basic_window; looking at the RPATH or RUNPATH attribute.
  135. # To see which libraries a built example is linking to, ldd core/core_basic_window;
  136. # Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing.
  137. EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH)
  138. # Define default C compiler: gcc
  139. # NOTE: define g++ compiler if using C++
  140. CC = gcc
  141. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  142. ifeq ($(PLATFORM_OS),OSX)
  143. # OSX default compiler
  144. CC = clang
  145. endif
  146. ifeq ($(PLATFORM_OS),BSD)
  147. # FreeBSD, OpenBSD, NetBSD, DragonFly default compiler
  148. CC = clang
  149. endif
  150. endif
  151. ifeq ($(PLATFORM),PLATFORM_RPI)
  152. ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
  153. # Define RPI cross-compiler
  154. #CC = armv6j-hardfloat-linux-gnueabi-gcc
  155. CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
  156. endif
  157. endif
  158. ifeq ($(PLATFORM),PLATFORM_WEB)
  159. # HTML5 emscripten compiler
  160. # WARNING: To compile to HTML5, code must be redesigned
  161. # to use emscripten.h and emscripten_set_main_loop()
  162. CC = emcc
  163. endif
  164. # Define default make program: Mingw32-make
  165. MAKE = mingw32-make
  166. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  167. ifeq ($(PLATFORM_OS),LINUX)
  168. MAKE = make
  169. endif
  170. ifeq ($(PLATFORM_OS),OSX)
  171. MAKE = make
  172. endif
  173. endif
  174. # Define compiler flags:
  175. # -O1 defines optimization level
  176. # -g include debug information on compilation
  177. # -s strip unnecessary data from build
  178. # -Wall turns on most, but not all, compiler warnings
  179. # -std=c99 defines C language mode (standard C from 1999 revision)
  180. # -std=gnu99 defines C language mode (GNU C from 1999 revision)
  181. # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
  182. # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
  183. CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces
  184. ifeq ($(BUILD_MODE),DEBUG)
  185. CFLAGS += -g
  186. ifeq ($(PLATFORM),PLATFORM_WEB)
  187. CFLAGS += -s ASSERTIONS=1 --profiling
  188. endif
  189. else
  190. ifeq ($(PLATFORM),PLATFORM_WEB)
  191. CFLAGS += -Os
  192. else
  193. CFLAGS += -s -O1
  194. endif
  195. endif
  196. # Additional flags for compiler (if desired)
  197. #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes
  198. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  199. ifeq ($(PLATFORM_OS),LINUX)
  200. ifeq ($(RAYLIB_LIBTYPE),STATIC)
  201. CFLAGS += -D_DEFAULT_SOURCE
  202. endif
  203. ifeq ($(RAYLIB_LIBTYPE),SHARED)
  204. # Explicitly enable runtime link to libraylib.so
  205. CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH)
  206. endif
  207. endif
  208. endif
  209. ifeq ($(PLATFORM),PLATFORM_RPI)
  210. CFLAGS += -std=gnu99
  211. endif
  212. ifeq ($(PLATFORM),PLATFORM_DRM)
  213. CFLAGS += -std=gnu99 -DEGL_NO_X11
  214. endif
  215. ifeq ($(PLATFORM),PLATFORM_WEB)
  216. # -Os # size optimization
  217. # -O2 # optimization level 2, if used, also set --memory-init-file 0
  218. # -s USE_GLFW=3 # Use glfw3 library (context/input management)
  219. # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
  220. # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
  221. # -s USE_PTHREADS=1 # multithreading support
  222. # -s WASM=0 # disable Web Assembly, emitted by default
  223. # -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow)
  224. # -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter
  225. # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
  226. # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
  227. # --profiling # include information for code profiling
  228. # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
  229. # --preload-file resources # specify a resources folder for data compilation
  230. CFLAGS += -s USE_GLFW=3 -s FORCE_FILESYSTEM=1 -s ASYNCIFY -s TOTAL_MEMORY=67108864 $(dir $<)resources@resources
  231. # NOTE: Simple raylib examples are compiled to be interpreter by emterpreter, that way,
  232. # we can compile same code for ALL platforms with no change required, but, working on bigger
  233. # projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
  234. # logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
  235. # Define a custom shell .html and output extension
  236. CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
  237. EXT = .html
  238. endif
  239. # Define include paths for required headers
  240. # NOTE: Several external required libraries (stb and others)
  241. INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
  242. # Define additional directories containing required header files
  243. ifeq ($(PLATFORM),PLATFORM_RPI)
  244. # RPI required libraries
  245. INCLUDE_PATHS += -I/opt/vc/include
  246. INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux
  247. INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads
  248. endif
  249. ifeq ($(PLATFORM),PLATFORM_DRM)
  250. # DRM required libraries
  251. INCLUDE_PATHS += -I/usr/include/libdrm
  252. endif
  253. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  254. ifeq ($(PLATFORM_OS),BSD)
  255. # Consider -L$(RAYLIB_H_INSTALL_PATH)
  256. INCLUDE_PATHS += -I/usr/local/include
  257. endif
  258. ifeq ($(PLATFORM_OS),LINUX)
  259. # Reset everything.
  260. # Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include
  261. #INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external
  262. INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/release/include -I$(RAYLIB_PATH)/src/external
  263. endif
  264. endif
  265. # Define library paths containing required libs.
  266. LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src
  267. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  268. ifeq ($(PLATFORM_OS),WINDOWS)
  269. # resource file contains windows executable icon and properties
  270. LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data
  271. # -Wl,--subsystem,windows hides the console window
  272. ifeq ($(BUILD_MODE), RELEASE)
  273. LDFLAGS += -Wl,--subsystem,windows
  274. endif
  275. endif
  276. ifeq ($(PLATFORM_OS),BSD)
  277. # Consider -L$(RAYLIB_INSTALL_PATH)
  278. LDFLAGS += -L. -Lsrc -L/usr/local/lib
  279. endif
  280. ifeq ($(PLATFORM_OS),LINUX)
  281. # Reset everything.
  282. # Precedence: immediately local, installed version, raysan5 provided libs
  283. LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
  284. endif
  285. endif
  286. ifeq ($(PLATFORM),PLATFORM_RPI)
  287. LDFLAGS += -L/opt/vc/lib
  288. endif
  289. ifeq ($(PLATFORM),PLATFORM_DRM)
  290. LDFLAGS += -lGLESv2 -lEGL -ldrm -lgbm
  291. endif
  292. # Define any libraries required on linking
  293. # if you want to link libraries (libname.so or libname.a), use the -lname
  294. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  295. ifeq ($(PLATFORM_OS),WINDOWS)
  296. # Libraries for Windows desktop compilation
  297. # NOTE: WinMM library required to set high-res timer resolution
  298. LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm
  299. # Required for physac examples
  300. LDLIBS += -static -lpthread
  301. endif
  302. ifeq ($(PLATFORM_OS),LINUX)
  303. # Libraries for Debian GNU/Linux desktop compiling
  304. # NOTE: Required packages: libegl1-mesa-dev
  305. LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt
  306. # On X11 requires also below libraries
  307. LDLIBS += -lX11
  308. # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them
  309. #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  310. # On Wayland windowing system, additional libraries requires
  311. ifeq ($(USE_WAYLAND_DISPLAY),TRUE)
  312. LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon
  313. endif
  314. # Explicit link to libc
  315. ifeq ($(RAYLIB_LIBTYPE),SHARED)
  316. LDLIBS += -lc
  317. endif
  318. endif
  319. ifeq ($(PLATFORM_OS),OSX)
  320. # Libraries for OSX 10.9 desktop compiling
  321. # NOTE: Required packages: libopenal-dev libegl1-mesa-dev
  322. LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
  323. endif
  324. ifeq ($(PLATFORM_OS),BSD)
  325. # Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling
  326. # NOTE: Required packages: mesa-libs
  327. LDLIBS = -lraylib -lGL -lpthread -lm
  328. # On XWindow requires also below libraries
  329. LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  330. endif
  331. ifeq ($(USE_EXTERNAL_GLFW),TRUE)
  332. # NOTE: It could require additional packages installed: libglfw3-dev
  333. LDLIBS += -lglfw
  334. endif
  335. endif
  336. ifeq ($(PLATFORM),PLATFORM_RPI)
  337. # Libraries for Raspberry Pi compiling
  338. # NOTE: Required packages: libasound2-dev (ALSA)
  339. LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
  340. endif
  341. ifeq ($(PLATFORM),PLATFORM_DRM)
  342. # Libraries for DRM compiling
  343. # NOTE: Required packages: libasound2-dev (ALSA)
  344. LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl
  345. endif
  346. ifeq ($(PLATFORM),PLATFORM_WEB)
  347. # Libraries for web (HTML5) compiling
  348. LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
  349. endif
  350. # Define all object files required
  351. CORE = \
  352. core/core_basic_window \
  353. core/core_input_keys \
  354. core/core_input_mouse \
  355. core/core_input_mouse_wheel \
  356. core/core_input_gamepad \
  357. core/core_input_multitouch \
  358. core/core_input_gestures \
  359. core/core_2d_camera \
  360. core/core_2d_camera_platformer \
  361. core/core_3d_camera_mode \
  362. core/core_3d_camera_free \
  363. core/core_3d_camera_first_person \
  364. core/core_3d_picking \
  365. core/core_world_screen \
  366. core/core_custom_logging \
  367. core/core_window_letterbox \
  368. core/core_drop_files \
  369. core/core_random_values \
  370. core/core_scissor_test \
  371. core/core_storage_values \
  372. core/core_vr_simulator \
  373. core/core_loading_thread \
  374. core/core_quat_conversion
  375. SHAPES = \
  376. shapes/shapes_basic_shapes \
  377. shapes/shapes_bouncing_ball \
  378. shapes/shapes_colors_palette \
  379. shapes/shapes_logo_raylib \
  380. shapes/shapes_logo_raylib_anim \
  381. shapes/shapes_rectangle_scaling \
  382. shapes/shapes_lines_bezier \
  383. shapes/shapes_collision_area \
  384. shapes/shapes_following_eyes \
  385. shapes/shapes_easings_ball_anim \
  386. shapes/shapes_easings_box_anim \
  387. shapes/shapes_easings_rectangle_array \
  388. shapes/shapes_draw_ring \
  389. shapes/shapes_draw_circle_sector \
  390. shapes/shapes_draw_rectangle_rounded
  391. TEXTURES = \
  392. textures/textures_logo_raylib \
  393. textures/textures_mouse_painting \
  394. textures/textures_rectangle \
  395. textures/textures_srcrec_dstrec \
  396. textures/textures_image_drawing \
  397. textures/textures_image_generation \
  398. textures/textures_image_loading \
  399. textures/textures_image_processing \
  400. textures/textures_image_text \
  401. textures/textures_to_image \
  402. textures/textures_raw_data \
  403. textures/textures_particles_blending \
  404. textures/textures_npatch_drawing \
  405. textures/textures_background_scrolling \
  406. textures/textures_sprite_button \
  407. textures/textures_sprite_explosion \
  408. textures/textures_bunnymark \
  409. textures/textures_blend_modes
  410. TEXT = \
  411. text/text_raylib_fonts \
  412. text/text_font_spritefont \
  413. text/text_font_loading \
  414. text/text_font_filters \
  415. text/text_font_sdf \
  416. text/text_format_text \
  417. text/text_input_box \
  418. text/text_writing_anim \
  419. text/text_rectangle_bounds \
  420. text/text_unicode
  421. MODELS = \
  422. models/models_animation \
  423. models/models_billboard \
  424. models/models_box_collisions \
  425. models/models_cubicmap \
  426. models/models_first_person_maze \
  427. models/models_geometric_shapes \
  428. models/models_material_pbr \
  429. models/models_mesh_generation \
  430. models/models_mesh_picking \
  431. models/models_loading \
  432. models/models_orthographic_projection \
  433. models/models_rlgl_solar_system \
  434. models/models_skybox \
  435. models/models_yaw_pitch_roll \
  436. models/models_heightmap \
  437. models/models_waving_cubes
  438. SHADERS = \
  439. shaders/shaders_model_shader \
  440. shaders/shaders_shapes_textures \
  441. shaders/shaders_custom_uniform \
  442. shaders/shaders_postprocessing \
  443. shaders/shaders_palette_switch \
  444. shaders/shaders_raymarching \
  445. shaders/shaders_texture_drawing \
  446. shaders/shaders_texture_waves \
  447. shaders/shaders_julia_set \
  448. shaders/shaders_eratosthenes \
  449. shaders/shaders_basic_lighting \
  450. shaders/shaders_fog \
  451. shaders/shaders_simple_mask \
  452. shaders/shaders_spotlight \
  453. shaders/shaders_rlgl_mesh_instanced
  454. AUDIO = \
  455. audio/audio_module_playing \
  456. audio/audio_music_stream \
  457. audio/audio_raw_stream \
  458. audio/audio_sound_loading \
  459. audio/audio_multichannel_sound
  460. PHYSICS = \
  461. physics/physics_demo \
  462. physics/physics_friction \
  463. physics/physics_movement \
  464. physics/physics_restitution \
  465. physics/physics_shatter
  466. CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
  467. # Default target entry
  468. all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO) $(PHYSICS)
  469. core: $(CORE)
  470. shapes: $(SHAPES)
  471. text: $(TEXT)
  472. textures: $(TEXTURES)
  473. models: $(MODELS)
  474. shaders: $(SHADERS)
  475. audio: $(AUDIO)
  476. physics: $(PHYSICS)
  477. # Generic compilation pattern
  478. # NOTE: Examples must be ready for Android compilation!
  479. %: %.c
  480. ifeq ($(PLATFORM),PLATFORM_ANDROID)
  481. $(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
  482. else
  483. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
  484. endif
  485. # Clean everything
  486. clean:
  487. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  488. ifeq ($(PLATFORM_OS),WINDOWS)
  489. del *.o *.exe /s
  490. endif
  491. ifeq ($(PLATFORM_OS),LINUX)
  492. find . -type f -executable -delete
  493. rm -fv *.o
  494. endif
  495. ifeq ($(PLATFORM_OS),OSX)
  496. find . -type f -perm +ugo+x -delete
  497. rm -f *.o
  498. endif
  499. endif
  500. ifeq ($(PLATFORM),PLATFORM_RPI)
  501. find . -type f -executable -delete
  502. rm -fv *.o
  503. endif
  504. ifeq ($(PLATFORM),PLATFORM_DRM)
  505. find . -type f -executable -delete
  506. rm -fv *.o
  507. endif
  508. ifeq ($(PLATFORM),PLATFORM_WEB)
  509. del *.o *.html *.js
  510. endif
  511. @echo Cleaning done