Browse Source

[build] Makefile examples modularization

Now examples can be compiled by module, that's useful when compilation fails at some point
Ray 5 years ago
parent
commit
9ce2331cc1
2 changed files with 33 additions and 10 deletions
  1. 32 9
      examples/Makefile
  2. 1 1
      examples/text/text_font_spritefont.c

+ 32 - 9
examples/Makefile

@@ -350,7 +350,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
 endif
 endif
 
 
 # Define all object files required
 # Define all object files required
-EXAMPLES = \
+CORE = \
     core/core_basic_window \
     core/core_basic_window \
     core/core_input_keys \
     core/core_input_keys \
     core/core_input_mouse \
     core/core_input_mouse \
@@ -372,7 +372,9 @@ EXAMPLES = \
     core/core_scissor_test \
     core/core_scissor_test \
     core/core_storage_values \
     core/core_storage_values \
     core/core_vr_simulator \
     core/core_vr_simulator \
-    core/core_loading_thread \
+    core/core_loading_thread
+
+SHAPES = \
     shapes/shapes_basic_shapes \
     shapes/shapes_basic_shapes \
     shapes/shapes_bouncing_ball \
     shapes/shapes_bouncing_ball \
     shapes/shapes_colors_palette \
     shapes/shapes_colors_palette \
@@ -387,7 +389,9 @@ EXAMPLES = \
     shapes/shapes_easings_rectangle_array \
     shapes/shapes_easings_rectangle_array \
     shapes/shapes_draw_ring \
     shapes/shapes_draw_ring \
     shapes/shapes_draw_circle_sector \
     shapes/shapes_draw_circle_sector \
-    shapes/shapes_draw_rectangle_rounded \
+    shapes/shapes_draw_rectangle_rounded
+    
+TEXTURES = \
     textures/textures_logo_raylib \
     textures/textures_logo_raylib \
     textures/textures_mouse_painting \
     textures/textures_mouse_painting \
     textures/textures_rectangle \
     textures/textures_rectangle \
@@ -404,7 +408,9 @@ EXAMPLES = \
     textures/textures_background_scrolling \
     textures/textures_background_scrolling \
     textures/textures_sprite_button \
     textures/textures_sprite_button \
     textures/textures_sprite_explosion \
     textures/textures_sprite_explosion \
-    textures/textures_bunnymark \
+    textures/textures_bunnymark
+    
+TEXT = \
     text/text_raylib_fonts \
     text/text_raylib_fonts \
     text/text_font_spritefont \
     text/text_font_spritefont \
     text/text_font_loading \
     text/text_font_loading \
@@ -414,7 +420,9 @@ EXAMPLES = \
     text/text_input_box \
     text/text_input_box \
     text/text_writing_anim \
     text/text_writing_anim \
     text/text_rectangle_bounds \
     text/text_rectangle_bounds \
-    text/text_unicode \
+    text/text_unicode
+    
+MODELS = \
     models/models_animation \
     models/models_animation \
     models/models_billboard \
     models/models_billboard \
     models/models_box_collisions \
     models/models_box_collisions \
@@ -430,7 +438,9 @@ EXAMPLES = \
     models/models_skybox \
     models/models_skybox \
     models/models_yaw_pitch_roll \
     models/models_yaw_pitch_roll \
     models/models_heightmap \
     models/models_heightmap \
-    models/models_waving_cubes \
+    models/models_waving_cubes
+    
+SHADERS = \
     shaders/shaders_model_shader \
     shaders/shaders_model_shader \
     shaders/shaders_shapes_textures \
     shaders/shaders_shapes_textures \
     shaders/shaders_custom_uniform \
     shaders/shaders_custom_uniform \
@@ -443,12 +453,16 @@ EXAMPLES = \
     shaders/shaders_eratosthenes \
     shaders/shaders_eratosthenes \
     shaders/shaders_basic_lighting \
     shaders/shaders_basic_lighting \
     shaders/shaders_fog \
     shaders/shaders_fog \
-    shaders/shaders_simple_mask \
+    shaders/shaders_simple_mask
+    
+AUDIO = \
     audio/audio_module_playing \
     audio/audio_module_playing \
     audio/audio_music_stream \
     audio/audio_music_stream \
     audio/audio_raw_stream \
     audio/audio_raw_stream \
     audio/audio_sound_loading \
     audio/audio_sound_loading \
-    audio/audio_multichannel_sound \
+    audio/audio_multichannel_sound
+    
+PHYSICS = \
     physics/physics_demo \
     physics/physics_demo \
     physics/physics_friction \
     physics/physics_friction \
     physics/physics_movement \
     physics/physics_movement \
@@ -459,7 +473,16 @@ EXAMPLES = \
 CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
 CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
 
 
 # Default target entry
 # Default target entry
-all: $(EXAMPLES)
+all: $(CORE) $(SHAPES) $(TEXT) $(TEXTURES) $(MODELS) $(SHADERS) $(AUDIO) $(PHYSICS)
+
+core: $(CORE)
+shapes: $(SHAPES)
+text: $(TEXT)
+textures: $(TEXTURES)
+models: $(MODELS)
+shaders: $(SHADERS)
+audio: $(AUDIO)
+physics: $(PHYSICS)
 
 
 # Generic compilation pattern
 # Generic compilation pattern
 # NOTE: Examples must be ready for Android compilation!
 # NOTE: Examples must be ready for Android compilation!

+ 1 - 1
examples/text/text_font_spritefont.c

@@ -78,7 +78,7 @@ int main(void)
     UnloadFont(font2);      // Font unloading
     UnloadFont(font2);      // Font unloading
     UnloadFont(font3);      // Font unloading
     UnloadFont(font3);      // Font unloading
 
 
-    CloseWindow();                // Close window and OpenGL context
+    CloseWindow();          // Close window and OpenGL context
     //--------------------------------------------------------------------------------------
     //--------------------------------------------------------------------------------------
 
 
     return 0;
     return 0;