for_each_lower_upper_bound: add another callback for initialization
[barvinok.git] / Makefile.am
bloba10f4e71345448690d5ef79d7429b6f45068331e
1 if HAVE_GINAC
2     MAYBE_BERNSTEIN = bernstein
3 endif
4 if BUNDLED_POLYLIB
5     MAYBE_POLYLIB = polylib
6 endif
7 if BUNDLED_PIPLIB
8     MAYBE_PIPLIB = piplib
9 endif
10 if USE_ZSOLVE
11     MAYBE_ZSOLVE = zsolve
12 endif
13 SUBDIRS = $(MAYBE_PIPLIB) $(MAYBE_POLYLIB) $(MAYBE_BERNSTEIN) \
14                 lib $(MAYBE_ZSOLVE) . omega doc
16 FORCE:
17 lib/libgnu.la: FORCE
18         $(MAKE) $(AM_MAKEFLAGS) -C lib libgnu.la
19 bernstein/libbernstein.la: FORCE
20         $(MAKE) $(AM_MAKEFLAGS) -C bernstein libbernstein.la
21 polylib/libpolylibgmp.la: FORCE
22         $(MAKE) $(AM_MAKEFLAGS) -C polylib libpolylibgmp.la
23 piplib/libpiplibMP.la: FORCE
24         $(MAKE) $(AM_MAKEFLAGS) -C piplib libpiplibMP.la
25 zsolve/libzsolve.la: FORCE
26         $(MAKE) $(AM_MAKEFLAGS) -C zsolve libzsolve.la
28 AM_CPPFLAGS = -I$(srcdir)/bernstein/include -I$(srcdir)/lib \
29               @POLYLIB_CPPFLAGS@ @PIPLIB_CPPFLAGS@ @ginac_CFLAGS@
30 AM_LDFLAGS = -Llib @POLYLIB_LDFLAGS@ @PIPLIB_LDFLAGS@
32 lib_LTLIBRARIES = libbarvinok-core.la libbarvinok.la
33 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
34                   barvinok_ehrhart polytope_scan
35 noinst_PROGRAMS = test testlib randomtest \
36                   remove_redundant_equalities \
37                   barvinok_union polytope_volume test_approx \
38                   barvinok_summate verify_lexsmaller piptest \
39                   polyhedron_sample 4coins lexmin @bv_barvinok_maximize@ \
40                   @bv_cone_hilbert_basis@ cone_integer_hull \
41                   polytope_lattice_width polytope_minimize \
42                   polyhedron_integer_hull
43 EXTRA_PROGRAMS = barvinok_maximize cone_hilbert_basis
44 pkginclude_HEADERS = \
45     barvinok/NTL_QQ.h \
46     barvinok/barvinok.h \
47     barvinok/util.h \
48     barvinok/evalue.h \
49     barvinok/genfun.h \
50     barvinok/options.h \
51     barvinok/polylib.h \
52     barvinok/sample.h \
53     barvinok/basis_reduction.h \
54     barvinok/bernstein.h
55 nodist_pkginclude_HEADERS = \
56     barvinok/NTL.h \
57     barvinok/set.h
58 LINK = $(CXXLINK)
60 if HAVE_CDDLIB
61     BR_CDD = basis_reduction_cdd.cc initcdd.cc
62     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
63 endif
64 if HAVE_GLPK
65     BR_GLPK = basis_reduction_glpk.c
66     POLYSIGN_GLPK = polysign_glpk.c
67 endif
68 if HAVE_TOPCOM
69     TOPCOM = topcom.c topcom.h
70 endif
71 if USE_ZSOLVE
72     HILBERT_C = hilbert.c
73 endif
74 libbarvinok_core_la_SOURCES = \
75     barvinok/evalue.h \
76     barvinok/genfun.h \
77     barvinok/util.h \
78     barvinok/barvinok.h \
79     NTL_QQ.cc \
80     basis_reduction.c \
81     basis_reduction_pip.c \
82     basis_reduction_pip_dual.c \
83     evalue.c \
84     genfun.cc \
85     util.c \
86     version.c \
87     bernoulli.c \
88     bernoulli.h \
89     bfcounter.cc \
90     bfcounter.h \
91     conversion.cc \
92     conversion.h \
93     counter.cc \
94     counter.h \
95     decomposer.cc \
96     decomposer.h \
97     dpoly.cc \
98     dpoly.h \
99     euler.cc \
100     euler.h \
101     genfun_constructor.cc \
102     genfun_constructor.h \
103     $(HILBERT_C) \
104     hilbert.h \
105     hull.c \
106     hull.h \
107     ilp.c \
108     ilp.h \
109     lattice_point.cc \
110     lattice_point.h \
111     lattice_width.c \
112     lattice_width.h \
113     options.c \
114     param_util.c \
115     param_util.h \
116     piputil.h \
117     piputil.c \
118     $(POLYSIGN_CDD) \
119     $(POLYSIGN_GLPK) \
120     polysign.c \
121     polysign_pip.c \
122     polysign_polylib.c \
123     polysign.h \
124     reduce_domain.c \
125     reduce_domain.h \
126     reducer.cc \
127     reducer.h \
128     remove_equalities.h \
129     remove_equalities.c \
130     sample.c \
131     scale.c \
132     scale.h \
133     scarf.cc \
134     series.cc \
135     $(TOPCOM) \
136     volume.c \
137     volume.h \
138     mat_util.cc \
139     mat_util.h \
140     matrix_read.cc \
141     matrix_read.h \
142     barvinok.cc \
143     barvinok_e.cc \
144     $(BR_CDD) \
145     $(BR_GLPK)
146 EXTRA_libbarvinok_la_SOURCES = \
147     basis_reduction_cdd.cc \
148     basis_reduction_glpk.c \
149     bernstein.cc \
150     hilbert.c \
151     polysign_cddf.cc \
152     polysign_cdd.cc \
153     polysign.c \
154     initcdd.cc \
155     initcdd.h \
156     topcom.c \
157     topcom.h
158 if BUNDLED_POLYLIB
159     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
160 endif
161 if BUNDLED_PIPLIB
162     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
163 endif
164 if USE_ZSOLVE
165     ZSOLVE_LA = zsolve/libzsolve.la
166 endif
167 libbarvinok_core_la_LIBADD = @LTLIBOBJS@ $(POLYLIB_LA) @POLYLIB_LIBS@ \
168                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
169                              $(ZSOLVE_LA) lib/libgnu.la
170 libbarvinok_core_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
171 if HAVE_GINAC
172     BERNSTEIN_CC = bernstein.cc
173 endif
174 libbarvinok_la_SOURCES = \
175     $(BERNSTEIN_CC)
176 if HAVE_GINAC
177     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
178 endif
179 libbarvinok_la_LIBADD = libbarvinok-core.la $(BERNSTEIN_LA)
180 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
181 LDADD = libbarvinok-core.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
183 test_SOURCES = \
184         evalue_read.c \
185         evalue_read.h \
186         test.c
187 testlib_SOURCES = \
188         evalue_read.c \
189         evalue_read.h \
190         testlib.cc
191 barvinok_count_SOURCES = barvinok_count.c
192 barvinok_ehrhart_SOURCES = barvinok_ehrhart.cc
193 barvinok_union_SOURCES = barvinok_union.cc
194 if HAVE_OMEGA
195 BEEO_SOURCES = omega/Exit.cc omega/convert.cc
196 else
197 BEEO_SOURCES = 
198 endif
199 if USE_FDSTREAM
200 FDSTREAM = fdstream.cc fdstream.h
201 endif
202 barvinok_enumerate_SOURCES = \
203         barvinok_enumerate.cc \
204         evalue_convert.cc \
205         evalue_convert.h \
206         $(FDSTREAM) \
207         skewed_genfun.cc \
208         skewed_genfun.h \
209         verify.h \
210         verify.c \
211         verif_ehrhart.h \
212         verif_ehrhart.c \
213         verify_series.h \
214         verify_series.cc
215 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
216 barvinok_enumerate_e_SOURCES = \
217         barvinok_enumerate_e.cc \
218         evalue_convert.cc \
219         evalue_convert.h \
220         $(FDSTREAM) \
221         skewed_genfun.cc \
222         skewed_genfun.h \
223         verify.h \
224         verify.c \
225         verif_ehrhart.h \
226         verif_ehrhart.c \
227         verify_series.h \
228         verify_series.cc \
229         $(BEEO_SOURCES)
230 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
231 barvinok_enumerate_e_CPPFLAGS = @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
232 barvinok_enumerate_e_LDFLAGS = @OMEGA_LDFLAGS@ @LDFLAGS@
233 barvinok_enumerate_e_LDADD = \
234         @OMEGA_LIBS@ libbarvinok-core.la \
235         @POLYLIB_LIBS@ @PIPLIB_LIBS@
236 barvinok_maximize_SOURCES = \
237         evalue_convert.cc \
238         evalue_convert.h \
239         evalue_read.c \
240         evalue_read.h \
241         $(FDSTREAM) \
242         maximize.cc \
243         verify.h \
244         verify.c
245 EXTRA_barvinok_maximize_SOURCES = fdstream.cc fdstream.h
246 barvinok_maximize_LDADD = \
247         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
248 barvinok_summate_SOURCES = \
249         evalue_convert.cc \
250         evalue_convert.h \
251         evalue_read.c \
252         evalue_read.h \
253         $(FDSTREAM) \
254         summate.cc \
255         verify.h \
256         verify.c
257 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
258 4coins_SOURCES = 4coins.cc
259 lexmin_SOURCES = \
260         lexmin.h \
261         lexmin.cc \
262         combine.c \
263         combine.h \
264         edomain.cc \
265         edomain.h \
266         evalue_util.cc \
267         evalue_util.h \
268         verify.h \
269         verify.c
270 test_approx_SOURCES = \
271         test_approx.c \
272         verify.h \
273         verify.c
275 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
277 EXTRA_DIST = \
278     ChangeLog \
279     $(TESTFILES) \
280     latte2polylib.pl \
281     NTL_5_3_2.patch \
282     basis_reduction_templ.c \
283     polysign_cdd_template.cc \
284     barvinok/NTL.h.broken \
285     barvinok/NTL.h.normal \
286     barvinok/set.h.broken \
287     barvinok/set.h.normal \
288     doc/Internal.tex \
289     doc/applications.tex \
290     doc/barvinok.tex \
291     doc/omega.tex \
292     doc/polymake.tex \
293     doc/reports.tex \
294     doc/barvinok.bib \
295     doc/barvinok.gdf \
296     doc/chicago.bst \
297     doc/chicago.sty \
298     doc/mydefs.sty \
299     polymake/Makefile.in \
300     polymake/README \
301     polymake/autogen.sh \
302     polymake/configure.in \
303     polymake/convert.cc \
304     polymake/convert.h \
305     polymake/h_star_vector.cc \
306     polymake/lattice_points.cc
308 ACLOCAL_AMFLAGS = -I m4
310 install-data-local:
311         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
312         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
314 uninstall-local:
315         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
317 dist-hook:
318         (cd $(distdir)/polymake; \
319             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
320         (cd doc; make barvinok.pdf)
321         cp doc/barvinok.pdf $(distdir)/doc/
322         if test -f $(top_srcdir)/.git/HEAD; then \
323             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
324         else \
325             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
326         fi
328 dist-git: dist
329         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
331 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
333 check: check-testlib check-enumerate check-enumerate_e check-test \
334         check-lexmin check-approx check-evalue check-euler check-lw
335 check-testlib: testlib$(EXEEXT)
336         ./testlib$(EXEEXT)
337 check-approx: test_approx$(EXEEXT)
338         @for i in $(top_srcdir)/tests/ehrhart/*; do \
339             if test -f $$i; then \
340                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
341             fi \
342         done
343 check-evalue: @bv_barvinok_maximize@ barvinok_summate$(EXEEXT)
344         @for i in $(top_srcdir)/tests/evalue/*; do \
345             if test -f $$i; then \
346                 echo $$i; \
347                 if test -n "@bv_barvinok_maximize@"; then \
348                     ./barvinok_maximize$(EXEEXT) -T < $$i || exit; \
349                 fi; \
350                 ./barvinok_summate$(EXEEXT) -T < $$i || exit; \
351             fi \
352         done
353 check-euler: barvinok_summate$(EXEEXT)
354         @for i in $(top_srcdir)/tests/euler/*; do \
355             if test -f $$i; then \
356                 echo $$i; \
357                 ./barvinok_summate$(EXEEXT) -T --summation=euler < $$i || exit; \
358             fi \
359         done
360 if HAVE_TOPCOM
361     TOPCOM_CD = '--chamber-decomposition=topcom'
362 endif
363 check-enumerate: barvinok_enumerate$(EXEEXT)
364         @for i in $(top_srcdir)/tests/ehrhart/*; do \
365             if test -f $$i; then \
366                 echo $$i; \
367                 for options in '' '--series' '--series --primal' $(TOPCOM_CD); do \
368                     for spec in 'random' 'bf' 'df'; do \
369                         opt="--specialization=$$spec $$options"; \
370                         echo "        $$opt"; \
371                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
372                     done \
373                 done \
374             fi \
375         done
376 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
377         @for dir in $(BEE_TESTDIRS); do \
378             for i in $(top_srcdir)/tests/$$dir/*; do \
379                 if test -f $$i; then \
380                     for options in '' '--pip' '--pip --omega'; do \
381                         for spec in 'random' 'bf' 'df'; do \
382                             opt="--specialization=$$spec $$options"; \
383                             echo $$i $$opt; \
384                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
385                         done \
386                     done \
387                 fi \
388             done \
389         done
390         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
391             if test -f $$i; then \
392                 for spec in 'random' 'bf' 'df'; do \
393                     opt="--specialization=$$spec --scarf"; \
394                     echo $$i $$opt; \
395                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
396                 done; \
397                 echo $$i --series; \
398                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
399             fi \
400         done
401 check-test: test$(EXEEXT)
402         @for i in $(top_srcdir)/tests/*; do \
403             if test -f $$i; then \
404                 for options in '--index=10' '--primal --index=10'; do \
405                     for spec in 'random' 'bf' 'df' 'todd'; do \
406                         opt="--specialization=$$spec $$options"; \
407                         echo -n $$i $$opt; \
408                         ./test$(EXEEXT) $$opt < $$i || echo -n " NOT"; \
409                         echo " ok"; \
410                     done \
411                 done \
412             fi \
413         done
414 check-lw: test$(EXEEXT)
415         @for i in $(top_srcdir)/tests/lattice_width/*; do \
416             if test -f $$i; then \
417                 echo -n $$i; \
418                 ./test$(EXEEXT) < $$i || echo -n " NOT"; \
419                 echo " ok"; \
420             fi \
421         done
422 if HAVE_GLPK
423 check-lexmin: lexmin$(EXEEXT)
424         @for i in $(top_srcdir)/tests/lexmin/*; do \
425             if test -f $$i; then \
426                 for spec in 'random' 'bf' 'df'; do \
427                     opt="--specialization=$$spec"; \
428                     echo $$i $$opt; \
429                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
430                 done \
431             fi \
432         done
433 else
434 check-lexmin:
435 endif
437 version.h: @GIT_HEAD@
438         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@