[Mesa-dev] [PATCH 06/12] nouveau: share the source lists

Chia-I Wu olvaffe at gmail.com
Wed Aug 24 21:55:59 PDT 2011


From: Chia-I Wu <olv at lunarg.com>

For each driver, factor out C_SOURCES from Makefile to Makefile.sources,
and let Makefile and SConscript share it.
---
 src/gallium/drivers/nouveau/Makefile         |    7 +----
 src/gallium/drivers/nouveau/Makefile.sources |    6 +++++
 src/gallium/drivers/nouveau/SConscript       |    5 +--
 src/gallium/drivers/nv50/Makefile            |   25 +----------------------
 src/gallium/drivers/nv50/Makefile.sources    |   23 ++++++++++++++++++++++
 src/gallium/drivers/nv50/SConscript          |   26 +-----------------------
 src/gallium/drivers/nvc0/Makefile            |   26 +-----------------------
 src/gallium/drivers/nvc0/Makefile.sources    |   24 +++++++++++++++++++++++
 src/gallium/drivers/nvc0/SConscript          |   27 +------------------------
 src/gallium/drivers/nvfx/Makefile            |   24 +---------------------
 src/gallium/drivers/nvfx/Makefile.sources    |   22 +++++++++++++++++++++
 src/gallium/drivers/nvfx/SConscript          |   25 +----------------------
 12 files changed, 91 insertions(+), 149 deletions(-)
 create mode 100644 src/gallium/drivers/nouveau/Makefile.sources
 create mode 100644 src/gallium/drivers/nv50/Makefile.sources
 create mode 100644 src/gallium/drivers/nvc0/Makefile.sources
 create mode 100644 src/gallium/drivers/nvfx/Makefile.sources

diff --git a/src/gallium/drivers/nouveau/Makefile b/src/gallium/drivers/nouveau/Makefile
index aae6d98..eb35c1f 100644
--- a/src/gallium/drivers/nouveau/Makefile
+++ b/src/gallium/drivers/nouveau/Makefile
@@ -7,10 +7,7 @@ LIBRARY_INCLUDES = \
 	$(LIBDRM_CFLAGS) \
 	-I$(TOP)/src/gallium/drivers/nouveau/include
 
-C_SOURCES = nouveau_screen.c \
-            nouveau_fence.c \
-            nouveau_mm.c \
-            nouveau_buffer.c \
-            nouveau_video.c
+# get C_SOURCES
+include Makefile.sources
 
 include ../../Makefile.template
diff --git a/src/gallium/drivers/nouveau/Makefile.sources b/src/gallium/drivers/nouveau/Makefile.sources
new file mode 100644
index 0000000..5a5998b
--- /dev/null
+++ b/src/gallium/drivers/nouveau/Makefile.sources
@@ -0,0 +1,6 @@
+C_SOURCES := \
+	nouveau_screen.c \
+	nouveau_fence.c \
+	nouveau_mm.c \
+	nouveau_buffer.c \
+	nouveau_video.c
diff --git a/src/gallium/drivers/nouveau/SConscript b/src/gallium/drivers/nouveau/SConscript
index fe7af4d..8cbed55 100644
--- a/src/gallium/drivers/nouveau/SConscript
+++ b/src/gallium/drivers/nouveau/SConscript
@@ -4,8 +4,7 @@ env = env.Clone()
 
 nouveau = env.ConvenienceLibrary(
     target = 'nouveau',
-    source = [
-        'nouveau_screen.c',
-    ])
+    source = env.ParserSourceList('Makefile.sources', 'C_SOURCES')
+    )
 
 Export('nouveau')
diff --git a/src/gallium/drivers/nv50/Makefile b/src/gallium/drivers/nv50/Makefile
index 02bcc26..220adf6 100644
--- a/src/gallium/drivers/nv50/Makefile
+++ b/src/gallium/drivers/nv50/Makefile
@@ -3,29 +3,8 @@ include $(TOP)/configs/current
 
 LIBNAME = nv50
 
-C_SOURCES = \
-	nv50_context.c \
-	nv50_draw.c \
-	nv50_formats.c \
-	nv50_miptree.c \
-	nv50_resource.c \
-	nv50_screen.c \
-	nv50_state.c \
-	nv50_state_validate.c \
-	nv50_surface.c \
-	nv50_tex.c \
-	nv50_transfer.c \
-	nv50_vbo.c \
-	nv50_program.c \
-	nv50_shader_state.c \
-	nv50_pc.c \
-	nv50_pc_print.c \
-	nv50_pc_emit.c \
-	nv50_tgsi_to_nc.c \
-	nv50_pc_optimize.c \
-	nv50_pc_regalloc.c \
-	nv50_push.c \
-	nv50_query.c
+# get C_SOURCES
+include Makefile.sources
 
 LIBRARY_INCLUDES = \
 	$(LIBDRM_CFLAGS)
