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.

572 lines
23 KiB

7 years ago
  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. # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
  32. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  33. # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
  34. ifeq ($(OS),Windows_NT)
  35. PLATFORM_OS=WINDOWS
  36. LIBPATH=win32
  37. else
  38. UNAMEOS:=$(shell uname)
  39. ifeq ($(UNAMEOS),Linux)
  40. PLATFORM_OS=LINUX
  41. LIBPATH=linux
  42. else
  43. ifeq ($(UNAMEOS),Darwin)
  44. PLATFORM_OS=OSX
  45. LIBPATH=osx
  46. endif
  47. endif
  48. endif
  49. endif
  50. # define compiler: gcc for C program, define as g++ for C++
  51. ifeq ($(PLATFORM),PLATFORM_WEB)
  52. # define emscripten compiler
  53. CC = emcc
  54. else
  55. ifeq ($(PLATFORM_OS),OSX)
  56. # define llvm compiler for mac
  57. CC = clang
  58. else
  59. # define default gcc compiler
  60. CC = gcc
  61. endif
  62. endif
  63. # define compiler flags:
  64. # -O2 defines optimization level
  65. # -Og enable debugging
  66. # -s strip unnecessary data from build
  67. # -Wall turns on most, but not all, compiler warnings
  68. # -std=c99 defines C language mode (standard C from 1999 revision)
  69. # -std=gnu99 defines C language mode (GNU C from 1999 revision)
  70. # -fgnu89-inline declaring inline functions support (GCC optimized)
  71. # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
  72. # -D_DEFAULT_SOURCE use with -std=c99 on Linux to enable timespec and drflac
  73. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  74. ifeq ($(PLATFORM_OS),WINDOWS)
  75. CFLAGS = -O2 -s -Wall -std=c99
  76. endif
  77. ifeq ($(PLATFORM_OS),LINUX)
  78. CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
  79. endif
  80. ifeq ($(PLATFORM_OS),OSX)
  81. CFLAGS = -O2 -s -Wall -std=c99
  82. endif
  83. endif
  84. ifeq ($(PLATFORM),PLATFORM_WEB)
  85. CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources
  86. # -O2 # if used, also set --memory-init-file 0
  87. # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
  88. #-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
  89. #-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
  90. endif
  91. ifeq ($(PLATFORM),PLATFORM_RPI)
  92. CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
  93. endif
  94. #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
  95. # define raylib release directory for compiled library
  96. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  97. ifeq ($(PLATFORM_OS),WINDOWS)
  98. RAYLIB_PATH = ../release/win32/mingw32
  99. endif
  100. ifeq ($(PLATFORM_OS),LINUX)
  101. RAYLIB_PATH = ../release/linux
  102. endif
  103. ifeq ($(PLATFORM_OS),OSX)
  104. RAYLIB_PATH = ../release/osx
  105. endif
  106. endif
  107. ifeq ($(PLATFORM),PLATFORM_WEB)
  108. RAYLIB_PATH = ../release/html5
  109. endif
  110. ifeq ($(PLATFORM),PLATFORM_RPI)
  111. RAYLIB_PATH = ../release/rpi
  112. endif
  113. # define any directories containing required header files
  114. INCLUDES = -I. -I../src -I../src/external -I$(RAYLIB_PATH)
  115. ifeq ($(PLATFORM),PLATFORM_RPI)
  116. INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
  117. endif
  118. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  119. ifeq ($(PLATFORM_OS),WINDOWS)
  120. # external libraries headers
  121. # GLFW3
  122. INCLUDES += -I../src/external/glfw3/include
  123. # OpenAL Soft
  124. INCLUDES += -I../src/external/openal_soft/include
  125. endif
  126. ifeq ($(PLATFORM_OS),LINUX)
  127. # you may optionally create this directory and install raylib
  128. # and related headers there. Edit ../src/Makefile appropriately.
  129. INCLUDES += -I/usr/local/include/raylib
  130. endif
  131. ifeq ($(PLATFORM_OS),OSX)
  132. # additional directories for MacOS
  133. endif
  134. endif
  135. # define library paths containing required libs
  136. LFLAGS = -L. -L../src -L$(RAYLIB_PATH)
  137. ifeq ($(PLATFORM),PLATFORM_RPI)
  138. LFLAGS += -L/opt/vc/lib
  139. endif
  140. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  141. # add standard directories for GNU/Linux
  142. ifeq ($(PLATFORM_OS),WINDOWS)
  143. # external libraries to link with
  144. # GLFW3
  145. LFLAGS += -L../src/external/glfw3/lib/$(LIBPATH)
  146. # OpenAL Soft
  147. LFLAGS += -L../src/external/openal_soft/lib/$(LIBPATH)
  148. endif
  149. endif
  150. # define any libraries to link into executable
  151. # if you want to link libraries (libname.so or libname.a), use the -lname
  152. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  153. ifeq ($(PLATFORM_OS),LINUX)
  154. # libraries for Debian GNU/Linux desktop compiling
  155. # requires the following packages:
  156. # libglfw3-dev libopenal-dev libegl1-mesa-dev
  157. LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
  158. # on XWindow could require also below libraries, just uncomment
  159. LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
  160. else
  161. ifeq ($(PLATFORM_OS),OSX)
  162. # libraries for OS X 10.9 desktop compiling
  163. # requires the following packages:
  164. # libglfw3-dev libopenal-dev libegl1-mesa-dev
  165. LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
  166. else
  167. # libraries for Windows desktop compiling
  168. # NOTE: GLFW3 and OpenAL Soft libraries should be installed
  169. LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
  170. # if static OpenAL Soft required, define the corresponding libs
  171. ifeq ($(SHARED_OPENAL),NO)
  172. LIBS += -lopenal32 -lwinmm
  173. CFLAGS += -Wl,-allow-multiple-definition
  174. else
  175. LIBS += -lopenal32dll
  176. endif
  177. endif
  178. endif
  179. endif
  180. ifeq ($(PLATFORM),PLATFORM_RPI)
  181. # libraries for Raspberry Pi compiling
  182. # NOTE: OpenAL Soft library should be installed (libopenal1 package)
  183. LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
  184. endif
  185. ifeq ($(PLATFORM),PLATFORM_WEB)
  186. # just adjust the correct path to libraylib.bc
  187. LIBS = ../release/html5/libraylib.bc
  188. endif
  189. # define additional parameters and flags for windows
  190. ifeq ($(PLATFORM_OS),WINDOWS)
  191. # resources file contains windows exe icon
  192. # -Wl,--subsystem,windows hides the console window
  193. WINFLAGS = ../src/resources -Wl,--subsystem,windows
  194. endif
  195. ifeq ($(PLATFORM),PLATFORM_WEB)
  196. EXT = .html
  197. endif
  198. # define all object files required
  199. EXAMPLES = \
  200. core/core_basic_window \
  201. core/core_input_keys \
  202. core/core_input_mouse \
  203. core/core_mouse_wheel \
  204. core/core_input_gamepad \
  205. core/core_random_values \
  206. core/core_color_select \
  207. core/core_drop_files \
  208. core/core_storage_values \
  209. core/core_gestures_detection \
  210. core/core_3d_mode \
  211. core/core_3d_picking \
  212. core/core_3d_camera_free \
  213. core/core_3d_camera_first_person \
  214. core/core_2d_camera \
  215. core/core_world_screen \
  216. core/core_vr_simulator \
  217. shapes/shapes_logo_raylib \
  218. shapes/shapes_basic_shapes \
  219. shapes/shapes_colors_palette \
  220. shapes/shapes_logo_raylib_anim \
  221. textures/textures_logo_raylib \
  222. textures/textures_image_loading \
  223. textures/textures_rectangle \
  224. textures/textures_srcrec_dstrec \
  225. textures/textures_to_image \
  226. textures/textures_raw_data \
  227. textures/textures_formats_loading \
  228. textures/textures_particles_trail_blending \
  229. textures/textures_image_processing \
  230. textures/textures_image_drawing \
  231. text/text_sprite_fonts \
  232. text/text_bmfont_ttf \
  233. text/text_rbmf_fonts \
  234. text/text_format_text \
  235. text/text_font_select \
  236. text/text_writing_anim \
  237. text/text_ttf_loading \
  238. text/text_bmfont_unordered \
  239. models/models_geometric_shapes \
  240. models/models_box_collisions \
  241. models/models_billboard \
  242. models/models_obj_loading \
  243. models/models_heightmap \
  244. models/models_cubicmap \
  245. models/models_ray_picking \
  246. shaders/shaders_model_shader \
  247. shaders/shaders_shapes_textures \
  248. shaders/shaders_custom_uniform \
  249. shaders/shaders_postprocessing \
  250. shaders/shaders_standard_lighting \
  251. audio/audio_sound_loading \
  252. audio/audio_music_stream \
  253. audio/audio_module_playing \
  254. audio/audio_raw_stream \
  255. physac/physics_demo \
  256. physac/physics_friction \
  257. physac/physics_movement \
  258. physac/physics_restitution \
  259. physac/physics_shatter \
  260. fix_dylib \
  261. # typing 'make' will invoke the default target entry called 'all',
  262. # in this case, the 'default' target entry is raylib
  263. all: examples
  264. # compile all examples
  265. examples: $(EXAMPLES)
  266. # compile [core] example - basic window
  267. core/core_basic_window: core/core_basic_window.c
  268. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  269. # compile [core] example - keyboard input
  270. core/core_input_keys: core/core_input_keys.c
  271. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  272. # compile [core] example - mouse input
  273. core/core_input_mouse: core/core_input_mouse.c
  274. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  275. # compile [core] example - mouse wheel
  276. core/core_mouse_wheel: core/core_mouse_wheel.c
  277. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  278. # compile [core] example - gamepad input
  279. core/core_input_gamepad: core/core_input_gamepad.c
  280. ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
  281. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  282. else
  283. @echo core_input_gamepad: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
  284. endif
  285. # compile [core] example - generate random values
  286. core/core_random_values: core/core_random_values.c
  287. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  288. # compile [core] example - color selection (collision detection)
  289. core/core_color_select: core/core_color_select.c
  290. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  291. # compile [core] example - drop files
  292. core/core_drop_files: core/core_drop_files.c
  293. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  294. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  295. else
  296. @echo core_drop_files: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB or PLATFORM_RPI
  297. endif
  298. # compile [core] example - storage values
  299. core/core_storage_values: core/core_storage_values.c
  300. ifeq ($(PLATFORM), $(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_RPI))
  301. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  302. else
  303. @echo core_storage_values: Example not supported on PLATFORM_ANDROID or PLATFORM_WEB
  304. endif
  305. # compile [core] example - gestures detection
  306. core/core_gestures_detection: core/core_gestures_detection.c
  307. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  308. # compile [core] example - 3d mode
  309. core/core_3d_mode: core/core_3d_mode.c
  310. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  311. # compile [core] example - 3d picking
  312. core/core_3d_picking: core/core_3d_picking.c
  313. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  314. # compile [core] example - 3d camera free
  315. core/core_3d_camera_free: core/core_3d_camera_free.c
  316. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  317. # compile [core] example - 3d camera first person
  318. core/core_3d_camera_first_person: core/core_3d_camera_first_person.c
  319. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  320. # compile [core] example - 2d camera
  321. core/core_2d_camera: core/core_2d_camera.c
  322. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  323. # compile [core] example - world screen
  324. core/core_world_screen: core/core_world_screen.c
  325. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  326. # compile [core] example - vr simulator
  327. core/core_vr_simulator: core/core_vr_simulator.c
  328. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  329. # compile [shapes] example - raylib logo (with basic shapes)
  330. shapes/shapes_logo_raylib: shapes/shapes_logo_raylib.c
  331. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  332. # compile [shapes] example - basic shapes usage (rectangle, circle, ...)
  333. shapes/shapes_basic_shapes: shapes/shapes_basic_shapes.c
  334. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  335. # compile [shapes] example - raylib color palette
  336. shapes/shapes_colors_palette: shapes/shapes_colors_palette.c
  337. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  338. # compile [shapes] example - raylib logo animation
  339. shapes/shapes_logo_raylib_anim: shapes/shapes_logo_raylib_anim.c
  340. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  341. # compile [textures] example - raylib logo texture loading
  342. textures/textures_logo_raylib: textures/textures_logo_raylib.c
  343. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  344. # compile [textures] example - image loading and conversion to texture
  345. textures/textures_image_loading: textures/textures_image_loading.c
  346. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  347. # compile [textures] example - texture rectangle drawing
  348. textures/textures_rectangle: textures/textures_rectangle.c
  349. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  350. # compile [textures] example - texture source and destination rectangles
  351. textures/textures_srcrec_dstrec: textures/textures_srcrec_dstrec.c
  352. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  353. # compile [textures] example - texture to image
  354. textures/textures_to_image: textures/textures_to_image.c
  355. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  356. # compile [textures] example - texture raw data
  357. textures/textures_raw_data: textures/textures_raw_data.c
  358. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  359. # compile [textures] example - texture formats loading
  360. textures/textures_formats_loading: textures/textures_formats_loading.c
  361. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  362. # compile [textures] example - texture particles trail blending
  363. textures/textures_particles_trail_blending: textures/textures_particles_trail_blending.c
  364. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  365. # compile [textures] example - texture image processing
  366. textures/textures_image_processing: textures/textures_image_processing.c
  367. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  368. # compile [textures] example - texture image drawing
  369. textures/textures_image_drawing: textures/textures_image_drawing.c
  370. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  371. # compile [text] example - sprite fonts loading
  372. text/text_sprite_fonts: text/text_sprite_fonts.c
  373. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  374. # compile [text] example - bmfonts and ttf loading
  375. text/text_bmfont_ttf: text/text_bmfont_ttf.c
  376. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  377. # compile [text] example - raylib bitmap fonts (rBMF)
  378. text/text_rbmf_fonts: text/text_rbmf_fonts.c
  379. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  380. # compile [text] example - text formatting
  381. text/text_format_text: text/text_format_text.c
  382. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  383. # compile [text] example - font selection program
  384. text/text_font_select: text/text_font_select.c
  385. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  386. # compile [text] example - text writing animation
  387. text/text_writing_anim: text/text_writing_anim.c
  388. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  389. # compile [text] example - text ttf loading
  390. text/text_ttf_loading: text/text_ttf_loading.c
  391. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  392. # compile [text] example - text bmfont unordered
  393. text/text_bmfont_unordered: text/text_bmfont_unordered.c
  394. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  395. # compile [models] example - basic geometric 3d shapes
  396. models/models_geometric_shapes: models/models_geometric_shapes.c
  397. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  398. # compile [models] example - box collisions
  399. models/models_box_collisions: models/models_box_collisions.c
  400. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  401. # compile [models] example - basic window
  402. models/models_planes: models/models_planes.c
  403. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  404. # compile [models] example - billboard usage
  405. models/models_billboard: models/models_billboard.c
  406. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  407. # compile [models] example - OBJ model loading
  408. models/models_obj_loading: models/models_obj_loading.c
  409. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  410. # compile [models] example - heightmap loading
  411. models/models_heightmap: models/models_heightmap.c
  412. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  413. # compile [models] example - cubesmap loading
  414. models/models_cubicmap: models/models_cubicmap.c
  415. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  416. # compile [models] example - model ray picking
  417. models/models_ray_picking: models/models_ray_picking.c
  418. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  419. # compile [shaders] example - model shader
  420. shaders/shaders_model_shader: shaders/shaders_model_shader.c
  421. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  422. # compile [shaders] example - shapes texture shader
  423. shaders/shaders_shapes_textures: shaders/shaders_shapes_textures.c
  424. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  425. # compile [shaders] example - custom uniform in shader
  426. shaders/shaders_custom_uniform: shaders/shaders_custom_uniform.c
  427. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  428. # compile [shaders] example - postprocessing shader
  429. shaders/shaders_postprocessing: shaders/shaders_postprocessing.c
  430. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  431. # compile [shaders] example - standard lighting
  432. shaders/shaders_standard_lighting: shaders/shaders_standard_lighting.c
  433. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  434. # compile [audio] example - sound loading and playing (WAV and OGG)
  435. audio/audio_sound_loading: audio/audio_sound_loading.c
  436. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  437. # compile [audio] example - music stream playing (OGG)
  438. audio/audio_music_stream: audio/audio_music_stream.c
  439. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  440. # compile [audio] example - module playing (XM)
  441. audio/audio_module_playing: audio/audio_module_playing.c
  442. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  443. # compile [audio] example - raw audio streaming
  444. audio/audio_raw_stream: audio/audio_raw_stream.c
  445. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
  446. # compile [physac] example - physics demo
  447. physac/physics_demo: physac/physics_demo.c
  448. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
  449. # compile [physac] example - physics friction
  450. physac/physics_friction: physac/physics_friction.c
  451. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
  452. # compile [physac] example - physics movement
  453. physac/physics_movement: physac/physics_movement.c
  454. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
  455. # compile [physac] example - physics restitution
  456. physac/physics_restitution: physac/physics_restitution.c
  457. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
  458. # compile [physac] example - physics shatter
  459. physac/physics_shatter: physac/physics_shatter.c
  460. $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
  461. # fix dylib install path name for each executable (MAC)
  462. fix_dylib:
  463. ifeq ($(PLATFORM_OS),OSX)
  464. 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
  465. endif
  466. # clean everything
  467. clean:
  468. ifeq ($(PLATFORM),PLATFORM_DESKTOP)
  469. ifeq ($(PLATFORM_OS),OSX)
  470. find . -type f -perm +ugo+x -delete
  471. rm -f *.o
  472. else
  473. ifeq ($(PLATFORM_OS),LINUX)
  474. 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
  475. else
  476. del *.o *.exe
  477. endif
  478. endif
  479. endif
  480. ifeq ($(PLATFORM),PLATFORM_RPI)
  481. find . -type f -executable -delete
  482. rm -f *.o
  483. endif
  484. ifeq ($(PLATFORM),PLATFORM_WEB)
  485. del *.o *.html *.js
  486. endif
  487. @echo Cleaning done
  488. # instead of defining every module one by one, we can define a pattern
  489. # this pattern below will automatically compile every module defined on $(OBJS)
  490. #%.exe : %.c
  491. # $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)