[Mesa-dev] [PATCH 23/37] gallium/drivers: compact compiler flags into Automake.inc

Emil Velikov emil.l.velikov at gmail.com
Sat Nov 2 12:00:53 PDT 2013


* minimise flags duplication
* distingush between VISIBILITY C and CXX flags
* set only required flags - C and/or CXX

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/Automake.inc                  | 22 ++++++++++++++++++++++
 src/gallium/drivers/freedreno/Makefile.am | 10 ++++------
 src/gallium/drivers/galahad/Makefile.am   |  4 +---
 src/gallium/drivers/i915/Makefile.am      |  8 +++-----
 src/gallium/drivers/identity/Makefile.am  |  4 +---
 src/gallium/drivers/ilo/Makefile.am       |  8 ++------
 src/gallium/drivers/llvmpipe/Makefile.am  | 13 ++++++-------
 src/gallium/drivers/noop/Makefile.am      |  4 +---
 src/gallium/drivers/nouveau/Makefile.am   | 10 ++++------
 src/gallium/drivers/r300/Makefile.am      | 12 +++++-------
 src/gallium/drivers/r600/Makefile.am      | 28 ++++++++++------------------
 src/gallium/drivers/radeon/Makefile.am    | 22 +++++++++++-----------
 src/gallium/drivers/radeonsi/Makefile.am  | 14 +++++---------
 src/gallium/drivers/rbug/Makefile.am      | 13 +++----------
 src/gallium/drivers/softpipe/Makefile.am  |  7 ++-----
 src/gallium/drivers/svga/Makefile.am      |  9 ++-------
 src/gallium/drivers/trace/Makefile.am     |  3 +--
 17 files changed, 83 insertions(+), 108 deletions(-)

diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index fabc2af..5cb0b26 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -3,3 +3,25 @@ GALLIUM_CFLAGS = \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
 	$(DEFINES)
+
+# src/gallium/auxiliary must appear before src/gallium/drivers
+# because there are stupidly two rbug_context.h files in
+# different directories, and which one is included by the
+# preprocessor is determined by the ordering of the -I flags.
+GALLIUM_DRIVER_CFLAGS = \
+	-I$(srcdir)/include \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/src/gallium/include \
+	-I$(top_srcdir)/src/gallium/auxiliary \
+	-I$(top_srcdir)/src/gallium/drivers \
+	$(DEFINES) \
+	$(VISIBILITY_CFLAGS)
+
+GALLIUM_DRIVER_CXXFLAGS = \
+	-I$(srcdir)/include \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/src/gallium/include \
+	-I$(top_srcdir)/src/gallium/auxiliary \
+	-I$(top_srcdir)/src/gallium/drivers \
+	$(DEFINES) \
+	$(VISIBILITY_CXXFLAGS)
diff --git a/src/gallium/drivers/freedreno/Makefile.am b/src/gallium/drivers/freedreno/Makefile.am
index a7b307a..7947dd1 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -3,16 +3,14 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libfreedreno.la
-
 AM_CFLAGS = \
 	-Wno-packed-bitfield-compat \
-	-I$(top_srcdir)/src/gallium/drivers \
 	-I$(top_srcdir)/src/gallium/drivers/freedreno/a3xx \
 	-I$(top_srcdir)/src/gallium/drivers/freedreno/a2xx \
-	$(GALLIUM_CFLAGS) \
-	$(FREEDRENO_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS) \
+	$(FREEDRENO_CFLAGS)
+
+noinst_LTLIBRARIES = libfreedreno.la
 
 libfreedreno_la_SOURCES = \
 	$(C_SOURCES) \
diff --git a/src/gallium/drivers/galahad/Makefile.am b/src/gallium/drivers/galahad/Makefile.am
index 5f64b93..17572c3 100644
--- a/src/gallium/drivers/galahad/Makefile.am
+++ b/src/gallium/drivers/galahad/Makefile.am
@@ -7,9 +7,7 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS)
 
 noinst_LTLIBRARIES = libgalahad.la
 
