[PATCH i-g-t 17/22] meson: Use static libs to handle IGT_LOG_DOMAIN.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eric Anholt <eric@xxxxxxxxxx>

It means that compiler errors in the .c files take you to the source
place in your editor, not a preprocessed temporary.

v2: Add the library deps, fails linking otherwise.

Signed-off-by: Eric Anholt <eric@xxxxxxxxxx> (v1)
Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 lib/dummy.c               |  0
 lib/meson.build           | 36 +++++++++++++++++++++++++-----------
 lib/prepend_log_domain.sh |  8 --------
 3 files changed, 25 insertions(+), 19 deletions(-)
 create mode 100644 lib/dummy.c
 delete mode 100755 lib/prepend_log_domain.sh

diff --git a/lib/dummy.c b/lib/dummy.c
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/lib/meson.build b/lib/meson.build
index 51d3f9e278da..f0672edf1830 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -144,19 +144,33 @@ vcs_tag(input : 'version.h.in', output : 'version.h',
 	fallback : 'NO-GIT',
 	command : [ 'git', 'log', '-n1', '--pretty=format:g%h' ] )
 
-# FIXME we don't regenerate when the script changes
-prepend_log_domain = generator(find_program('prepend_log_domain.sh'),
-		arguments : [ '@INPUT@', '@OUTPUT@' ],
-		output : '@PLAINNAME@' + '.pre.c')
-
-processed_src_dep = prepend_log_domain.process(lib_sources)
+lib_intermediates = []
+foreach f: lib_sources
+    # No / in the target name
+    if f.contains('uwildmat')
+        name = 'uwildmat'
+    else
+        name = f
+    endif
+
+    lib = static_library('igt-' + name,
+        f,
+	include_directories: inc,
+	dependencies : lib_deps,
+	c_args : [
+	    '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
+	    '-DIGT_SRCDIR="@0@"'.format(srcdir),
+	    '-DIGT_LOG_DOMAIN="@0@"'.format(f.split('.')[0]),
+	])
+
+    lib_intermediates += lib
+endforeach
 
 lib_igt_build = shared_library('igt',
-			 processed_src_dep,
-			 include_directories : inc,
-			 dependencies : lib_deps,
-			 c_args : [ '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
-				'-DIGT_SRCDIR="@0@"'.format(srcdir), ])
+    ['dummy.c'],
+    link_whole: lib_intermediates,
+    dependencies: lib_deps,
+)
 
 lib_igt = declare_dependency(link_with : lib_igt_build,
 			    include_directories : inc)
diff --git a/lib/prepend_log_domain.sh b/lib/prepend_log_domain.sh
deleted file mode 100755
index 93a911508b7f..000000000000
--- a/lib/prepend_log_domain.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-input=$1
-output=$2
-basename=$(basename $1 .c)
-
-echo "#define IGT_LOG_DOMAIN \"$basename\"" > $output
-cat $input >> $output
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux