diff options
| author | Philipp Stephani | 2017-06-12 16:09:37 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-06-12 16:09:37 +0200 |
| commit | c90a97adc49e844d884a4422e99570526fd92485 (patch) | |
| tree | 8587d28765a009f2c049931181e9dd4ff026efde | |
| parent | 909dfaf3257e5e2de48a0a51bf9d42517a393fb0 (diff) | |
| download | emacs-c90a97adc49e844d884a4422e99570526fd92485.tar.gz emacs-c90a97adc49e844d884a4422e99570526fd92485.zip | |
Use Autoconf to generate the test module Makefile
This makes it easier to pass compilation flags around.
* configure.ac: Also build test module Makefile.
* test/data/emacs-module/Makefile.in: New makefile template.
* test/Makefile.in ($(test_module)): No longer necessary to pass
@MODULES_SUFFIX@ around.
* .gitignore: Test module Makefile can now be ignored.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | configure.ac | 4 | ||||
| -rw-r--r-- | test/Makefile.in | 2 | ||||
| -rw-r--r-- | test/data/emacs-module/Makefile.in (renamed from test/data/emacs-module/Makefile) | 25 |
4 files changed, 18 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore index 6dd21124e8c..1abefeb4326 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -34,7 +34,6 @@ InfoPlist.strings | |||
| 34 | Makefile | 34 | Makefile |
| 35 | makefile | 35 | makefile |
| 36 | !etc/refcards/Makefile | 36 | !etc/refcards/Makefile |
| 37 | !test/data/emacs-module/Makefile | ||
| 38 | !test/lisp/progmodes/flymake-resources/Makefile | 37 | !test/lisp/progmodes/flymake-resources/Makefile |
| 39 | !test/manual/etags/Makefile | 38 | !test/manual/etags/Makefile |
| 40 | !test/manual/etags/make-src/Makefile | 39 | !test/manual/etags/make-src/Makefile |
diff --git a/configure.ac b/configure.ac index 164454dff30..b4faf8ea178 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -5448,10 +5448,10 @@ dnl test/ is not present in release tarfiles. | |||
| 5448 | opt_makefile=test/Makefile | 5448 | opt_makefile=test/Makefile |
| 5449 | 5449 | ||
| 5450 | if test -f "$srcdir/$opt_makefile.in"; then | 5450 | if test -f "$srcdir/$opt_makefile.in"; then |
| 5451 | SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile" | 5451 | SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile test/data/emacs-module/Makefile" |
| 5452 | dnl Again, it's best not to use a variable. Though you can add | 5452 | dnl Again, it's best not to use a variable. Though you can add |
| 5453 | dnl ", [], [opt_makefile='$opt_makefile']" and it should work. | 5453 | dnl ", [], [opt_makefile='$opt_makefile']" and it should work. |
| 5454 | AC_CONFIG_FILES([test/Makefile]) | 5454 | AC_CONFIG_FILES([test/Makefile test/data/emacs-module/Makefile]) |
| 5455 | fi | 5455 | fi |
| 5456 | 5456 | ||
| 5457 | 5457 | ||
diff --git a/test/Makefile.in b/test/Makefile.in index 0c24c48e60e..13c0ac13f21 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -183,7 +183,7 @@ test_module_name := mod-test@MODULES_SUFFIX@ | |||
| 183 | test_module := $(test_module_dir)/$(test_module_name) | 183 | test_module := $(test_module_dir)/$(test_module_name) |
| 184 | $(srcdir)/src/emacs-module-tests.log: $(test_module) | 184 | $(srcdir)/src/emacs-module-tests.log: $(test_module) |
| 185 | $(test_module): $(srcdir)/../src/emacs-module.[ch] $(test_module_dir)/mod-test.c | 185 | $(test_module): $(srcdir)/../src/emacs-module.[ch] $(test_module_dir)/mod-test.c |
| 186 | $(MAKE) -C $(test_module_dir) $(test_module_name) SO=@MODULES_SUFFIX@ | 186 | $(MAKE) -C $(test_module_dir) $(test_module_name) |
| 187 | endif | 187 | endif |
| 188 | 188 | ||
| 189 | ## Check that there is no 'automated' subdirectory, which would | 189 | ## Check that there is no 'automated' subdirectory, which would |
diff --git a/test/data/emacs-module/Makefile b/test/data/emacs-module/Makefile.in index bfeddb0472f..427d1aaa07c 100644 --- a/test/data/emacs-module/Makefile +++ b/test/data/emacs-module/Makefile.in | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | ### @configure_input@ | ||
| 2 | |||
| 1 | # Test GNU Emacs modules. | 3 | # Test GNU Emacs modules. |
| 2 | 4 | ||
| 3 | # Copyright 2015-2017 Free Software Foundation, Inc. | 5 | # Copyright 2015-2017 Free Software Foundation, Inc. |
| @@ -17,25 +19,28 @@ | |||
| 17 | # You should have received a copy of the GNU General Public License | 19 | # You should have received a copy of the GNU General Public License |
| 18 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 20 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
| 19 | 21 | ||
| 20 | ROOT = ../../.. | 22 | SHELL = @SHELL@ |
| 21 | 23 | ||
| 22 | CC = gcc | 24 | top_srcdir = @top_srcdir@ |
| 23 | LD = gcc | 25 | VPATH = $(srcdir) |
| 24 | LDFLAGS = | 26 | CC = @CC@ |
| 27 | CFLAGS = @CFLAGS@ | ||
| 28 | CPPFLAGS = @CPPFLAGS@ | ||
| 29 | SO = @MODULES_SUFFIX@ | ||
| 25 | 30 | ||
| 26 | # On MS-Windows, say "make SO=.dll" to build the module | ||
| 27 | SO = .so | ||
| 28 | # -fPIC is a no-op on Windows, but causes a compiler warning | 31 | # -fPIC is a no-op on Windows, but causes a compiler warning |
| 29 | ifeq ($(SO),.dll) | 32 | ifeq ($(SO),.dll) |
| 30 | CFLAGS = -std=c11 -ggdb3 -Wall | 33 | FPIC_CFLAGS = |
| 31 | else | 34 | else |
| 32 | CFLAGS = -std=c11 -ggdb3 -Wall -fPIC | 35 | FPIC_CFLAGS = -fPIC |
| 33 | endif | 36 | endif |
| 34 | 37 | ||
| 35 | all: mod-test$(SO) | 38 | all: mod-test$(SO) |
| 36 | 39 | ||
| 37 | %$(SO): %.o | 40 | %$(SO): %.o |
| 38 | $(LD) -shared $(LDFLAGS) -o $@ $< | 41 | $(CC) -shared $(LDFLAGS) -o $@ $< |
| 39 | 42 | ||
| 40 | %.o: %.c | 43 | %.o: %.c |
| 41 | $(CC) $(CFLAGS) -I$(ROOT)/src -c $< | 44 | $(CC) $(CPPFLAGS) $(CFLAGS) $(FPIC_CFLAGS) -I$(top_srcdir)/src -c -o $@ $< |
| 45 | |||
| 46 | %.o: $(srcdir)/emacs-module.[ch] | ||