diff --git a/src/gallium/drivers/i915/Makefile.am b/src/gallium/drivers/i915/Makefile.am
index 4e6f464..a4a3e86 100644
--- a/src/gallium/drivers/i915/Makefile.am
+++ b/src/gallium/drivers/i915/Makefile.am
@@ -23,11 +23,9 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libi915.la
+AM_CFLAGS = \
+	$(GALLIUM_DRIVER_CFLAGS)
 
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	$(GALLIUM_CFLAGS)
+noinst_LTLIBRARIES = libi915.la
 
 libi915_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/drivers/identity/Makefile.am b/src/gallium/drivers/identity/Makefile.am
index 1caf328..7fcbc7c 100644
--- a/src/gallium/drivers/identity/Makefile.am
+++ b/src/gallium/drivers/identity/Makefile.am
@@ -2,9 +2,7 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS)
 
 noinst_LTLIBRARIES = libidentity.la
 
diff --git a/src/gallium/drivers/ilo/Makefile.am b/src/gallium/drivers/ilo/Makefile.am
index b5f6400..04d4da8 100644
--- a/src/gallium/drivers/ilo/Makefile.am
+++ b/src/gallium/drivers/ilo/Makefile.am
@@ -26,14 +26,10 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libilo.la
-
 AM_CPPFLAGS = \
-	-I$(srcdir)/include \
 	-I$(top_srcdir)/src/gallium/winsys/intel \
-	$(GALLIUM_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS)
 
-AM_CFLAGS = \
-	$(VISIBILITY_CFLAGS)
+noinst_LTLIBRARIES = libilo.la
 
 libilo_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/drivers/llvmpipe/Makefile.am b/src/gallium/drivers/llvmpipe/Makefile.am
index 1a1a575..4f881bb 100644
--- a/src/gallium/drivers/llvmpipe/Makefile.am
+++ b/src/gallium/drivers/llvmpipe/Makefile.am
@@ -23,13 +23,12 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
-AM_CFLAGS = $(LLVM_CFLAGS)
-AM_CXXFLAGS= $(LLVM_CXXFLAGS)
+AM_CFLAGS = \
+	$(GALLIUM_DRIVER_CFLAGS) \
+	$(LLVM_CFLAGS)
+AM_CXXFLAGS= \
+	$(GALLIUM_DRIVER_CXXFLAGS) \
+	$(LLVM_CXXFLAGS)
 
 noinst_LTLIBRARIES = libllvmpipe.la
 
diff --git a/src/gallium/drivers/noop/Makefile.am b/src/gallium/drivers/noop/Makefile.am
index 1f4ba02..cda614d 100644
--- a/src/gallium/drivers/noop/Makefile.am
+++ b/src/gallium/drivers/noop/Makefile.am
@@ -7,9 +7,7 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS)
 
 noinst_LTLIBRARIES = libnoop.la
 
diff --git a/src/gallium/drivers/nouveau/Makefile.am b/src/gallium/drivers/nouveau/Makefile.am
index 369dada..7c05223 100644
--- a/src/gallium/drivers/nouveau/Makefile.am
+++ b/src/gallium/drivers/nouveau/Makefile.am
@@ -25,14 +25,12 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libnouveau.la
-
 AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers/nouveau/include \
-	$(GALLIUM_CFLAGS) \
+	$(GALLIUM_DRIVER_CFLAGS) \
 	$(LIBDRM_CFLAGS) \