diff --git a/src/gallium/drivers/nv50/Makefile.sources b/src/gallium/drivers/nv50/Makefile.sources
new file mode 100644
index 0000000..756f90b
--- /dev/null
+++ b/src/gallium/drivers/nv50/Makefile.sources
@@ -0,0 +1,23 @@
+C_SOURCES := \
+	nv50_context.c \
+	nv50_draw.c \
+	nv50_formats.c \
+	nv50_miptree.c \
+	nv50_resource.c \
+	nv50_screen.c \
+	nv50_state.c \
+	nv50_state_validate.c \
+	nv50_surface.c \
+	nv50_tex.c \
+	nv50_transfer.c \
+	nv50_vbo.c \
+	nv50_program.c \
+	nv50_shader_state.c \
+	nv50_pc.c \
+	nv50_pc_print.c \
+	nv50_pc_emit.c \
+	nv50_tgsi_to_nc.c \
+	nv50_pc_optimize.c \
+	nv50_pc_regalloc.c \
+	nv50_push.c \
+	nv50_query.c
diff --git a/src/gallium/drivers/nv50/SConscript b/src/gallium/drivers/nv50/SConscript
index 3c8a727..e0484c5 100644
--- a/src/gallium/drivers/nv50/SConscript
+++ b/src/gallium/drivers/nv50/SConscript
@@ -4,29 +4,7 @@ env = env.Clone()
 
 nv50 = env.ConvenienceLibrary(
     target = 'nv50',
-    source = [
-        'nv50_context.c',
-        'nv50_draw.c',
-        'nv50_formats.c',
-        'nv50_miptree.c',
-        'nv50_resource.c',
-        'nv50_screen.c',
-        'nv50_state.c',
-        'nv50_state_validate.c',
-        'nv50_surface.c',
-        'nv50_tex.c',
-        'nv50_transfer.c',
-        'nv50_vbo.c',
-        'nv50_program.c',
-        'nv50_shader_state.c',
-        'nv50_pc.c',
-        'nv50_pc_print.c',
-        'nv50_pc_emit.c',
-        'nv50_tgsi_to_nc.c',
-        'nv50_pc_optimize.c',
-        'nv50_pc_regalloc.c',
-        'nv50_push.c',
-        'nv50_query.c'
-    ])
+    source = env.ParserSourceList('Makefile.sources', 'C_SOURCES')
+    )
 
 Export('nv50')
diff --git a/src/gallium/drivers/nvc0/Makefile b/src/gallium/drivers/nvc0/Makefile
index e1cd188..3a53146 100644
--- a/src/gallium/drivers/nvc0/Makefile
+++ b/src/gallium/drivers/nvc0/Makefile
@@ -3,30 +3,8 @@ include $(TOP)/configs/current
 
 LIBNAME = nvc0
 
-C_SOURCES = \
-	nvc0_context.c \
-	nvc0_draw.c \
-	nvc0_formats.c \
-	nvc0_miptree.c \
-	nvc0_resource.c \
-	nvc0_screen.c \
-	nvc0_state.c \
-	nvc0_state_validate.c \
-	nvc0_surface.c \
-	nvc0_tex.c \
-	nvc0_transfer.c \
-	nvc0_vbo.c \
-	nvc0_program.c \
-	nvc0_shader_state.c \
-	nvc0_pc.c \
-	nvc0_pc_print.c \
-	nvc0_pc_emit.c \
-	nvc0_tgsi_to_nc.c \
-	nvc0_pc_optimize.c \
-	nvc0_pc_regalloc.c \
-	nvc0_push.c \
-	nvc0_push2.c \
-	nvc0_query.c
+# get C_SOURCES
+include Makefile.sources
 
 LIBRARY_INCLUDES = \
 	$(LIBDRM_CFLAGS)
diff --git a/src/gallium/drivers/nvc0/Makefile.sources b/src/gallium/drivers/nvc0/Makefile.sources
new file mode 100644
index 0000000..a057f06
--- /dev/null
+++ b/src/gallium/drivers/nvc0/Makefile.sources
@@ -0,0 +1,24 @@
+C_SOURCES := \
+	nvc0_context.c \
+	nvc0_draw.c \
+	nvc0_formats.c \
+	nvc0_miptree.c \
+	nvc0_resource.c \
+	nvc0_screen.c \
+	nvc0_state.c \
+	nvc0_state_validate.c \
+	nvc0_surface.c \
+	nvc0_tex.c \
+	nvc0_transfer.c \
+	nvc0_vbo.c \
+	nvc0_program.c \
+	nvc0_shader_state.c \
+	nvc0_pc.c \
+	nvc0_pc_print.c \
+	nvc0_pc_emit.c \
+	nvc0_tgsi_to_nc.c \
+	nvc0_pc_optimize.c \
+	nvc0_pc_regalloc.c \
+	nvc0_push.c \
+	nvc0_push2.c \
+	nvc0_query.c
diff --git a/src/gallium/drivers/nvc0/SConscript b/src/gallium/drivers/nvc0/SConscript
index dbbbf66..eb32373 100644
--- a/src/gallium/drivers/nvc0/SConscript
+++ b/src/gallium/drivers/nvc0/SConscript
@@ -4,30 +4,7 @@ env = env.Clone()
 
 nvc0 = env.ConvenienceLibrary(
     target = 'nvc0',
-    source = [
-        'nvc0_context.c',
-        'nvc0_draw.c',
-        'nvc0_formats.c',
-        'nvc0_miptree.c',
-        'nvc0_resource.c',
-        'nvc0_screen.c',
-        'nvc0_state.c',
-        'nvc0_state_validate.c',
-        'nvc0_surface.c',
-        'nvc0_tex.c',
-        'nvc0_transfer.c',
-        'nvc0_vbo.c',
-        'nvc0_program.c',
-        'nvc0_shader_state.c',
-        'nvc0_pc.c',
-        'nvc0_pc_print.c',
-        'nvc0_pc_emit.c',
-        'nvc0_tgsi_to_nc.c',
-        'nvc0_pc_optimize.c',
-        'nvc0_pc_regalloc.c',
-        'nvc0_push.c',
-        'nvc0_push2.c',
-        'nvc0_query.c'
-    ])
+    source = env.ParserSourceList('Makefile.sources', 'C_SOURCES')
+    )
 
 Export('nvc0')
diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile
index a3b76ac..53292d6 100644
--- a/src/gallium/drivers/nvfx/Makefile
+++ b/src/gallium/drivers/nvfx/Makefile
@@ -3,28 +3,8 @@ include $(TOP)/configs/current
 
 LIBNAME = nvfx
 
-C_SOURCES = \
-	nv04_2d.c \
-	nvfx_buffer.c \
-	nvfx_context.c \
-	nvfx_clear.c \
-	nvfx_draw.c \
-	nvfx_fragprog.c \
-	nvfx_fragtex.c \
-	nv30_fragtex.c \
-	nv40_fragtex.c \
-	nvfx_miptree.c \
-	nvfx_push.c \
-	nvfx_query.c \
-	nvfx_resource.c \
-	nvfx_screen.c \
-	nvfx_state.c \
-	nvfx_state_emit.c \
-	nvfx_state_fb.c \
-	nvfx_surface.c \
-	nvfx_transfer.c \
-	nvfx_vbo.c \
-	nvfx_vertprog.c
+# get C_SOURCES
+include Makefile.sources
 
 LIBRARY_INCLUDES = \
 	$(LIBDRM_CFLAGS) \
diff --git a/src/gallium/drivers/nvfx/Makefile.sources b/src/gallium/drivers/nvfx/Makefile.sources
new file mode 100644
index 0000000..31611f7
--- /dev/null
+++ b/src/gallium/drivers/nvfx/Makefile.sources
@@ -0,0 +1,22 @@
+C_SOURCES := \
+	nv04_2d.c \
+	nvfx_buffer.c \
+	nvfx_context.c \
+	nvfx_clear.c \
+	nvfx_draw.c \
+	nvfx_fragprog.c \
+	nvfx_fragtex.c \
+	nv30_fragtex.c \
+	nv40_fragtex.c \
+	nvfx_miptree.c \
+	nvfx_push.c \
+	nvfx_query.c \
+	nvfx_resource.c \
+	nvfx_screen.c \
+	nvfx_state.c \
+	nvfx_state_emit.c \
+	nvfx_state_fb.c \
+	nvfx_surface.c \
+	nvfx_transfer.c \
+	nvfx_vbo.c \
+	nvfx_vertprog.c
diff --git a/src/gallium/drivers/nvfx/SConscript b/src/gallium/drivers/nvfx/SConscript
index f1041e7..4f57662 100644
--- a/src/gallium/drivers/nvfx/SConscript
+++ b/src/gallium/drivers/nvfx/SConscript
@@ -8,28 +8,7 @@ env.PrependUnique(delete_existing=1, CPPPATH = [
 
 nvfx = env.ConvenienceLibrary(
     target = 'nvfx',
-    source = [
-        'nv04_2d.c',
-        'nvfx_buffer.c',
-        'nvfx_context.c',
-        'nvfx_clear.c',
-        'nvfx_draw.c',
-        'nvfx_fragprog.c',
-        'nvfx_fragtex.c',
-        'nv30_fragtex.c',
-        'nv40_fragtex.c',
-        'nvfx_miptree.c',
-        'nvfx_push.c',
-        'nvfx_query.c',
-        'nvfx_resource.c',
-        'nvfx_screen.c',
-        'nvfx_state.c',
-        'nvfx_state_emit.c',
-        'nvfx_state_fb.c',
-        'nvfx_surface.c',
-        'nvfx_transfer.c',
-        'nvfx_vbo.c',
-        'nvfx_vertprog.c',
-    ])
+    source = env.ParserSourceList('Makefile.sources', 'C_SOURCES')
+    )
 
 Export('nvfx')
-- 
1.7.5.4



More information about the mesa-dev mailing list