declare variable at start of code block.
[barvinok.git] / Makefile.am
blob93642c8e82f25d838ea7c06e145ec12620697753
1 if HAVE_GINAC
2     MAYBE_BERNSTEIN = bernstein
3 endif
4 SUBDIRS = $(MAYBE_BERNSTEIN) lib . omega doc
6 lib/libgnu.la:
7         $(MAKE) $(AM_MAKEFLAGS) -C lib libgnu.la
8 bernstein/libbernstein.la:
9         $(MAKE) $(AM_MAKEFLAGS) -C bernstein libbernstein.la
11 AM_CPPFLAGS = -I$(srcdir)/bernstein/include -I$(srcdir)/lib @GINACLIB_CPPFLAGS@
12 AM_LDFLAGS = -Llib
14 lib_LTLIBRARIES = libbarvinok.la
15 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
16                   barvinok_ehrhart
17 noinst_PROGRAMS = test randomtest \
18                   remove_redundant_equalities \
19                   barvinok_union polytope_volume test_approx \
20                   @bv_extra_programs@
21 EXTRA_PROGRAMS = piptest verify_lexsmaller polyhedron_sample 4coins lexmin \
22                  polytope_scan barvinok_maximize
23 pkginclude_HEADERS = \
24     barvinok/NTL_QQ.h \
25     barvinok/barvinok.h \
26     barvinok/util.h \
27     barvinok/evalue.h \
28     barvinok/genfun.h \
29     barvinok/options.h \
30     barvinok/polylib.h \
31     barvinok/sample.h \
32     barvinok/basis_reduction.h \
33     barvinok/bernstein.h
34 LINK = $(CXXLINK)
36 if HAVE_GINAC
37     BERNSTEIN_CC = bernstein.cc
38 endif
39 if HAVE_CDDLIB
40     BR_CDD = basis_reduction_cdd.cc initcdd.cc
41 endif
42 if HAVE_GLPK
43     BR_GLPK = basis_reduction_glpk.c
44 endif
45 libbarvinok_la_SOURCES = \
46     barvinok/evalue.h \
47     barvinok/genfun.h \
48     barvinok/util.h \
49     barvinok/barvinok.h \
50     NTL_QQ.cc \
51     basis_reduction.c \
52     evalue.c \
53     genfun.cc \
54     util.c \
55     version.c \
56     bfcounter.cc \
57     bfcounter.h \
58     conversion.cc \
59     conversion.h \
60     decomposer.cc \
61     decomposer.h \
62     dpoly.cc \
63     dpoly.h \
64     genfun_constructor.cc \
65     genfun_constructor.h \
66     lattice_point.cc \
67     lattice_point.h \
68     options.c \
69     reduce_domain.c \
70     reduce_domain.h \
71     reducer.cc \
72     reducer.h \
73     remove_equalities.h \
74     scale.c \
75     scale.h \
76     scarf.cc \
77     volume.c \
78     volume.h \
79     mat_util.cc \
80     mat_util.h \
81     barvinok.cc \
82     $(BERNSTEIN_CC) \
83     $(BR_CDD) \
84     $(BR_GLPK)
85 EXTRA_libbarvinok_la_SOURCES = \
86     bernstein.cc \
87     piputil.h \
88     initcdd.cc \
89     initcdd.h
90 if HAVE_GINAC
91     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
92 endif
93 libbarvinok_la_LIBADD = @LTLIBOBJS@ $(BERNSTEIN_LA) lib/libgnu.la
94 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
95 LDADD = libbarvinok.la
97 test_SOURCES = test.c
98 barvinok_count_SOURCES = barvinok_count.c
99 barvinok_ehrhart_SOURCES = barvinok_ehrhart.cc
100 barvinok_union_SOURCES = barvinok_union.cc
101 if HAVE_OMEGA
102 BEEO_SOURCES = omega/Exit.cc omega/convert.cc
103 else
104 BEEO_SOURCES = 
105 endif
106 barvinok_enumerate_SOURCES = \
107         barvinok_enumerate.cc \
108         evalue_convert.cc \
109         evalue_convert.h \
110         fdstream.cc \
111         fdstream.h \
112         verify.h \
113         verify.c \
114         verif_ehrhart.h \
115         verif_ehrhart.c
116 barvinok_enumerate_e_SOURCES = \
117         barvinok_enumerate_e.cc \
118         evalue_convert.cc \
119         evalue_convert.h \
120         fdstream.cc \
121         fdstream.h \
122         verify.h \
123         verify.c \
124         verif_ehrhart.h \
125         verif_ehrhart.c \
126         $(BEEO_SOURCES)
127 barvinok_enumerate_e_CPPFLAGS = @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
128 barvinok_enumerate_e_LDFLAGS = @OMEGA_LDFLAGS@ @LDFLAGS@
129 barvinok_enumerate_e_LDADD = @OMEGA_LIBS@ libbarvinok.la
130 barvinok_maximize_SOURCES = \
131         evalue_convert.cc \
132         evalue_convert.h \
133         fdstream.cc \
134         fdstream.h \
135         maximize.cc \
136         verify.h \
137         verify.c
138 4coins_SOURCES = 4coins.cc
139 if HAVE_CDDLIB
140 POLYSIGN = polysign_cddf.cc polysign_cdd.cc
141 endif
142 lexmin_SOURCES = \
143         lexmin.h \
144         lexmin.cc \
145         combine.c \
146         combine.h \
147         edomain.cc \
148         edomain.h \
149         evalue_util.cc \
150         evalue_util.h \
151         fdstream.cc \
152         fdstream.h \
153         $(POLYSIGN) \
154         polysign.c \
155         polysign_polylib.c \
156         polysign.h \
157         verify.h \
158         verify.c
159 EXTRA_lexmin_SOURCE = polysign_cddf.cc polysign_cdd.cc polysign.c
160 test_approx_SOURCES = \
161         test_approx.c \
162         verify.h \
163         verify.c
165 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
167 EXTRA_DIST = \
168     ChangeLog \
169     $(TESTFILES) \
170     latte2polylib.pl \
171     NTL_5_3_2.patch \
172     doc/Internal.tex \
173     doc/applications.tex \
174     doc/barvinok.tex \
175     doc/omega.tex \
176     doc/polymake.tex \
177     doc/reports.tex \
178     doc/barvinok.bib \
179     doc/barvinok.gdf \
180     doc/chicago.bst \
181     doc/chicago.sty \
182     doc/mydefs.sty \
183     polymake/Makefile.in \
184     polymake/README \
185     polymake/autogen.sh \
186     polymake/configure.in \
187     polymake/lattice_points.cc
189 ACLOCAL_AMFLAGS = -I m4
191 install-data-local:
192         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
193         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
195 uninstall-local:
196         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
198 dist-hook:
199         (cd $(distdir)/polymake; \
200             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
201         (cd doc; make barvinok.pdf)
202         cp doc/barvinok.pdf $(distdir)/doc/
203         if test -f $(top_srcdir)/.git/HEAD; then \
204             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
205         else \
206             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
207         fi
209 if HAVE_PIPLIB
210 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
211 else
212 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf
213 endif
215 check: check-enumerate check-enumerate_e check-test check-lexmin check-approx
216 check-approx: test_approx
217         @for i in $(top_srcdir)/tests/ehrhart/*; do \
218             if test -f $$i; then \
219                 echo $$i | ./test_approx -q -r 10 ; \
220             fi \
221         done
222 check-enumerate: barvinok_enumerate
223         @for i in $(top_srcdir)/tests/ehrhart/*; do \
224             if test -f $$i; then \
225                 echo $$i; \
226                 for options in '' '--series' '--series --primal'; do \
227                     for spec in 'random' 'bf' 'df'; do \
228                         opt="--specialization=$$spec $$options"; \
229                         echo "        $$opt"; \
230                         ./barvinok_enumerate --verify $$opt < $$i; \
231                     done \
232                 done \
233             fi \
234         done
235 check-enumerate_e: barvinok_enumerate_e
236         @for dir in $(BEE_TESTDIRS); do \
237             for i in $(top_srcdir)/tests/$$dir/*; do \
238                 if test -f $$i; then \
239                     for options in '' '--pip' '--pip --omega'; do \
240                         for spec in 'random' 'bf' 'df'; do \
241                             opt="--specialization=$$spec $$options"; \
242                             echo $$i $$opt; \
243                             ./barvinok_enumerate_e --verify $$opt < $$i; \
244                         done \
245                     done \
246                 fi \
247             done \
248         done
249         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
250             if test -f $$i; then \
251                 for spec in 'random' 'bf' 'df'; do \
252                     opt="--specialization=$$spec --scarf"; \
253                     echo $$i $$opt; \
254                     ./barvinok_enumerate_e --verify $$opt < $$i; \
255                 done \
256             fi \
257         done
258 check-test: test
259         @for i in $(top_srcdir)/tests/*; do \
260             if test -f $$i; then \
261                 for options in '--index=10' '--primal --index=10'; do \
262                     for spec in 'random' 'bf' 'df'; do \
263                         opt="--specialization=$$spec $$options"; \
264                         echo -n $$i $$opt; \
265                         ./test $$opt < $$i || echo -n " NOT"; \
266                         echo " ok"; \
267                     done \
268                 done \
269             fi \
270         done
271 if HAVE_GLPK
272 check-lexmin: lexmin
273         @for i in $(top_srcdir)/tests/lexmin/*; do \
274             if test -f $$i; then \
275                 for spec in 'random' 'bf' 'df'; do \
276                     opt="--specialization=$$spec"; \
277                     echo $$i $$opt; \
278                     ./lexmin --verify $$opt < $$i; \
279                 done \
280             fi \
281         done
282 else
283 check-lexmin:
284 endif
286 version.h: @GIT_HEAD@
287         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@