[PATCH 6/6] Merge test/Makefile.am into Makefile.am and enable subdir-objects

David Herrmann dh.herrmann at gmail.com
Sun Sep 1 08:45:09 PDT 2013


subdir-objects will soon become the default for automake. Use this as an
excuse to merge subdir-makefiles into one major makefile to overcome
several build-issues we would trigger with subdir-objects otherwise.

Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
---
Hi

The last 4 patches merge all Makefiles into a single top-level makefile and then
enables subdir-objects. If you actually like subdir Makefiles, feel free to
ignore them. I'm not a big fan of them, though ;)

Cheers
David

 .gitignore              |   3 ++
 Makefile.am             | 101 +++++++++++++++++++++++++++++++++++++++++++++---
 configure.ac            |   3 +-
 doc/libevdev.doxygen.in |   8 ++--
 test/Makefile.am        |  79 -------------------------------------
 5 files changed, 103 insertions(+), 91 deletions(-)
 delete mode 100644 test/Makefile.am

diff --git a/.gitignore b/.gitignore
index 40cf5e1..c16ba6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.dirstamp
 aclocal.m4
 autom4te.cache/
 autoscan.log
@@ -57,3 +58,5 @@ test-driver
 libevdev.doxygen
 *.announce
 tags
+test-libevdev*
+test-suite.log
diff --git a/Makefile.am b/Makefile.am
index 93b1efa..737a009 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,12 +7,18 @@ PRINT_DIRECTORY_FLAGS_1=
 PRINT_DIRECTORY_FLAGS_0=--no-print-directory
 PRINT_DIRECTORY_FLAGS_=$(PRINT_DIRECTORY_FLAGS_$(AM_DEFAULT_VERBOSITY))
 AM_MAKEFLAGS = $(PRINT_DIRECTORY_FLAGS_$(V))
-AM_CPPFLAGS = $(GCC_CFLAGS) $(GCOV_CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/libevdev
-SUBDIRS = test
+SUBDIRS =
 lib_LTLIBRARIES =
 noinst_PROGRAMS =
 dist_noinst_DATA =
 
+AM_CPPFLAGS = \
+	$(GCC_CFLAGS) \
+	$(GCOV_CFLAGS) \
+	-I$(top_srcdir) \
+	-I$(top_srcdir)/libevdev \
+	-I$(top_builddir)
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libevdev.pc
 
@@ -20,6 +26,7 @@ EXTRA_DIST = libevdev.pc.in
 CLEANFILES =
 BUILT_SOURCES =
 TPHONY =
+TESTS =
 
 #
 # libevdev/ build rules
@@ -27,7 +34,7 @@ TPHONY =
 
 lib_LTLIBRARIES += libevdev.la
 
-libevdev_la_SOURCES = \
+libevdev_sources = \
 	libevdev/libevdev.h \
 	libevdev/libevdev-int.h \
 	libevdev/libevdev-util.h \
@@ -36,6 +43,8 @@ libevdev_la_SOURCES = \
 	libevdev/libevdev-uinput-int.h \
 	libevdev/libevdev.c
 
+libevdev_la_SOURCES = $(libevdev_sources)
+
 libevdev_la_LDFLAGS = \
 	-version-info $(LIBEVDEV_LT_VERSION) \
 	-export-symbols-regex '^libevdev_' \
@@ -78,14 +87,14 @@ if HAVE_DOXYGEN
 all-local: doxygen
 
 doxygen: doc/libevdev.doxygen
-	doxygen $<
+	doxygen doc/libevdev.doxygen
 
 clean-local-doc:
 	rm -rf doc/html
 
 TPHONY += doxygen
 
-doc_src= $(shell find doc/html -name "*" -printf "doc/html/%P\n")
+doc_src = $(shell find doc/html -name "*" -printf "doc/html/%P\n" 2>/dev/null)
 EXTRA_DIST += $(doc_src) doc/libevdev.doxygen doc/libevdev.css
 endif
 
@@ -101,9 +110,89 @@ dist-hook:
 		test )
 
 #