-	$(NOUVEAU_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(NOUVEAU_CFLAGS)
+
+noinst_LTLIBRARIES = libnouveau.la
 
 libnouveau_la_SOURCES = \
 	$(C_SOURCES) \
diff --git a/src/gallium/drivers/r300/Makefile.am b/src/gallium/drivers/r300/Makefile.am
index 9d66003..8aa6707 100644
--- a/src/gallium/drivers/r300/Makefile.am
+++ b/src/gallium/drivers/r300/Makefile.am
@@ -3,21 +3,19 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libr300.la libr300-helper.la
-check_PROGRAMS = r300_compiler_tests
-TESTS = r300_compiler_tests
-
 AM_CFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
 	-I$(top_srcdir)/src/mesa/program \
 	-I$(top_srcdir)/src/mesa \
 	-I$(top_srcdir)/src/glsl \
 	-I$(top_srcdir)/src/mapi \
-	$(VISIBILITY_CFLAGS) \
-	$(GALLIUM_CFLAGS) \
+	$(GALLIUM_DRIVER_CFLAGS) \
 	$(LLVM_CFLAGS) \
 	$(RADEON_CFLAGS)
 
+noinst_LTLIBRARIES = libr300.la libr300-helper.la
+check_PROGRAMS = r300_compiler_tests
+TESTS = r300_compiler_tests
+
 r300_compiler_tests_LDADD = libr300.la libr300-helper.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(GALLIUM_DRI_LIB_DEPS)
diff --git a/src/gallium/drivers/r600/Makefile.am b/src/gallium/drivers/r600/Makefile.am
index cede6fa..b2e3708 100644
--- a/src/gallium/drivers/r600/Makefile.am
+++ b/src/gallium/drivers/r600/Makefile.am
@@ -3,23 +3,15 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libr600.la
-
 AM_CFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	$(GALLIUM_CFLAGS) \
-	$(RADEON_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS) \
+	$(RADEON_CFLAGS)
 
 AM_CXXFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	-I$(top_srcdir)/src/gallium/include \
-	-I$(top_srcdir)/src/gallium/auxiliary \
-	$(RADEON_CFLAGS) \
-	$(DEFINES) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CXXFLAGS) \
+	$(RADEON_CFLAGS)
+
+noinst_LTLIBRARIES = libr600.la
 
 libr600_la_SOURCES = \
 	$(C_SOURCES) \
@@ -29,15 +21,15 @@ libr600_la_LIBADD = ../radeon/libradeon.la
 
 if NEED_RADEON_LLVM
 
+AM_CFLAGS += \
+	$(LLVM_CFLAGS) \
+	-I$(top_srcdir)/src/gallium/drivers/radeon/
+
 libr600_la_SOURCES += \
 	$(LLVM_C_SOURCES)
 
 libr600_la_LIBADD += ../radeon/libllvmradeon.la
 
-AM_CFLAGS += \
-	$(LLVM_CFLAGS) \
-	-I$(top_srcdir)/src/gallium/drivers/radeon/
-
 endif
 
 if USE_R600_LLVM_COMPILER
diff --git a/src/gallium/drivers/radeon/Makefile.am b/src/gallium/drivers/radeon/Makefile.am
index a54a3aa..457fee9 100644
--- a/src/gallium/drivers/radeon/Makefile.am
+++ b/src/gallium/drivers/radeon/Makefile.am
@@ -1,29 +1,26 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libradeon.la
 
-AM_CFLAGS = $(GALLIUM_CFLAGS) $(RADEON_CFLAGS) $(VISIBILITY_CFLAGS)
+AM_CFLAGS = \
+	$(GALLIUM_DRIVER_CFLAGS) \
+	$(RADEON_CFLAGS)
+
+noinst_LTLIBRARIES = libradeon.la
 
 libradeon_la_SOURCES = \
 	$(C_SOURCES)
 
 if NEED_RADEON_LLVM
 
-libllvmradeon_la_LDFLAGS = \
-	$(LLVM_LDFLAGS)
-
 noinst_LTLIBRARIES += libllvmradeon.la
 
 libllvmradeon_la_CXXFLAGS = \
-	$(GALLIUM_CFLAGS) \
-	$(DEFINES) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CXXFLAGS)
 
 libllvmradeon_la_CFLAGS = \
-	$(GALLIUM_CFLAGS) \
-	$(LLVM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS) \
+	$(LLVM_CFLAGS)
 
 libllvmradeon_la_SOURCES = \
 	$(LLVM_CPP_FILES) \
