makefile 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. #**************************************************************************************************
  2. #
  3. # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
  4. #
  5. # NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library
  6. #
  7. # Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
  8. #
  9. # This software is provided "as-is", without any express or implied warranty. In no event
  10. # will the authors be held liable for any damages arising from the use of this software.
  11. #
  12. # Permission is granted to anyone to use this software for any purpose, including commercial
  13. # applications, and to alter it and redistribute it freely, subject to the following restrictions:
  14. #
  15. # 1. The origin of this software must not be misrepresented; you must not claim that you
  16. # wrote the original software. If you use this software in a product, an acknowledgment
  17. # in the product documentation would be appreciated but is not required.
  18. #
  19. # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
  20. # as being the original software.
  21. #
  22. # 3. This notice may not be removed or altered from any source distribution.
  23. #
  24. #**************************************************************************************************
  25. # define raylib platform to compile for
  26. # possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
  27. # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
  28. PLATFORM ?= PLATFORM_DESKTOP
  29. # define NO to use OpenAL Soft as static library (shared by default)
  30. SHARED_OPENAL ?= YES
  31. ifeq ($(PLATFORM),PLATFORM_WEB)
  32. SHARED_OPENAL = NO
  33. endif
  34. # define raylib directory for include and library
  35. RAYLIB_PATH ?= C:\GitHub\raylib
  36. # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
  37. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  38. # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
  39. ifeq ($(OS),Windows_NT)
  40. PLATFORM_OS=WINDOWS
  41. LIBPATH=win32
  42. else
  43. UNAMEOS:=$(shell uname)
  44. ifeq ($(UNAMEOS),Linux)
  45. PLATFORM_OS=LINUX
  46. LIBPATH=linux
  47. else
  48. ifeq ($(UNAMEOS),Darwin)
  49. PLATFORM_OS=OSX
  50. LIBPATH=osx
  51. endif
  52. endif
  53. endif
  54. endif
  55. ifeq ($(PLATFORM),PLATFORM_WEB)
  56. # Emscripten required variables
  57. EMSDK_PATH = C:/emsdk
  58. EMSCRIPTEN_VERSION = 1.37.9
  59. CLANG_VERSION=e1.37.9_64bit
  60. PYTHON_VERSION=2.7.5.3_64bit
  61. NODE_VERSION=4.1.1_64bit
  62. export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH)
  63. EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION)
  64. endif
  65. # define compiler: gcc for C program, define as g++ for C++
  66. ifeq ($(PLATFORM),PLATFORM_WEB)
  67. # define emscripten compiler
  68. CC = emcc
  69. else
  70. ifeq ($(PLATFORM_OS),OSX)
  71. # define llvm compiler for mac
  72. CC = clang
  73. else
  74. # define default gcc compiler
  75. CC = gcc
  76. endif
  77. endif
  78. # define compiler flags:
  79. # -O2 defines optimization level
  80. # -Og enable debugging
  81. # -s strip unnecessary data from build
  82. # -Wall turns on most, but not all, compiler warnings
  83. # -std=c99 defines C language mode (standard C from 1999 revision)
  84. # -std=gnu99 defines C language mode (GNU C from 1999 revision)
  85. # -fgnu89-inline declaring inline functions support (GCC optimized)
  86. # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
  87. # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
  88. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  89. ifeq ($(PLATFORM_OS),WINDOWS)
  90. CFLAGS = -O2 -s -Wall -std=c99
  91. endif
  92. ifeq ($(PLATFORM_OS),LINUX)
  93. CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
  94. endif
  95. ifeq ($(PLATFORM_OS),OSX)
  96. CFLAGS = -O2 -s -Wall -std=c99
  97. endif
  98. endif
  99. ifeq ($(PLATFORM),PLATFORM_WEB)
  100. CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 --profiling
  101. # -O2 # if used, also set --memory-init-file 0
  102. # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
  103. # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
  104. # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
  105. # --preload-file file.res # embbed file.res resource into .data file
  106. endif
  107. ifeq ($(PLATFORM),PLATFORM_RPI)
  108. CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
  109. endif
  110. #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
  111. # define raylib release directory for compiled library
  112. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  113. ifeq ($(PLATFORM_OS),WINDOWS)
  114. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
  115. endif
  116. ifeq ($(PLATFORM_OS),LINUX)
  117. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
  118. endif
  119. ifeq ($(PLATFORM_OS),OSX)
  120. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
  121. endif
  122. endif
  123. ifeq ($(PLATFORM),PLATFORM_WEB)
  124. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
  125. endif
  126. ifeq ($(PLATFORM),PLATFORM_RPI)
  127. RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
  128. endif
  129. # define any directories containing required header files
  130. INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
  131. ifeq ($(PLATFORM),PLATFORM_RPI)
  132. INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
  133. endif
  134. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  135. ifeq ($(PLATFORM_OS),WINDOWS)
  136. # external libraries headers
  137. # GLFW3
  138. INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
  139. # OpenAL Soft
  140. INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
  141. endif
  142. ifeq ($(PLATFORM_OS),LINUX)
  143. # you may optionally create this directory and install raylib
  144. # and related headers there. Edit ../src/Makefile appropriately.
  145. INCLUDES += -I/usr/local/include/raylib
  146. endif
  147. ifeq ($(PLATFORM_OS),OSX)
  148. # additional directories for MacOS
  149. endif
  150. endif
  151. # define library paths containing required libs
  152. LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
  153. ifeq ($(PLATFORM),PLATFORM_RPI)
  154. LFLAGS += -L/opt/vc/lib
  155. endif
  156. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  157. # add standard directories for GNU/Linux
  158. ifeq ($(PLATFORM_OS),WINDOWS)
  159. # external libraries to link with
  160. # GLFW3
  161. LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
  162. # OpenAL Soft
  163. LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
  164. endif
  165. endif
  166. # define any libraries to link into executable
  167. # if you want to link libraries (libname.so or libname.a), use the -lname
  168. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  169. ifeq ($(PLATFORM_OS),LINUX)
  170. # libraries for Debian GNU/Linux desktop compiling
  171. # requires the following packages:
  172. # libglfw3-dev libopenal-dev libegl1-mesa-dev
  173. LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
  174. # on XWindow could require also below libraries, just uncomment
  175. LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  176. else
  177. ifeq ($(PLATFORM_OS),OSX)
  178. # libraries for OS X 10.9 desktop compiling
  179. # requires the following packages:
  180. # libglfw3-dev libopenal-dev libegl1-mesa-dev
  181. LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
  182. else
  183. # libraries for Windows desktop compiling
  184. # NOTE: GLFW3 and OpenAL Soft libraries should be installed
  185. LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
  186. # if static OpenAL Soft required, define the corresponding libs
  187. ifeq ($(SHARED_OPENAL),NO)
  188. LIBS += -lopenal32 -lwinmm
  189. CFLAGS += -Wl,-allow-multiple-definition
  190. else
  191. LIBS += -lopenal32dll
  192. endif
  193. endif
  194. endif
  195. endif
  196. ifeq ($(PLATFORM),PLATFORM_RPI)
  197. # libraries for Raspberry Pi compiling
  198. # NOTE: OpenAL Soft library should be installed (libopenal1 package)
  199. LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
  200. endif
  201. ifeq ($(PLATFORM),PLATFORM_WEB)
  202. # just adjust the correct path to libraylib.bc
  203. LIBS = $(RAYLIB_RELEASE)/libraylib.bc
  204. endif
  205. # define additional parameters and flags for windows
  206. ifeq ($(PLATFORM_OS),WINDOWS)
  207. # resources file contains windows exe icon
  208. # -Wl,--subsystem,windows hides the console window
  209. WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
  210. endif
  211. ifeq ($(PLATFORM),PLATFORM_WEB)
  212. EXT = .html
  213. WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
  214. endif
  215. # define all object files required
  216. EXAMPLES = \
  217. core/core_basic_window \
  218. core/core_input_keys \
  219. core/core_input_mouse \
  220. core/core_mouse_wheel \
  221. core/core_input_gamepad \
  222. core/core_random_values \
  223. core/core_color_select \
  224. core/core_drop_files \
  225. core/core_storage_values \
  226. core/core_gestures_detection \
  227. core/core_3d_mode \
  228. core/core_3d_picking \
  229. core/core_3d_camera_free \
  230. core/core_3d_camera_first_person \
  231. core/core_2d_camera \
  232. core/core_world_screen \
  233. core/core_vr_simulator \
  234. shapes/shapes_logo_raylib \
  235. shapes/shapes_basic_shapes \
  236. shapes/shapes_colors_palette \
  237. shapes/shapes_logo_raylib_anim \
  238. shapes/shapes_lines_bezier \
  239. textures/textures_logo_raylib \
  240. textures/textures_image_loading \
  241. textures/textures_rectangle \
  242. textures/textures_srcrec_dstrec \
  243. textures/textures_to_image \
  244. textures/textures_raw_data \
  245. textures/textures_particles_blending \
  246. textures/textures_image_processing \
  247. textures/textures_image_drawing \
  248. text/text_sprite_fonts \
  249. text/text_bmfont_ttf \
  250. text/text_raylib_fonts \
  251. text/text_format_text \
  252. text/text_writing_anim \
  253. text/text_ttf_loading \
  254. text/text_bmfont_unordered \
  255. text/text_input_box \
  256. models/models_geometric_shapes \
  257. models/models_box_collisions \
  258. models/models_billboard \
  259. models/models_obj_loading \
  260. models/models_heightmap \
  261. models/models_cubicmap \
  262. models/models_mesh_picking \
  263. shaders/shaders_model_shader \
  264. shaders/shaders_shapes_textures \
  265. shaders/shaders_custom_uniform \
  266. shaders/shaders_postprocessing \
  267. audio/audio_sound_loading \
  268. audio/audio_music_stream \
  269. audio/audio_module_playing \
  270. audio/audio_raw_stream \
  271. physac/physics_demo \
  272. physac/physics_friction \
  273. physac/physics_movement \
  274. physac/physics_restitution \
  275. physac/physics_shatter \
  276. # typing 'make' will invoke the default target entry called 'all',
  277. # in this case, the 'default' target entry is raylib
  278. all: examples
  279. # generic compilation pattern
  280. %: %.c
  281. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  282. # compile all examples
  283. examples: $(EXAMPLES)
  284. # compile [core] example - basic window
  285. core/core_basic_window: core/core_basic_window.c
  286. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  287. # compile [core] example - keyboard input
  288. core/core_input_keys: core/core_input_keys.c
  289. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  290. # compile [core] example - mouse input
  291. core/core_input_mouse: core/core_input_mouse.c
  292. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  293. # compile [core] example - mouse wheel
  294. core/core_mouse_wheel: core/core_mouse_wheel.c
  295. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  296. # compile [core] example - gamepad input
  297. core/core_input_gamepad: core/core_input_gamepad.c
  298. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  299. --preload-file core/resources/ps3.png@resources/ps3.png \
  300. --preload-file core/resources/xbox.png@resources/xbox.png
  301. # compile [core] example - generate random values
  302. core/core_random_values: core/core_random_values.c
  303. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  304. # compile [core] example - color selection (collision detection)
  305. core/core_color_select: core/core_color_select.c
  306. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  307. # compile [core] example - drop files
  308. core/core_drop_files: core/core_drop_files.c
  309. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  310. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  311. else
  312. @echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI
  313. endif
  314. # compile [core] example - storage values
  315. core/core_storage_values: core/core_storage_values.c
  316. ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
  317. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  318. else
  319. @echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
  320. endif
  321. # compile [core] example - gestures detection
  322. core/core_gestures_detection: core/core_gestures_detection.c
  323. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  324. # compile [core] example - 3d mode
  325. core/core_3d_mode: core/core_3d_mode.c
  326. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  327. # compile [core] example - 3d picking
  328. core/core_3d_picking: core/core_3d_picking.c
  329. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  330. # compile [core] example - 3d camera free
  331. core/core_3d_camera_free: core/core_3d_camera_free.c
  332. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  333. # compile [core] example - 3d camera first person
  334. core/core_3d_camera_first_person: core/core_3d_camera_first_person.c
  335. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  336. # compile [core] example - 2d camera
  337. core/core_2d_camera: core/core_2d_camera.c
  338. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  339. # compile [core] example - world screen
  340. core/core_world_screen: core/core_world_screen.c
  341. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  342. # compile [core] example - vr simulator
  343. core/core_vr_simulator: core/core_vr_simulator.c
  344. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  345. # compile [shapes] example - raylib logo (with basic shapes)
  346. shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c
  347. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  348. # compile [shapes] example - basic shapes usage (rectangle, circle, ...)
  349. shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
  350. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  351. # compile [shapes] example - raylib color palette
  352. shapes/shapes_colors_palette: shapes/shapes_colors_palette.c
  353. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  354. # compile [shapes] example - raylib logo animation
  355. shapes/shapes_logo_raylib_anim: shapes/shapes_logo_raylib_anim.c
  356. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  357. # compile [shapes] example - lines bezier
  358. shapes/shapes_lines_bezier: shapes/shapes_lines_bezier.c
  359. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  360. # compile [textures] example - raylib logo texture loading
  361. textures/textures_logo_raylib: textures/textures_logo_raylib.c
  362. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  363. # compile [textures] example - image loading and conversion to texture
  364. textures/textures_image_loading: textures/textures_image_loading.c
  365. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  366. --preload-file textures/resources/raylib_logo.png@resources/raylib_logo.png
  367. # compile [textures] example - texture rectangle drawing
  368. textures/textures_rectangle: textures/textures_rectangle.c
  369. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  370. --preload-file textures/resources/scarfy.png@resources/scarfy.png
  371. # compile [textures] example - texture source and destination rectangles
  372. textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c
  373. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  374. --preload-file textures/resources/scarfy.png@resources/scarfy.png
  375. # compile [textures] example - texture to image
  376. textures/textures_to_image: textures/textures_to_image.c
  377. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  378. --preload-file textures/resources/raylib_logo.png@resources/raylib_logo.png
  379. # compile [textures] example - texture raw data
  380. textures/textures_raw_data: textures/textures_raw_data.c
  381. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  382. --preload-file textures/resources/fudesumi.raw@resources/fudesumi.raw
  383. # compile [textures] example - texture particles blending
  384. textures/textures_particles_blending: textures/textures_particles_blending.c
  385. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  386. --preload-file textures/resources/smoke.png@resources/smoke.png
  387. # compile [textures] example - texture image processing
  388. textures/textures_image_processing: textures/textures_image_processing.c
  389. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  390. --preload-file textures/resources/parrots.png@resources/parrots.png
  391. # compile [textures] example - texture image drawing
  392. textures/textures_image_drawing: textures/textures_image_drawing.c
  393. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  394. --preload-file textures/resources/parrots.png@resources/parrots.png \
  395. --preload-file textures/resources/cat.png@resources/cat.png
  396. # compile [text] example - sprite fonts loading
  397. text/text_sprite_fonts: text/text_sprite_fonts.c
  398. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  399. --preload-file text/resources/custom_mecha.png@resources/custom_mecha.png \
  400. --preload-file text/resources/custom_alagard.png@resources/custom_alagard.png \
  401. --preload-file text/resources/custom_jupiter_crash.png@resources/custom_jupiter_crash.png
  402. # compile [text] example - bmfonts and ttf loading
  403. text/text_bmfont_ttf: text/text_bmfont_ttf.c
  404. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s ALLOW_MEMORY_GROWTH=1 \
  405. --preload-file text/resources/bmfont.fnt@resources/bmfont.fnt \
  406. --preload-file text/resources/bmfont.png@resources/bmfont.png \
  407. --preload-file text/resources/pixantiqua.ttf@resources/pixantiqua.ttf
  408. # compile [text] example - raylib fonts
  409. text/text_raylib_fonts: text/text_raylib_fonts.c
  410. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  411. --preload-file text/resources/fonts/alagard.png@resources/fonts/alagard.png \
  412. --preload-file text/resources/fonts/pixelplay.png@resources/fonts/pixelplay.png \
  413. --preload-file text/resources/fonts/mecha.png@resources/fonts/mecha.png \
  414. --preload-file text/resources/fonts/setback.png@resources/fonts/setback.png \
  415. --preload-file text/resources/fonts/romulus.png@resources/fonts/romulus.png \
  416. --preload-file text/resources/fonts/pixantiqua.png@resources/fonts/pixantiqua.png \
  417. --preload-file text/resources/fonts/alpha_beta.png@resources/fonts/alpha_beta.png \
  418. --preload-file text/resources/fonts/jupiter_crash.png@resources/fonts/jupiter_crash.png
  419. # compile [text] example - text formatting
  420. text/text_format_text: text/text_format_text.c
  421. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  422. # compile [text] example - text writing animation
  423. text/text_writing_anim: text/text_writing_anim.c
  424. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  425. # compile [text] example - text ttf loading
  426. text/text_ttf_loading: text/text_ttf_loading.c
  427. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s ALLOW_MEMORY_GROWTH=1 \
  428. --preload-file text/resources/KAISG.ttf@resources/KAISG.ttf
  429. # compile [text] example - text bmfont unordered
  430. text/text_bmfont_unordered: text/text_bmfont_unordered.c
  431. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  432. --preload-file text/resources/pixantiqua.fnt@resources/pixantiqua.fnt \
  433. --preload-file text/resources/pixantiqua_0.png@resources/pixantiqua_0.png
  434. # compile [text] example - text input box
  435. text/text_input_box: text/text_input_box.c
  436. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  437. # compile [models] example - basic geometric 3d shapes
  438. models/models_geometric_shapes: models/models_geometric_shapes.c
  439. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  440. # compile [models] example - box collisions
  441. models/models_box_collisions: models/models_box_collisions.c
  442. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  443. # compile [models] example - basic window
  444. models/models_planes: models/models_planes.c
  445. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
  446. # compile [models] example - billboard usage
  447. models/models_billboard: models/models_billboard.c
  448. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  449. --preload-file models/resources/billboard.png@resources/billboard.png
  450. # compile [models] example - OBJ model loading
  451. models/models_obj_loading: models/models_obj_loading.c
  452. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s TOTAL_MEMORY=67108864 \
  453. --preload-file models/resources/model/dwarf.obj@resources/model/dwarf.obj \
  454. --preload-file models/resources/model/dwarf_diffuse.png@resources/model/dwarf_diffuse.png
  455. # compile [models] example - heightmap loading
  456. models/models_heightmap: models/models_heightmap.c
  457. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  458. --preload-file models/resources/heightmap.png@resources/heightmap.png
  459. # compile [models] example - cubesmap loading
  460. models/models_cubicmap: models/models_cubicmap.c
  461. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  462. --preload-file models/resources/cubicmap.png@resources/cubicmap.png \
  463. --preload-file models/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png
  464. # compile [models] example - model mesh picking
  465. models/models_mesh_picking: models/models_mesh_picking.c
  466. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  467. --preload-file models/resources/tower.obj@resources/tower.obj \
  468. --preload-file models/resources/tower.png@resources/tower.png
  469. # compile [shaders] example - model shader
  470. shaders/shaders_model_shader: shaders/shaders_model_shader.c
  471. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s TOTAL_MEMORY=67108864 \
  472. --preload-file shaders/resources/model/dwarf.obj@resources/model/dwarf.obj \
  473. --preload-file shaders/resources/model/dwarf_diffuse.png@resources/model/dwarf_diffuse.png \
  474. --preload-file shaders/resources/shaders/glsl100/base.vs@resources/shaders/glsl100/base.vs \
  475. --preload-file shaders/resources/shaders/glsl100/grayscale.fs@resources/shaders/glsl100/grayscale.fs
  476. # compile [shaders] example - shapes texture shader
  477. shaders/shaders_shapes_textures: shaders/shaders_shapes_textures.c
  478. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  479. --preload-file shaders/resources/fudesumi.png@resources/fudesumi.png \
  480. --preload-file shaders/resources/shaders/glsl100/base.vs@resources/shaders/glsl100/base.vs \
  481. --preload-file shaders/resources/shaders/glsl100/grayscale.fs@resources/shaders/glsl100/grayscale.fs
  482. # compile [shaders] example - custom uniform in shader
  483. shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c
  484. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s TOTAL_MEMORY=67108864 \
  485. --preload-file shaders/resources/model/dwarf.obj@resources/model/dwarf.obj \
  486. --preload-file shaders/resources/model/dwarf_diffuse.png@resources/model/dwarf_diffuse.png \
  487. --preload-file shaders/resources/shaders/glsl100/base.vs@resources/shaders/glsl100/base.vs \
  488. --preload-file shaders/resources/shaders/glsl100/swirl.fs@resources/shaders/glsl100/swirl.fs
  489. # compile [shaders] example - postprocessing shader
  490. shaders/shaders_postprocessing: shaders/shaders_postprocessing.c
  491. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s TOTAL_MEMORY=67108864 \
  492. --preload-file shaders/resources/model/dwarf.obj@resources/model/dwarf.obj \
  493. --preload-file shaders/resources/model/dwarf_diffuse.png@resources/model/dwarf_diffuse.png \
  494. --preload-file shaders/resources/shaders/glsl100@resources/shaders/glsl100
  495. # compile [audio] example - sound loading and playing (WAV and OGG)
  496. audio/audio_sound_loading: audio/audio_sound_loading.c
  497. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  498. --preload-file audio/resources/weird.wav@resources/weird.wav \
  499. --preload-file audio/resources/tanatana.ogg@resources/tanatana.ogg
  500. # compile [audio] example - music stream playing (OGG)
  501. audio/audio_music_stream: audio/audio_music_stream.c
  502. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  503. --preload-file audio/resources/guitar_noodling.ogg@resources/guitar_noodling.ogg
  504. # compile [audio] example - module playing (XM)
  505. audio/audio_module_playing: audio/audio_module_playing.c
  506. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) \
  507. --preload-file audio/resources/mini1111.xm@resources/mini1111.xm
  508. # compile [audio] example - raw audio streaming
  509. audio/audio_raw_stream: audio/audio_raw_stream.c
  510. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s ALLOW_MEMORY_GROWTH=1
  511. # compile [physac] example - physics demo
  512. physac/physics_demo: physac/physics_demo.c
  513. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s USE_PTHREADS=1
  514. # compile [physac] example - physics friction
  515. physac/physics_friction: physac/physics_friction.c
  516. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s USE_PTHREADS=1
  517. # compile [physac] example - physics movement
  518. physac/physics_movement: physac/physics_movement.c
  519. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s USE_PTHREADS=1
  520. # compile [physac] example - physics restitution
  521. physac/physics_restitution: physac/physics_restitution.c
  522. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s USE_PTHREADS=1
  523. # compile [physac] example - physics shatter
  524. physac/physics_shatter: physac/physics_shatter.c
  525. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -static -lpthread -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s USE_PTHREADS=1
  526. # fix dylib install path name for each executable (MAC)
  527. fix_dylib:
  528. ifeq ($(PLATFORM_OS),OSX)
  529. find . -type f -perm +ugo+x -print0 | xargs -t -0 -R 1 -I file install_name_tool -change libglfw.3.0.dylib ../external/glfw3/lib/osx/libglfw.3.0.dylib file
  530. endif
  531. # clean everything
  532. clean:
  533. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  534. ifeq ($(PLATFORM_OS),OSX)
  535. find . -type f -perm +ugo+x -delete
  536. rm -f *.o
  537. else
  538. ifeq ($(PLATFORM_OS),LINUX)
  539. find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
  540. else
  541. del *.o *.exe /s
  542. endif
  543. endif
  544. endif
  545. ifeq ($(PLATFORM),PLATFORM_RPI)
  546. find . -type f -executable -delete
  547. rm -f *.o
  548. endif
  549. ifeq ($(PLATFORM),PLATFORM_WEB)
  550. # TODO: Remove all generated files in all folders... avoid deleting loader.html!
  551. del *.o *.html *.js *.data
  552. endif
  553. @echo Cleaning done