| 1 | ### -*-makefile-*- |
| 2 | ### |
| 3 | ### Common definitions for build scripts |
| 4 | ### |
| 5 | ### (c) 2013 Straylight/Edgeware |
| 6 | ### |
| 7 | |
| 8 | ###----- Licensing notice --------------------------------------------------- |
| 9 | ### |
| 10 | ### This file is part of Catacomb. |
| 11 | ### |
| 12 | ### Catacomb is free software; you can redistribute it and/or modify |
| 13 | ### it under the terms of the GNU Library General Public License as |
| 14 | ### published by the Free Software Foundation; either version 2 of the |
| 15 | ### License, or (at your option) any later version. |
| 16 | ### |
| 17 | ### Catacomb is distributed in the hope that it will be useful, |
| 18 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | ### GNU Library General Public License for more details. |
| 21 | ### |
| 22 | ### You should have received a copy of the GNU Library General Public |
| 23 | ### License along with Catacomb; if not, write to the Free |
| 24 | ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 25 | ### MA 02111-1307, USA. |
| 26 | |
| 27 | ###-------------------------------------------------------------------------- |
| 28 | ### Miscellaneous useful definitions. |
| 29 | |
| 30 | ## Installation directories. |
| 31 | archincludedir = $(pkglibdir)/include |
| 32 | |
| 33 | ###-------------------------------------------------------------------------- |
| 34 | ### Initial values of common variables. |
| 35 | |
| 36 | EXTRA_DIST = |
| 37 | CLEANFILES = |
| 38 | DISTCLEANFILES = |
| 39 | MAINTAINERCLEANFILES = |
| 40 | SUFFIXES = |
| 41 | TESTS = |
| 42 | BUILT_SOURCES = |
| 43 | |
| 44 | EXTRA_PROGRAMS = |
| 45 | noinst_PROGRAMS = |
| 46 | check_PROGRAMS = |
| 47 | pkginclude_HEADERS = |
| 48 | nodist_pkginclude_HEADERS = |
| 49 | archinclude_HEADERS = |
| 50 | nodist_archinclude_HEADERS = |
| 51 | |
| 52 | ###-------------------------------------------------------------------------- |
| 53 | ### Machinery for precomputations. |
| 54 | |
| 55 | ## Location of precomputed tables. |
| 56 | precomp = $(top_srcdir)/precomp |
| 57 | |
| 58 | ## Precomputed source code files. |
| 59 | PRECOMPS = |
| 60 | EXTRA_DIST += $(PRECOMPS) |
| 61 | BUILT_SOURCES += $(PRECOMPS) |
| 62 | MAINTAINERCLEANFILES += $(PRECOMPS) |
| 63 | |
| 64 | ## Programs which make the tables. These should be made by an explicit |
| 65 | ## recursive `make' call in the relevant rule, so that we don't try to |
| 66 | ## reconstruct them unnecessarily. |
| 67 | PRECOMP_PROGS = |
| 68 | EXTRA_PROGRAMS += $(PRECOMP_PROGS) |
| 69 | CLEANFILES += $(PRECOMP_PROGS) |
| 70 | |
| 71 | ###-------------------------------------------------------------------------- |
| 72 | ### Standard configuration substitutions. |
| 73 | |
| 74 | ## Substitute tags in files. |
| 75 | confsubst = $(top_srcdir)/config/confsubst |
| 76 | |
| 77 | SUBSTITUTIONS = \ |
| 78 | prefix=$(prefix) exec_prefix=$(exec_prefix) \ |
| 79 | libdir=$(libdir) includedir=$(includedir) \ |
| 80 | PACKAGE=$(PACKAGE) VERSION=$(VERSION) \ |
| 81 | CATACOMB_LIBS="$(CATACOMB_LIBS)" |
| 82 | |
| 83 | V_SUBST = $(V_SUBST_$(V)) |
| 84 | V_SUBST_ = $(V_SUBST_$(AM_DEFAULT_VERBOSITY)) |
| 85 | V_SUBST_0 = @echo " SUBST $@"; |
| 86 | SUBST = $(V_SUBST)$(confsubst) |
| 87 | |
| 88 | ###-------------------------------------------------------------------------- |
| 89 | ### Include path. |
| 90 | |
| 91 | CATACOMB_INCLUDES = \ |
| 92 | -I$(top_srcdir) \ |
| 93 | -I$(precomp)/math \ |
| 94 | -I$(precomp)/misc \ |
| 95 | -I$(precomp)/symm \ |
| 96 | -I$(top_srcdir)/base \ |
| 97 | -I$(top_srcdir)/key \ |
| 98 | -I$(top_srcdir)/math \ |
| 99 | -I$(top_builddir)/math \ |
| 100 | -I$(top_srcdir)/misc \ |
| 101 | -I$(top_srcdir)/pub \ |
| 102 | -I$(top_srcdir)/rand \ |
| 103 | -I$(top_srcdir)/symm \ |
| 104 | -I$(top_srcdir)/symm/modes -I$(top_builddir)/symm/modes |
| 105 | |
| 106 | AM_CPPFLAGS = $(CATACOMB_INCLUDES) |
| 107 | |
| 108 | ###-------------------------------------------------------------------------- |
| 109 | ### Testing. |
| 110 | |
| 111 | TEST_EXTENSIONS = .t |
| 112 | SUFFIXES += .c .t$(EXEEXT) .to |
| 113 | |
| 114 | ## This unpleasant duplication of rules makes the build system basically work |
| 115 | ## for non-GNU make(1) variants, while GNU Make will associate useful |
| 116 | ## additional dependencies with the test programs. GNU Make seems not to |
| 117 | ## mind the duplicate rules, and uses the second (better) set; non-GNU Make |
| 118 | ## will think the second set refer to bizarrely-named targets which nobody is |
| 119 | ## apparently interested in. |
| 120 | .c.to: |
| 121 | $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@ |
| 122 | .to.t$(EXEEXT): |
| 123 | $(AM_V_CCLD)$(LINK) $< $(TEST_LIBS) $(top_builddir)/libcatacomb.la \ |
| 124 | $(mLib_LIBS) $(CATACOMB_LIBS) $(LIBS) |
| 125 | %.to: %.c %.lo |
| 126 | $(AM_V_CC)$(COMPILE) -c -DTEST_RIG -DSRCDIR=\"$(srcdir)\" $< -o $@ |
| 127 | %.t$(EXEEXT): %.to $(TEST_LIBS) $(top_builddir)/libcatacomb.la |
| 128 | $(AM_V_CCLD)$(LINK) $+ $(mLib_LIBS) $(CATACOMB_LIBS) $(LIBS) |
| 129 | |
| 130 | .PRECIOUS: %.to %.t$(EXEEXT) |
| 131 | CLEANFILES += *.to *.t$(EXEEXT) |
| 132 | |
| 133 | ###----- That's all, folks -------------------------------------------------- |