+# test/ build rules
+#
+
+if BUILD_TESTS
+noinst_PROGRAMS += test-libevdev
+TESTS += test-libevdev
+
+common_sources = \
+	$(libevdev_sources) \
+	test/test-common-uinput.c \
+	test/test-common-uinput.h \
+	test/test-common.c \
+	test/test-common.h
+
+test_libevdev_SOURCES = \
+	test/test-main.c \
+	test/test-event-names.c \
+	test/test-libevdev-init.c \
+	test/test-libevdev-has-event.c \
+	test/test-int-queue.c \
+	test/test-libevdev-events.c \
+	test/test-uinput.c \
+	$(common_sources)
+
+test_libevdev_CFLAGS = \
+	$(AM_CFLAGS) \
+	$(CHECK_CFLAGS) \
+	-Wno-strict-prototypes \
+	-Wno-missing-prototypes \
+	-Wno-missing-field-initializers \
+	-Wno-sign-compare
+
+test_libevdev_LDADD = \
+	$(CHECK_LIBS) \
+	$(GCOV_LDFLAGS)
+
+if GCOV_ENABLED
+
+CLEANFILES += gcov-report.txt
+
+gcov-report.txt: check-TESTS
+	$(AM_V_GEN)(rm -rf $@; \
+		echo "========== coverage report ========" >> $@; \
+		for file in `find $(top_srcdir)/libevdev -name "*.c" -printf "%P\n"`; do \
+			gcov libevdev/test_libevdev-$$file > /dev/null; \
+			if test -f $$file.gcov; then \
+				total=`grep -v " -:" $$file.gcov | wc -l`; \
+				missing=`grep "#####" $$file.gcov | wc -l`; \
+				hit=$$((total - missing)); \
+				echo -e "$$file: total lines: $$total not tested: $$missing ($$((($$hit * 100)/$$total))%)"; \
+			fi \
+		done >> $@; \
+		echo "========== =============== ========" >> $@; \
+	)
+
+gcov: gcov-report.txt
+	@cat gcov-report.txt
+
+check-local: gcov
+
+else
+
+gcov-report.txt:
+	@true
+
+gcov:
+	@true
+
+endif
+
+TPHONY += gcov gcov-report.txt
+
+clean-local-test:
+	for path in . test tools libevdev ; do \
+		rm -f $$path/*.gcov $$path/*.gcda $$path/*.gcno ; \
+	done
+
+endif
+
+#
 # global rules
 #
 
-clean-local: clean-local-doc clean-local-libevdev
+clean-local: clean-local-doc clean-local-libevdev clean-local-test
 
 .PHONY: $(TPHONY)
diff --git a/configure.ac b/configure.ac
index 2ee15c0..0976624 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@ AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AC_USE_SYSTEM_EXTENSIONS
 
-AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
+AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
 
 # Before making a release, the LIBEVDEV_LT_VERSION string should be
 # modified.
@@ -74,6 +74,5 @@ AC_MSG_RESULT([$enable_gcov])
 
 AC_CONFIG_FILES([Makefile
 		 doc/libevdev.doxygen
-		 test/Makefile
 		 libevdev.pc])
 AC_OUTPUT
diff --git a/doc/libevdev.doxygen.in b/doc/libevdev.doxygen.in
index c0e0885..1131a70 100644
--- a/doc/libevdev.doxygen.in
+++ b/doc/libevdev.doxygen.in
@@ -52,7 +52,7 @@ PROJECT_LOGO           =
 # If a relative path is entered, it will be relative to the location
 # where doxygen was started. If left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       =
+OUTPUT_DIRECTORY       = doc
 
 # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
 # 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -652,8 +652,8 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = @srcdir@/libevdev/libevdev.h \
-			 @srcdir@/libevdev/libevdev-uinput.h
+INPUT                  = @abs_top_srcdir@/libevdev/libevdev.h \
+			 @abs_top_srcdir@/libevdev/libevdev-uinput.h
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -914,7 +914,7 @@ HTML_STYLESHEET        =
 # robust against future updates. Doxygen will copy the style sheet file to
 # the output directory.
 
-HTML_EXTRA_STYLESHEET  = @srcdir@/doc/libevdev.css
+HTML_EXTRA_STYLESHEET  = @abs_top_srcdir@/doc/libevdev.css
 
 # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
 # other source files which should be copied to the HTML output directory. Note
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index 8454329..0000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,79 +0,0 @@
-if BUILD_TESTS
-noinst_PROGRAMS = test-libevdev
-
-TESTS = $(noinst_PROGRAMS)
-
-libevdev_sources = $(top_srcdir)/libevdev/libevdev.c \
-		   $(top_srcdir)/libevdev/libevdev.h \
-		   $(top_srcdir)/libevdev/libevdev-uinput.h \
-		   $(top_srcdir)/libevdev/libevdev-uinput.c \
-		   $(top_srcdir)/libevdev/libevdev-uinput-int.h \
-		   $(top_srcdir)/libevdev/libevdev-util.h \
-		   $(top_srcdir)/libevdev/libevdev-int.h
-common_sources = $(libevdev_sources) \
-		 test-common-uinput.c \
-		 test-common-uinput.h \
-		 test-common.c \
-		 test-common.h
-
-# include builddir for event-names.h
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/libevdev $(CHECK_CFLAGS) $(GCOV_CFLAGS)
-
-test_libevdev_SOURCES = \
-			test-main.c \
-			test-event-names.c \
-			test-libevdev-init.c \
-			test-libevdev-has-event.c \
-			test-int-queue.c \
-			test-libevdev-events.c \
-			test-uinput.c \
-			$(common_sources)
-
-test_libevdev_LDADD =  $(CHECK_LIBS) $(GCOV_LDFLAGS)
-
-if GCOV_ENABLED
-
-CLEANFILES = gcov-report.txt
-
-gcov-clean:
-	@rm -f *.gcov
-
-gcov-report.txt: gcov-clean check-TESTS
-	$(AM_V_GEN)(rm -rf $@; \
-		echo "========== coverage report ========" >> $@; \
-		for file in `find $(top_srcdir)/libevdev -name "*.c" -printf "%P\n"`; do \
-			gcov $$file > /dev/null; \
-			if test -f $$file.gcov; then \
-				total=`grep -v " -:" $$file.gcov | wc -l`; \
-				missing=`grep "#####" $$file.gcov | wc -l`; \
-				hit=$$((total - missing)); \
-				echo -e "$$file: total lines: $$total not tested: $$missing ($$((($$hit * 100)/$$total))%)"; \
-			fi \
-		done >> $@; \
-		echo "========== =============== ========" >> $@; \
-	)
-
-gcov: gcov-report.txt
-	@cat gcov-report.txt
-
-check-local: gcov
-
-else
-
-gcov-report.txt:
-	@true
-
-gcov:
-	@true
-
-gcov-clean:
-	@true
-
-endif
-
-.PHONY: gcov gcov-clean gcov-report.txt
-
-clean-local: gcov-clean
-	rm -f *.gcno *.gcda
-
-endif
-- 
1.8.4



More information about the Input-tools mailing list