File u_respect_cflags.diff of Package intel-gpu-tools.8668

From: Jan Engelhardt <jengelh@inai.de>
Date: 2017-02-05 13:15:36.359677297 +0100
Subject: build: resolve build error due to improper CFLAGS

1. intel-gpu-tools failed to use LIBKMOD_CFLAGS, which can lead
   to build errors if libkmod is in a non-default location.
2. CFLAGS obtained from pkg-config are really CPPFLAGS and
   should go there (AM_CPPFLAGS).
3. The target-specific CFLAGS overrides are unnecessary, since
   there are no conflicting settings obtained from pkg-config.
---
 tests/Makefile.am |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

Index: intel-gpu-tools-1.19/tests/Makefile.am
===================================================================
--- intel-gpu-tools-1.19.orig/tests/Makefile.am
+++ intel-gpu-tools-1.19/tests/Makefile.am
@@ -63,18 +63,17 @@ EXTRA_DIST = $(common_files) $(check_SCR
 
 CLEANFILES = $(EXTRA_PROGRAMS) test-list.txt test-list-full.txt .gitignore
 
-AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\
-	-I$(srcdir)/.. \
-	-I$(srcdir)/../lib \
+AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../lib \
 	-include "$(srcdir)/../lib/check-ndebug.h" \
+	$(CAIRO_CFLAGS) $(DRM_CFLAGS) $(DRM_NOUVEAU_CFLAGS) $(DRM_VC4_CFLAGS) \
+	$(GLIB_CFLAGS) $(KMOD_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBUNWIND_CFLAGS) \
 	-DIGT_SRCDIR=\""$(abs_srcdir)"\" \
-	-DIGT_DATADIR=\""$(pkgdatadir)"\" \
-	$(LIBUNWIND_CFLAGS) $(WERROR_CFLAGS) \
+	-DIGT_DATADIR=\""$(pkgdatadir)"\"
+AM_CFLAGS = $(CWARNFLAGS) -Wno-unused-result $(DEBUG_CFLAGS)\
+	$(WERROR_CFLAGS) \
 	$(NULL)
 
 LDADD = ../lib/libintel_tools.la $(GLIB_LIBS) $(XMLRPC_LIBS)
-
-AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS)
 AM_LDFLAGS = -Wl,--as-needed
 
 drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
@@ -114,21 +113,13 @@ gem_wait_LDADD = $(LDADD) -lrt
 kms_flip_LDADD = $(LDADD) -lrt -lpthread
 pm_rc6_residency_LDADD = $(LDADD) -lrt
 
-prime_nv_test_CFLAGS = $(AM_CFLAGS) $(DRM_NOUVEAU_CFLAGS)
 prime_nv_test_LDADD = $(LDADD) $(DRM_NOUVEAU_LIBS)
-prime_nv_api_CFLAGS = $(AM_CFLAGS) $(DRM_NOUVEAU_CFLAGS)
 prime_nv_api_LDADD = $(LDADD) $(DRM_NOUVEAU_LIBS)
-prime_nv_pcopy_CFLAGS = $(AM_CFLAGS) $(DRM_NOUVEAU_CFLAGS)
 prime_nv_pcopy_LDADD = $(LDADD) $(DRM_NOUVEAU_LIBS)
-vc4_create_bo_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_create_bo_LDADD = $(LDADD) $(DRM_VC4_LIBS)
-vc4_lookup_fail_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_lookup_fail_LDADD = $(LDADD) $(DRM_VC4_LIBS)
-vc4_dmabuf_poll_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_dmabuf_poll_LDADD = $(LDADD) $(DRM_VC4_LIBS)
-vc4_wait_bo_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_wait_bo_LDADD = $(LDADD) $(DRM_VC4_LIBS)
-vc4_wait_seqno_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_wait_seqno_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 
 chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)