]> git.eshelyaron.com Git - emacs.git/commitdiff
Minor improvements in modules testing Makefile
authorEli Zaretskii <eliz@gnu.org>
Thu, 19 Nov 2015 17:49:29 +0000 (19:49 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 19 Nov 2015 17:49:29 +0000 (19:49 +0200)
* 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

index 654c22a7e33caa94dfd32a01037a84a088d84b42..79a88725d0846eefdd70510fa848b1eb58889254 100644 (file)
 # along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 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