From e08f241658667a328bade89ab479fc5f7389bb9b Mon Sep 17 00:00:00 2001 From: Andy Moreton Date: Fri, 26 Jan 2018 12:09:42 +0200 Subject: [PATCH] Fix emacs-module-tests to work out of build tree * test/Makefile.in (test_module_dir): Build the test module library in a subdirectory of the build directory (not the source tree). (MODULE_CFLAGS): Fix location of emacs-module.h header file. (test_module): Move built library out of the source tree. * test/src/emacs-module-tests.el (mod-test-file): Locate the test module library relative to the running Emacs executable. --- test/Makefile.in | 5 +++-- test/src/emacs-module-tests.el | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Makefile.in b/test/Makefile.in index 3f4f8e7836c..a85d491d2d3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -120,7 +120,7 @@ emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT) -test_module_dir := $(srcdir)/data/emacs-module +test_module_dir := data/emacs-module .PHONY: all check @@ -223,12 +223,13 @@ else FPIC_CFLAGS = -fPIC endif -MODULE_CFLAGS = -I$(srcdir)/../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \ +MODULE_CFLAGS = -I../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) test_module = $(test_module_dir)/mod-test${SO} src/emacs-module-tests.log: $(test_module) $(test_module): $(test_module:${SO}=.c) $(srcdir)/../src/emacs-module.h + $(AM_V_at)${MKDIR_P} $(dir $@) $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ -o $@ $< endif diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index d9406a9609e..85d63053867 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -25,8 +25,7 @@ (eval-and-compile (defconst mod-test-file - (substitute-in-file-name - "$EMACS_TEST_DIRECTORY/data/emacs-module/mod-test") + (expand-file-name "../test/data/emacs-module/mod-test" invocation-directory) "File name of the module test file.")) (require 'mod-test mod-test-file) -- 2.39.5