emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 58b9b09: Inline test module Makefile into main test


From: Philipp Stephani
Subject: [Emacs-diffs] master 58b9b09: Inline test module Makefile into main test Makefile
Date: Tue, 13 Jun 2017 14:48:32 -0400 (EDT)

branch: master
commit 58b9b098a4cbefbe7ae28079a96625bd450c9316
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>

    Inline test module Makefile into main test Makefile
    
    The test/data/emacs-module/Makefile only built a single target, and
    inlining it into test/Makefile simplifies dependency tracking and
    reduces code duplication.
    
    * configure.ac: Don't build test/data/emacs-module/Makefile.
    
    * Makefile.in ($(test_module)): Inline compilation.
    (clean): Also clean test module outputs.
---
 configure.ac                       |  4 +--
 test/Makefile.in                   | 34 +++++++++++++++++++---
 test/data/emacs-module/Makefile.in | 59 --------------------------------------
 3 files changed, 32 insertions(+), 65 deletions(-)

diff --git a/configure.ac b/configure.ac
index b4faf8e..164454d 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 13c0ac1..4998338 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 = $(address@hidden@)
+am__v_CCLD_ = $(address@hidden@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 =
+
 AM_V_ELC = $(address@hidden@)
 am__v_ELC_ = $(address@hidden@)
 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 := address@hidden@
 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 2af6473..0000000
--- 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 <http://www.gnu.org/licenses/>.
-
-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
-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]