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