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