[PATCH libinput 06/11] tools: Reinstate libshared.la and add it to meson.build too

Peter Hutterer peter.hutterer at who-t.net
Sun May 28 22:47:59 UTC 2017


Removed with commit 863fd1f0ebf145dc2b3a59e2a3e57dbc4ce77eaf but now that we
exec each subcommand, the previous per-target compilation flags aren't needed
anymore. Build a static library to avoid rebuilding the source files for each
target.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 meson.build       | 25 ++++++++++++++++---------
 tools/Makefile.am | 22 ++++++++++++----------
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/meson.build b/meson.build
index fd9838f6..a3161b82 100644
--- a/meson.build
+++ b/meson.build
@@ -344,19 +344,28 @@ libinput_tool_path = join_paths(get_option('prefix'), get_option('libexecdir'),
 config_h.set_quoted('LIBINPUT_TOOL_PATH', libinput_tool_path)
 tools_shared_sources = [ 'tools/shared.c',
 			 'tools/shared.h' ]
-libinput_debug_events_sources = [ 'tools/libinput-debug-events.c' ] + tools_shared_sources
+deps_tools_shared = [ dep_libinput, dep_libevdev ]
+lib_tools_shared = static_library('tools_shared',
+				  tools_shared_sources,
+				  include_directories : include_directories('src'),
+				  dependencies : deps_tools_shared)
+dep_tools_shared = declare_dependency(link_with : lib_tools_shared,
+				      dependencies : deps_tools_shared)
+
+deps_tools = [ dep_libinput,  dep_tools_shared ]
+libinput_debug_events_sources = [ 'tools/libinput-debug-events.c' ]
 executable('libinput-debug-events',
 	   libinput_debug_events_sources,
-	   dependencies : dep_libinput,
+	   dependencies : deps_tools,
 	   include_directories : include_directories('src'),
 	   install_dir : libinput_tool_path,
 	   install : true
 	   )
 
-libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ] + tools_shared_sources
+libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ]
 executable('libinput-list-devices',
 	   libinput_list_devices_sources,
-	   dependencies : [ dep_libinput ],
+	   dependencies : deps_tools,
 	   include_directories : include_directories('src'),
 	   install_dir : libinput_tool_path,
 	   install : true,
@@ -367,14 +376,12 @@ if get_option('debug-gui')
 	dep_cairo = dependency('cairo')
 	dep_glib = dependency('glib-2.0')
 
-	debug_gui_sources = [ 'tools/libinput-debug-gui.c' ] + tools_shared_sources
+	debug_gui_sources = [ 'tools/libinput-debug-gui.c' ]
 	deps_debug_gui = [
 			dep_gtk,
 			dep_cairo,
 			dep_glib,
-			dep_libevdev,
-			dep_libinput
-			]
+			] + deps_tools
 	executable('libinput-debug-gui',
 		   debug_gui_sources,
 		   dependencies : deps_debug_gui,
@@ -392,7 +399,7 @@ libinput_sources = [ 'tools/libinput-tool.c' ]
 
 executable('libinput',
 	   libinput_sources,
-	   dependencies : dep_libinput,
+	   dependencies : deps_tools,
 	   include_directories : include_directories ('src'),
 	   install : true
 	   )
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 85fe700d..3f69d566 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -3,6 +3,7 @@ bin_PROGRAMS = libinput
 toolsdir = $(libexecdir)/libinput
 tools_PROGRAMS =
 bin_SCRIPTS = libinput-list-devices.compat libinput-debug-events.compat
+noinst_LTLIBRARIES = libshared.la
 
 AM_CPPFLAGS = -I$(top_srcdir)/include \
               -I$(top_srcdir)/src \
@@ -10,9 +11,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
 AM_CFLAGS = $(GCC_CFLAGS)
 AM_CXXFLAGS = $(GCC_CXXFLAGS)
 
-shared_sources = \
-		 shared.c \
-		 shared.h
+libshared_la_SOURCES = \
+		       shared.c \
+		       shared.h
+libshared_la_CFLAGS = $(AM_CFLAGS) $(LIBEVDEV_CFLAGS)
+libshared_la_LIBADD = $(LIBEVDEV_LIBS)
 
 ptraccel_debug_SOURCES = ptraccel-debug.c
 ptraccel_debug_LDADD = ../src/libfilter.la ../src/libinput.la
@@ -20,29 +23,28 @@ ptraccel_debug_LDFLAGS = -no-install
 
 libinput_SOURCES = \
 		   libinput-tool.c \
-		   libinput-tool.h \
-		   $(shared_sources)
-libinput_LDADD = ../src/libinput.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
+		   libinput-tool.h
+libinput_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
 libinput_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) \
 		  -DLIBINPUT_TOOL_PATH="\"@libexecdir@/libinput\""
 dist_man1_MANS = libinput.1
 
 tools_PROGRAMS += libinput-list-devices
 libinput_list_devices_SOURCES = libinput-list-devices.c $(shared_sources)
-libinput_list_devices_LDADD = ../src/libinput.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
+libinput_list_devices_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
 libinput_list_devices_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS)
 dist_man1_MANS += libinput-list-devices.1
 
 tools_PROGRAMS += libinput-debug-events
 libinput_debug_events_SOURCES = libinput-debug-events.c $(shared_sources)
-libinput_debug_events_LDADD = ../src/libinput.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
+libinput_debug_events_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
 libinput_debug_events_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS)
 dist_man1_MANS += libinput-debug-events.1
 
 if BUILD_DEBUG_GUI
 tools_PROGRAMS += libinput-debug-gui
-libinput_debug_gui_SOURCES = libinput-debug-gui.c $(shared_sources)
-libinput_debug_gui_LDADD = ../src/libinput.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBEVDEV_LIBS)
+libinput_debug_gui_SOURCES = libinput-debug-gui.c
+libinput_debug_gui_LDADD = ../src/libinput.la libshared.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBEVDEV_LIBS)
 libinput_debug_gui_CFLAGS = $(AM_CFLAGS) $(CAIRO_CFLAGS) $(GTK_CFLAGS) $(LIBEVDEV_CFLAGS)
 dist_man1_MANS += libinput-debug-gui.1
 endif
-- 
2.13.0



More information about the wayland-devel mailing list