From 7cd728c813f2c472a2f6a0cb0c3fb3ee46c9d8ad Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 19 Nov 2015 19:49:29 +0200 Subject: [PATCH] Minor improvements in modules testing Makefile * modules/mod-test/Makefile (EMACS, SO): New variables. (CFLAGS): When SO = dll, don't use -fPIC. (check): New target, runs the test. --- modules/mod-test/Makefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/mod-test/Makefile b/modules/mod-test/Makefile index 654c22a7e33..79a88725d08 100644 --- a/modules/mod-test/Makefile +++ b/modules/mod-test/Makefile @@ -18,16 +18,28 @@ # along with GNU Emacs. If not, see . ROOT = ../.. +EMACS = $(ROOT)/src/emacs CC = gcc LD = gcc -CFLAGS = -ggdb3 -Wall LDFLAGS = -all: mod-test.so +# On MS-Windows, say "make SO=.dll" to build the module +SO = so +# -fPIC is a no-op on Windows, but causes a compiler warning +ifeq ($(SO),dll) +CFLAGS = -ggdb3 -Wall +else +CFLAGS = -ggdb3 -Wall -fPIC +endif + +all: mod-test.$(SO) -%.so: %.o +%.$(SO): %.o $(LD) -shared $(LDFLAGS) -o $@ $< %.o: %.c - $(CC) $(CFLAGS) -I$(ROOT)/src -fPIC -c $< + $(CC) $(CFLAGS) -I$(ROOT)/src -c $< + +check: + $(EMACS) -batch -l ert -l test.el -f ert-run-tests-batch-and-exit -- 2.39.5