chiark / gitweb /
configure.ac, vars.am: Use host-specific link options for test programs.
[catacomb] / vars.am
diff --git a/vars.am b/vars.am
index de795453b0c14bb2ce9636dd3d784a57c0b44de5..223f2bab98753badf7c4a10482d28aa12020930a 100644 (file)
--- a/vars.am
+++ b/vars.am
 ###--------------------------------------------------------------------------
 ### Miscellaneous useful definitions.
 
-## Some convenient abbreviations for file suffixes.
-e                       = $(EXEEXT)
-o                       = $(OBJEXT)
-t                       = t$e
-
 ## Installation directories.
 archincludedir          = $(pkglibdir)/include
 
@@ -46,34 +41,58 @@ SUFFIXES             =
 TESTS                   =
 BUILT_SOURCES           =
 
+EXTRA_PROGRAMS          =
 noinst_PROGRAMS                 =
+check_PROGRAMS          =
 pkginclude_HEADERS      =
 nodist_pkginclude_HEADERS =
 archinclude_HEADERS     =
 nodist_archinclude_HEADERS =
 
+###--------------------------------------------------------------------------
+### Machinery for precomputations.
+
+## Location of precomputed tables.
+precomp                         = $(top_srcdir)/precomp
+
+## Precomputed source code files.
+PRECOMPS                =
+EXTRA_DIST             += $(PRECOMPS)
+BUILT_SOURCES          += $(PRECOMPS)
+MAINTAINERCLEANFILES   += $(PRECOMPS)
+
+## Programs which make the tables.  These should be made by an explicit
+## recursive `make' call in the relevant rule, so that we don't try to
+## reconstruct them unnecessarily.
+PRECOMP_PROGS           =
+EXTRA_PROGRAMS         += $(PRECOMP_PROGS)
+CLEANFILES             += $(PRECOMP_PROGS)
+
 ###--------------------------------------------------------------------------
 ### Standard configuration substitutions.
 
 ## Substitute tags in files.
-confsubst = $(top_srcdir)/config/confsubst
+confsubst               = $(top_srcdir)/config/confsubst
 
 SUBSTITUTIONS = \
-               prefix=$(prefix) exec_prefix=$(exec_prefix) \
-               libdir=$(libdir) includedir=$(includedir) \
-               PACKAGE=$(PACKAGE) VERSION=$(VERSION) \
-               CATACOMB_LIBS="$(CATACOMB_LIBS)"
+       prefix=$(prefix) exec_prefix=$(exec_prefix) \
+       libdir=$(libdir) includedir=$(includedir) \
+       PACKAGE=$(PACKAGE) VERSION=$(VERSION) \
+       CATACOMB_LIBS="$(CATACOMB_LIBS)"
 
-V_SUBST = $(V_SUBST_$(V))
-V_SUBST_ = $(V_SUBST_$(AM_DEFAULT_VERBOSITY))
-V_SUBST_0 = @echo "  SUBST  $@";
-SUBST = $(V_SUBST)$(confsubst)
+V_SUBST                         = $(V_SUBST_@AM_V@)
+V_SUBST_                = $(V_SUBST_@AM_DEFAULT_V@)
+V_SUBST_0               = @echo "  SUBST    $@";
+SUBST                   = $(V_SUBST)$(confsubst)
 
 ###--------------------------------------------------------------------------
 ### Include path.
 
-CATACOMB_INCLUDES       = \
+CATACOMB_INCLUDES = \
        -I$(top_srcdir) \
+       -I$(precomp)/math \
+       -I$(precomp)/misc \
+       -I$(precomp)/symm \
        -I$(top_srcdir)/base \
        -I$(top_srcdir)/key \
        -I$(top_srcdir)/math \
@@ -89,14 +108,36 @@ AM_CPPFLAGS                 = $(CATACOMB_INCLUDES)
 ###--------------------------------------------------------------------------
 ### Testing.
 
-SUFFIXES               += .c .$t .to
+TEST_EXTENSIONS                 = .t
+SUFFIXES               += .c .t$(EXEEXT) .to
+
+## This unpleasant duplication of rules makes the build system basically work
+## for non-GNU make(1) variants, while GNU Make will associate useful
+## additional dependencies with the test programs.  GNU Make seems not to
+## mind the duplicate rules, and uses the second (better) set; non-GNU Make
+## will think the second set refer to bizarrely-named targets which nobody is
+## apparently interested in.
 .c.to:
        $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@
-.to.$t: libcatacomb.la
-       $(AM_V_CCLD)$(LINK) $< \
+.to.t$(EXEEXT):
+       $(AM_V_CCLD)$(LINK) $(TEST_LDFLAGS) $< \
                $(TEST_LIBS) $(top_builddir)/libcatacomb.la \
                $(mLib_LIBS) $(CATACOMB_LIBS) $(LIBS)
-.PRECIOUS: %.to
-CLEANFILES             += *.to *.$t
+%.to: %.c %.lo
+       $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@
+%.t$(EXEEXT): %.to $(TEST_LIBS) $(top_builddir)/libcatacomb.la
+       $(AM_V_CCLD)$(LINK) $(TEST_LDFLAGS) $+ \
+               $(mLib_LIBS) $(CATACOMB_LIBS) $(LIBS)
+
+.PRECIOUS: %.to %.t$(EXEEXT)
+CLEANFILES             += *.to *.t$(EXEEXT)
+
+###--------------------------------------------------------------------------
+### Experimental flymake hack.
+
+check-syntax:
+       $(COMPILE) -S -o/dev/null \
+               -DTEST_RIG -DSRCDIR=\"$(SRCDIR)\" \
+               $(CHK_SOURCES)
 
 ###----- That's all, folks --------------------------------------------------