diff --git a/configure.ac b/configure.ac index b4faf8ea178..164454dff30 100644 --- a/configure.ac +++ b/configure.ac @@ -5448,10 +5448,10 @@ dnl test/ is not present in release tarfiles. opt_makefile=test/Makefile if test -f "$srcdir/$opt_makefile.in"; then - SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile test/data/emacs-module/Makefile" + SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile" dnl Again, it's best not to use a variable. Though you can add dnl ", [], [opt_makefile='$opt_makefile']" and it should work. - AC_CONFIG_FILES([test/Makefile test/data/emacs-module/Makefile]) + AC_CONFIG_FILES([test/Makefile]) fi diff --git a/test/Makefile.in b/test/Makefile.in index 13c0ac13f21..4998338b920 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -35,6 +35,13 @@ VPATH = $(srcdir) FIND_DELETE = @FIND_DELETE@ MKDIR_P = @MKDIR_P@ +CC = @CC@ +CFLAGS = @CFLAGS@ +PROFILING_CFLAGS = @PROFILING_CFLAGS@ +WARN_CFLAGS = @WARN_CFLAGS@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +SO = @MODULES_SUFFIX@ SEPCHAR = @SEPCHAR@ @@ -42,6 +49,11 @@ SEPCHAR = @SEPCHAR@ # 'make' verbosity. AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = + AM_V_ELC = $(am__v_ELC_@AM_V@) am__v_ELC_ = $(am__v_ELC_@AM_DEFAULT_V@) am__v_ELC_0 = @echo " ELC " $@; @@ -91,6 +103,8 @@ emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ $(GDB) "$(EMACS)" $(EMACSOPT) +test_module_dir := $(srcdir)/data/emacs-module + .PHONY: all check all: check @@ -151,7 +165,7 @@ TESTS := $(LOGFILES:.log=) .PRECIOUS: %.log ## Stop make deleting these as intermediate files. -.SECONDARY: ${ELFILES:.el=.elc} +.SECONDARY: ${ELFILES:.el=.elc} $(test_module_dir)/*.o .PHONY: ${TESTS} @@ -178,12 +192,22 @@ endef $(foreach test,${TESTS},$(eval $(call test_template,${test}))) ifeq (@HAVE_MODULES@, yes) -test_module_dir := $(srcdir)/data/emacs-module +# -fPIC is a no-op on Windows, but causes a compiler warning +ifeq ($(SO),.dll) +FPIC_CFLAGS = +else +FPIC_CFLAGS = -fPIC +endif + +MODULE_CFLAGS = -I$(srcdir)/../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \ + $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) + test_module_name := mod-test@MODULES_SUFFIX@ test_module := $(test_module_dir)/$(test_module_name) $(srcdir)/src/emacs-module-tests.log: $(test_module) -$(test_module): $(srcdir)/../src/emacs-module.[ch] $(test_module_dir)/mod-test.c - $(MAKE) -C $(test_module_dir) $(test_module_name) +$(test_module): $(test_module_dir)/mod-test.c $(srcdir)/../src/emacs-module.h + $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ + -o $@ $< endif ## Check that there is no 'automated' subdirectory, which would @@ -222,6 +246,8 @@ mostlyclean: clean: find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE) + rm -f $(test_module_dir)/*.o $(test_module_dir)/*.so \ + $(test_module_dir)/*.dll bootstrap-clean: clean find $(srcdir) -name '*.elc' $(FIND_DELETE) diff --git a/test/data/emacs-module/Makefile.in b/test/data/emacs-module/Makefile.in deleted file mode 100644 index 2af6473c7a6..00000000000 --- a/test/data/emacs-module/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -### @configure_input@ - -# Test GNU Emacs modules. - -# Copyright 2015-2017 Free Software Foundation, Inc. - -# This file is part of GNU Emacs. - -# GNU Emacs is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# GNU Emacs is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GNU Emacs. If not, see . - -SHELL = @SHELL@ - -top_srcdir = @top_srcdir@ -VPATH = $(srcdir) -CC = @CC@ -CFLAGS = @CFLAGS@ -PROFILING_CFLAGS = @PROFILING_CFLAGS@ -WARN_CFLAGS = @WARN_CFLAGS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -SO = @MODULES_SUFFIX@ - -# -fPIC is a no-op on Windows, but causes a compiler warning -ifeq ($(SO),.dll) -FPIC_CFLAGS = -else -FPIC_CFLAGS = -fPIC -endif - -ALL_CFLAGS = -I$(top_srcdir)/src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) - -all: mod-test$(SO) - -%$(SO): %.o - $(CC) -shared $(LDFLAGS) -o $@ $< - -%.o: %.c $(top_srcdir)/src/emacs-module.h - $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< - -## Stop .o files being deleted. -.SECONDARY: - -.PHONY: clean - -clean: - rm -f *.o *.so *.dll -