test_bound: rewrite in C
[barvinok.git] / Makefile.am
blob2859f87e660e7aec00b01890239b01b9cd2fda3b
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 BUNDLED_ISL
11     MAYBE_ISL = isl
12     ISL_LA = $(top_builddir)/isl/libisl.la
13 endif
14 if BUNDLED_ISL_POLYLIB
15     MAYBE_ISL_POLYLIB = isl-polylib
16     ISL_POLYLIB_LA = $(top_builddir)/isl-polylib/libisl-polylib.la
17 endif
18 if BUNDLED_OMEGA
19     MAYBE_OMEGA = omega
20     OMEGA_LA = $(top_builddir)/omega/omega_lib/libomega.la
21 endif
22 if USE_ZSOLVE
23     MAYBE_ZSOLVE = zsolve
24 endif
25 if USE_PARKER
26     MAYBE_PARKER = parker
27 endif
28 SUBDIRS = $(MAYBE_PIPLIB) $(MAYBE_POLYLIB) $(MAYBE_ISL) $(MAYBE_ISL_POLYLIB) \
29                 $(MAYBE_BERNSTEIN) $(MAYBE_OMEGA) \
30                 lib $(MAYBE_ZSOLVE) $(MAYBE_PARKER) . doc
31 DIST_SUBDIRS = $(MAYBE_PIPLIB) $(MAYBE_POLYLIB) $(MAYBE_ISL) \
32                 $(MAYBE_ISL_POLYLIB) bernstein $(MAYBE_OMEGA) \
33                 lib zsolve parker doc
35 FORCE:
36 lib/libgnu.la: FORCE
37         cd lib; $(MAKE) $(AM_MAKEFLAGS) libgnu.la
38 bernstein/libbernstein.la: FORCE
39         cd bernstein; $(MAKE) $(AM_MAKEFLAGS) libbernstein.la
40 polylib/libpolylibgmp.la: FORCE
41         cd polylib; $(MAKE) $(AM_MAKEFLAGS) libpolylibgmp.la
42 piplib/libpiplibMP.la: FORCE
43         cd piplib; $(MAKE) $(AM_MAKEFLAGS) libpiplibMP.la
44 isl/libisl.la: FORCE
45         cd isl; $(MAKE) $(AM_MAKEFLAGS) libisl.la
46 isl-polylib/libisl-polylib.la: FORCE
47         cd isl-polylib; $(MAKE) $(AM_MAKEFLAGS) libisl-polylib.la
48 omega/omega_lib/libomega.la: FORCE
49         cd omega/omega_lib; $(MAKE) $(AM_MAKEFLAGS) libomega.la
50 zsolve/libzsolve.la: FORCE
51         cd zsolve; $(MAKE) $(AM_MAKEFLAGS) libzsolve.la
52 parker/libparker.la: FORCE
53         cd parker; $(MAKE) $(AM_MAKEFLAGS) libparker.la
55 AM_CPPFLAGS = -I$(srcdir)/bernstein/include -I$(srcdir)/lib -Ilib \
56               @POLYLIB_CPPFLAGS@ @PIPLIB_CPPFLAGS@ @ginac_CFLAGS@ \
57               @NTL_CPPFLAGS@ @ISL_CFLAGS@ @ISL_POLYLIB_CFLAGS@
58 AM_LDFLAGS = -Llib @POLYLIB_LDFLAGS@ @PIPLIB_LDFLAGS@ @NTL_LDFLAGS@
60 LIB_ISL = $(ISL_LA) @ISL_LIBS@
61 LIB_ISL_POLYLIB = $(ISL_POLYLIB_LA) @ISL_POLYLIB_LIBS@
63 lib_LTLIBRARIES = libbarvinok-core.la libbarvinok.la
64 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
65                   barvinok_ehrhart polytope_scan iscc
66 noinst_PROGRAMS = test testlib randomtest \
67                   remove_redundant_equalities \
68                   barvinok_union polytope_volume test_approx \
69                   barvinok_summate verify_lexsmaller \
70                   polyhedron_sample 4coins lexmin @bv_barvinok_bound@ \
71                   @bv_cone_hilbert_basis@ cone_integer_hull \
72                   polytope_lattice_width polytope_minimize \
73                   polyhedron_integer_hull vector_partition_chambers \
74                   semigroup_holes evalue_convert
75 EXTRA_PROGRAMS = barvinok_bound test_bound cone_hilbert_basis
76 pkginclude_HEADERS = \
77     barvinok/NTL_QQ.h \
78     barvinok/barvinok.h \
79     barvinok/util.h \
80     barvinok/evalue.h \
81     barvinok/genfun.h \
82     barvinok/options.h \
83     barvinok/polylib.h \
84     barvinok/sample.h \
85     barvinok/basis_reduction.h \
86     barvinok/bernstein.h
87 nodist_pkginclude_HEADERS = \
88     barvinok/NTL.h \
89     barvinok/set.h
90 LINK = $(CXXLINK)
92 if HAVE_CDDLIB
93     BR_CDD = basis_reduction_cdd.cc initcdd.cc
94     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
95 endif
96 if HAVE_GLPK
97     BR_GLPK = basis_reduction_glpk.c
98     POLYSIGN_GLPK = polysign_glpk.c
99 endif
100 if HAVE_TOPCOM
101     TOPCOM = topcom.c topcom.h
102 endif
103 if USE_ZSOLVE
104     HILBERT_C = hilbert.c
105 endif
106 libbarvinok_core_la_SOURCES = \
107     barvinok/evalue.h \
108     barvinok/genfun.h \
109     barvinok/util.h \
110     barvinok/barvinok.h \
111     NTL_QQ.cc \
112     basis_reduction.c \
113     basis_reduction_pip.c \
114     basis_reduction_pip_dual.c \
115     evalue.c \
116     genfun.cc \
117     util.c \
118     version.c \
119     bernoulli.c \
120     bernoulli.h \
121     bfcounter.cc \
122     bfcounter.h \
123     binomial.c \
124     binomial.h \
125     conversion.cc \
126     conversion.h \
127     counter.cc \
128     counter.h \
129     decomposer.cc \
130     decomposer.h \
131     dpoly.cc \
132     dpoly.h \
133     euler.cc \
134     euler.h \
135     evalue_isl.c \
136     genfun_constructor.cc \
137     genfun_constructor.h \
138     $(HILBERT_C) \
139     hilbert.h \
140     hull.c \
141     hull.h \
142     ilp.c \
143     ilp.h \
144     lattice_point.cc \
145     lattice_point.h \
146     lattice_width.c \
147     lattice_width.h \
148     laurent.cc \
149     laurent.h \
150     laurent_old.cc \
151     laurent_old.h \
152     normalization.c \
153     normalization.h \
154     options.c \
155     param_polynomial.cc \
156     param_polynomial.h \
157     param_util.c \
158     param_util.h \
159     $(POLYSIGN_CDD) \
160     $(POLYSIGN_GLPK) \
161     polysign.c \
162     polysign_pip.c \
163     polysign_polylib.c \
164     polysign.h \
165     power.h \
166     reduce_domain.c \
167     reduce_domain.h \
168     reducer.cc \
169     reducer.h \
170     remove_equalities.h \
171     remove_equalities.c \
172     sample.c \
173     scale.c \
174     scale.h \
175     scarf.cc \
176     section_array.h \
177     series.cc \
178     $(TOPCOM) \
179     summate.c \
180     summate.h \
181     vertex_cone.cc \
182     vertex_cone.h \
183     volume.c \
184     volume.h \
185     mat_util.cc \
186     mat_util.h \
187     matrix_read.cc \
188     matrix_read.h \
189     barvinok.cc \
190     barvinok_e.cc \
191     $(BR_CDD) \
192     $(BR_GLPK)
193 EXTRA_libbarvinok_core_la_SOURCES = \
194     basis_reduction_cdd.cc \
195     basis_reduction_glpk.c \
196     hilbert.c \
197     polysign_cddf.cc \
198     polysign_cdd.cc \
199     polysign.c \
200     initcdd.cc \
201     initcdd.h \
202     topcom.c \
203     topcom.h
204 if BUNDLED_POLYLIB
205     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
206 endif
207 if BUNDLED_PIPLIB
208     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
209 endif
210 if USE_ZSOLVE
211     ZSOLVE_LA = zsolve/libzsolve.la
212 endif
213 libbarvinok_core_la_LIBADD = @LTLIBOBJS@ $(LIB_ISL_POLYLIB) $(LIB_ISL) \
214                              $(POLYLIB_LA) @POLYLIB_LIBS@ \
215                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
216                              $(ZSOLVE_LA) lib/libgnu.la
217 libbarvinok_core_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
218                                 $(AM_LDFLAGS)
219 if HAVE_GINAC
220     BERNSTEIN_CC = bernstein.cc
221 else
222     BERNSTEIN_CC = dummy.c
223 endif
224 libbarvinok_la_SOURCES = \
225     bound_common.c \
226     bound_common.h \
227     $(BERNSTEIN_CC)
228 EXTRA_libbarvinok_la_SOURCES = \
229     bernstein.cc \
230     dummy.c
231 if HAVE_GINAC
232     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
233 endif
234 libbarvinok_la_LIBADD = libbarvinok-core.la $(BERNSTEIN_LA)
235 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
236                                 $(AM_LDFLAGS)
237 LDADD = libbarvinok-core.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
238         @POLYLIB_LIBS@ @PIPLIB_LIBS@
240 test_SOURCES = \
241         evalue_read.c \
242         evalue_read.h \
243         test.c
244 testlib_SOURCES = \
245         evalue_read.c \
246         evalue_read.h \
247         testlib.cc
248 barvinok_count_SOURCES = barvinok_count.c
249 barvinok_ehrhart_SOURCES = \
250         barvinok_ehrhart.cc \
251         evalue_convert.cc \
252         evalue_convert.h \
253         $(FDSTREAM)
254 barvinok_union_SOURCES = barvinok_union.cc
255 if HAVE_OMEGA
256 BEEO_SOURCES = \
257         omega_interface/Exit.cc \
258         omega_interface/convert.h \
259         omega_interface/convert.cc \
260         omega_interface/count.h \
261         omega_interface/count.cc
262 else
263 BEEO_SOURCES = 
264 endif
265 if USE_FDSTREAM
266 FDSTREAM = fdstream.cc fdstream.h
267 endif
268 barvinok_enumerate_SOURCES = \
269         barvinok_enumerate.cc \
270         evalue_convert.cc \
271         evalue_convert.h \
272         $(FDSTREAM) \
273         skewed_genfun.cc \
274         skewed_genfun.h \
275         verify.h \
276         verify.c \
277         verif_ehrhart.h \
278         verif_ehrhart.c \
279         verify_series.h \
280         verify_series.cc
281 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
282 barvinok_enumerate_e_SOURCES = \
283         barvinok_enumerate_e.cc \
284         evalue_convert.cc \
285         evalue_convert.h \
286         $(FDSTREAM) \
287         skewed_genfun.cc \
288         skewed_genfun.h \
289         verify.h \
290         verify.c \
291         verif_ehrhart.h \
292         verif_ehrhart.c \
293         verify_series.h \
294         verify_series.cc \
295         $(BEEO_SOURCES)
296 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
297 if USE_PARKER
298     MONA_LIBS = -ldfa -lbdd -lmem
299     PARKER_LA = parker/libparker.la
300     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
301     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
302 endif
303 barvinok_enumerate_e_CPPFLAGS = \
304         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
305 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
306 barvinok_enumerate_e_LDADD = \
307         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ $(OMEGA_LA) libbarvinok-core.la \
308         @ISL_POLYLIB_LIBS@ @ISL_LIBS@ @POLYLIB_LIBS@ @PIPLIB_LIBS@
309 barvinok_bound_SOURCES = \
310         evalue_convert.cc \
311         evalue_convert.h \
312         evalue_read.c \
313         evalue_read.h \
314         $(FDSTREAM) \
315         bound.cc \
316         verify.h \
317         verify.c
318 EXTRA_barvinok_bound_SOURCES = fdstream.cc fdstream.h
319 barvinok_bound_LDADD = \
320         libbarvinok-core.la libbarvinok.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
321         @POLYLIB_LIBS@ @PIPLIB_LIBS@
322 barvinok_summate_SOURCES = \
323         barvinok_summate.cc \
324         evalue_convert.cc \
325         evalue_convert.h \
326         evalue_read.c \
327         evalue_read.h \
328         $(FDSTREAM) \
329         verify.h \
330         verify.c
331 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
332 4coins_SOURCES = 4coins.cc
333 semigroup_holes_SOURCES = semigroup_holes.cc
334 lexmin_SOURCES = \
335         lexmin.h \
336         lexmin.cc \
337         combine.c \
338         combine.h \
339         edomain.cc \
340         edomain.h \
341         evalue_util.cc \
342         evalue_util.h \
343         verify.h \
344         verify.c
345 test_approx_SOURCES = \
346         test_approx.c \
347         verify.h \
348         verify.c
349 test_bound_SOURCES = \
350         test_bound.c \
351         evalue_convert.cc \
352         evalue_convert.h \
353         evalue_read.c \
354         evalue_read.h \
355         $(FDSTREAM) \
356         verify.h \
357         verify.c
358 EXTRA_test_bound_SOURCES = fdstream.cc fdstream.h
359 test_bound_LDADD = \
360         libbarvinok-core.la libbarvinok.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
361         @POLYLIB_LIBS@ @PIPLIB_LIBS@
362 evalue_convert_SOURCES = \
363         evalue_convert_main.c \
364         evalue_convert.cc \
365         evalue_convert.h \
366         evalue_read.c \
367         evalue_read.h \
368         $(FDSTREAM)
369 iscc_SOURCES =  \
370         isl_obj_list.h \
371         isl_obj_list.c \
372         iscc.c
373 iscc_LDADD = \
374         libbarvinok.la libbarvinok-core.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
375         @POLYLIB_LIBS@ @PIPLIB_LIBS@
377 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
379 EXTRA_DIST = \
380     ChangeLog \
381     $(TESTFILES) \
382     latte2polylib.pl \
383     NTL_5_3_2.patch \
384     basis_reduction_templ.c \
385     cdd94e-test \
386     polysign_cdd_template.cc \
387     barvinok/NTL.h.broken \
388     barvinok/NTL.h.normal \
389     barvinok/set.h.broken \
390     barvinok/set.h.normal \
391     doc/isl.tex \
392     doc/Internal.tex \
393     doc/applications.tex \
394     doc/barvinok.tex \
395     doc/omega.tex \
396     doc/polymake.tex \
397     doc/reports.tex \
398     doc/barvinok.bib \
399     doc/barvinok.gdf \
400     doc/chicago.bst \
401     doc/chicago.sty \
402     doc/mydefs.sty \
403     polymake/Makefile.in \
404     polymake/README \
405     polymake/autogen.sh \
406     polymake/configure.in \
407     polymake/convert.cc \
408     polymake/convert.h \
409     polymake/h_star_vector.cc \
410     polymake/lattice_points.cc
412 ACLOCAL_AMFLAGS = -I m4
414 install-data-local:
415         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
416         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
418 uninstall-local:
419         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
421 dist-hook:
422         (cd $(distdir)/polymake; \
423             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
424         (cd doc; make barvinok.pdf)
425         cp doc/barvinok.pdf $(distdir)/doc/
426         if test -f $(top_srcdir)/.git/HEAD; then \
427             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
428         else \
429             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
430         fi
432 dist-git: dist
433         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
435 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
437 check: check-testlib check-enumerate check-enumerate_e check-test \
438         check-lexmin check-approx check-evalue check-euler check-lw
439 check-testlib: testlib$(EXEEXT)
440         ./testlib$(EXEEXT)
441 check-approx: test_approx$(EXEEXT)
442         @for i in $(top_srcdir)/tests/ehrhart/*; do \
443             if test -f $$i; then \
444                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
445             fi \
446         done
447 check-evalue: @bv_barvinok_bound@ barvinok_summate$(EXEEXT)
448         @for i in $(top_srcdir)/tests/evalue/*; do \
449             if test -f $$i; then \
450                 echo $$i; \
451                 if test -n "@bv_barvinok_bound@"; then \
452                     ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
453                     echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
454                 fi; \
455                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
456             fi \
457         done
458 check-euler: barvinok_summate$(EXEEXT)
459         @for i in $(top_srcdir)/tests/euler/*; do \
460             if test -f $$i; then \
461                 for method in 'euler' 'laurent_old' 'laurent'; do \
462                     opt="--summation=$$method"; \
463                     echo $$i $$opt; \
464                     ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
465                 done \
466             fi \
467         done
468 if HAVE_TOPCOM
469     TOPCOM_CD = '--chamber-decomposition=topcom'
470 endif
471 check-enumerate: barvinok_enumerate$(EXEEXT)
472         @for i in $(top_srcdir)/tests/ehrhart/*; do \
473             if test -f $$i; then \
474                 echo $$i; \
475                 for options in '' '--series' '--series --primal' $(TOPCOM_CD); do \
476                     for spec in 'random' 'bf' 'df'; do \
477                         opt="--specialization=$$spec $$options"; \
478                         echo "        $$opt"; \
479                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
480                     done \
481                 done; \
482                 opt="--summation=bernoulli"; \
483                 echo "        $$opt"; \
484                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
485             fi \
486         done
487 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
488         @for dir in $(BEE_TESTDIRS); do \
489             for i in $(top_srcdir)/tests/$$dir/*; do \
490                 if test -f $$i; then \
491                     for options in '' '--isl --omega' '--isl'; do \
492                         for spec in 'random' 'bf' 'df'; do \
493                             opt="--specialization=$$spec $$options"; \
494                             echo $$i $$opt; \
495                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
496                         done \
497                     done \
498                 fi \
499             done \
500         done
501         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
502             if test -f $$i; then \
503                 for spec in 'random' 'bf' 'df'; do \
504                     opt="--specialization=$$spec --scarf"; \
505                     echo $$i $$opt; \
506                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
507                 done; \
508                 echo $$i --series; \
509                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
510             fi \
511         done
512 check-test: test$(EXEEXT)
513         @failed=0; \
514         for i in $(top_srcdir)/tests/*; do \
515             if test -f $$i; then \
516                 for options in '--index=10' '--primal --index=10'; do \
517                     for spec in 'random' 'bf' 'df' 'todd'; do \
518                         opt="--specialization=$$spec $$options"; \
519                         echo -n $$i $$opt; \
520                         ./test$(EXEEXT) $$opt < $$i; \
521                         if test "$$?" -ne "0"; then \
522                             failed=`expr $$failed + 1`; \
523                             echo " NOT ok"; \
524                         else \
525                             echo " ok"; \
526                         fi; \
527                     done \
528                 done \
529             fi \
530         done; \
531         for i in $(top_srcdir)/tests/sample/*; do \
532             echo -n $$i; \
533             ./test$(EXEEXT) < $$i; \
534             if test "$$?" -ne "0"; then \
535                 failed=`expr $$failed + 1`; \
536                 echo " NOT ok"; \
537             else \
538                 echo " ok"; \
539             fi; \
540         done; \
541         if test $$failed != 0; then \
542                 echo "$$failed tests failed"; \
543                 exit -1; \
544         fi
545 check-lw: test$(EXEEXT)
546         @failed=0; \
547         for i in $(top_srcdir)/tests/lattice_width/*; do \
548             if test -f $$i; then \
549                 echo -n $$i; \
550                 ./test$(EXEEXT) < $$i; \
551                 if test "$$?" -ne "0"; then \
552                     failed=`expr $$failed + 1`; \
553                     echo " NOT ok"; \
554                 else \
555                     echo " ok"; \
556                 fi; \
557             fi \
558         done; \
559         if test $$failed != 0; then \
560                 echo "$$failed tests failed"; \
561                 exit -1; \
562         fi
563 if HAVE_GLPK
564 check-lexmin: lexmin$(EXEEXT)
565         @for i in $(top_srcdir)/tests/lexmin/*; do \
566             if test -f $$i; then \
567                 for spec in 'random' 'bf' 'df'; do \
568                     opt="--specialization=$$spec"; \
569                     echo $$i $$opt; \
570                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
571                 done \
572             fi \
573         done
574 else
575 check-lexmin:
576 endif
578 version.h: @GIT_HEAD@
579         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@