@@ -34,4 +31,7 @@ libllvmradeon_la_LIBADD = \
 	$(LLVM_LIBS) \
 	$(ELF_LIB)
 
+libllvmradeon_la_LDFLAGS = \
+	$(LLVM_LDFLAGS)
+
 endif
diff --git a/src/gallium/drivers/radeonsi/Makefile.am b/src/gallium/drivers/radeonsi/Makefile.am
index 9aaab8f..4c2dd30 100644
--- a/src/gallium/drivers/radeonsi/Makefile.am
+++ b/src/gallium/drivers/radeonsi/Makefile.am
@@ -23,17 +23,13 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libradeonsi.la
-
-AM_CPPFLAGS = \
+AM_CFLAGS = \
 	-I$(top_srcdir)/src/gallium/drivers/radeon \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	$(GALLIUM_CFLAGS) \
+	$(GALLIUM_DRIVER_CFLAGS) \
 	$(RADEON_CFLAGS)
-AM_CFLAGS = \
-	$(LLVM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(LLVM_CFLAGS)
+
+noinst_LTLIBRARIES = libradeonsi.la
 
 libradeonsi_la_SOURCES = $(C_SOURCES)
 libradeonsi_la_LIBADD = \
diff --git a/src/gallium/drivers/rbug/Makefile.am b/src/gallium/drivers/rbug/Makefile.am
index 1aa6521..5de7213 100644
--- a/src/gallium/drivers/rbug/Makefile.am
+++ b/src/gallium/drivers/rbug/Makefile.am
@@ -23,16 +23,9 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = librbug.la
-
-# GALLIUM_CFLAGS must appear before src/gallium/drivers
-# because there are stupidly two rbug_context.h files in
-# different directories, and which one is included by the
-# preprocessor is determined by the ordering of the -I flags.
 AM_CFLAGS = \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS) \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include
+	$(GALLIUM_DRIVER_CFLAGS)
+
+noinst_LTLIBRARIES = librbug.la
 
 librbug_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/drivers/softpipe/Makefile.am b/src/gallium/drivers/softpipe/Makefile.am
index 1048d85..f37c4a6 100644
--- a/src/gallium/drivers/softpipe/Makefile.am
+++ b/src/gallium/drivers/softpipe/Makefile.am
@@ -23,11 +23,8 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+AM_CFLAGS = \
+	$(GALLIUM_DRIVER_CFLAGS)
 
 noinst_LTLIBRARIES = libsoftpipe.la
 
diff --git a/src/gallium/drivers/svga/Makefile.am b/src/gallium/drivers/svga/Makefile.am
index b6fed00..54ae814 100644
--- a/src/gallium/drivers/svga/Makefile.am
+++ b/src/gallium/drivers/svga/Makefile.am
@@ -25,13 +25,8 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CPPFLAGS = \
-	-I$(top_srcdir)/src/gallium/drivers/svga/include \
-	-I$(top_srcdir)/src/gallium/drivers \
-	-I$(top_srcdir)/include \
-	$(GALLIUM_CFLAGS)
-
-AM_CFLAGS = $(VISIBILITY_CFLAGS)
+AM_CFLAGS = \
+	$(GALLIUM_DRIVER_CFLAGS)
 
 #On some systems -std= must be added to CFLAGS to be the last -std=
 CFLAGS += -std=gnu99
diff --git a/src/gallium/drivers/trace/Makefile.am b/src/gallium/drivers/trace/Makefile.am
index db5904d..e19f5be 100644
--- a/src/gallium/drivers/trace/Makefile.am
+++ b/src/gallium/drivers/trace/Makefile.am
@@ -2,8 +2,7 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(GALLIUM_CFLAGS) \
-	$(VISIBILITY_CFLAGS)
+	$(GALLIUM_DRIVER_CFLAGS)
 
 noinst_LTLIBRARIES = libtrace.la
 
-- 
1.8.4.2



More information about the mesa-dev mailing list