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