power.h: extract from euler.cc
[barvinok.git] / Makefile.am
blob640b270bb087ad0fd4957f0df4631be0e2ce13d1
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     conversion.cc \
97     conversion.h \
98     counter.cc \
99     counter.h \
100     decomposer.cc \
101     decomposer.h \
102     dpoly.cc \
103     dpoly.h \
104     euler.cc \
105     euler.h \
106     genfun_constructor.cc \
107     genfun_constructor.h \
108     $(HILBERT_C) \
109     hilbert.h \
110     hull.c \
111     hull.h \
112     ilp.c \
113     ilp.h \
114     lattice_point.cc \
115     lattice_point.h \
116     lattice_width.c \
117     lattice_width.h \
118     normalization.c \
119     normalization.h \
120     options.c \
121     param_util.c \
122     param_util.h \
123     piputil.h \
124     piputil.c \
125     $(POLYSIGN_CDD) \
126     $(POLYSIGN_GLPK) \
127     polysign.c \
128     polysign_pip.c \
129     polysign_polylib.c \
130     polysign.h \
131     power.h \
132     reduce_domain.c \
133     reduce_domain.h \
134     reducer.cc \
135     reducer.h \
136     remove_equalities.h \
137     remove_equalities.c \
138     sample.c \
139     scale.c \
140     scale.h \
141     scarf.cc \
142     series.cc \
143     $(TOPCOM) \
144     volume.c \
145     volume.h \
146     mat_util.cc \
147     mat_util.h \
148     matrix_read.cc \
149     matrix_read.h \
150     barvinok.cc \
151     barvinok_e.cc \
152     $(BR_CDD) \
153     $(BR_GLPK)
154 EXTRA_libbarvinok_la_SOURCES = \
155     basis_reduction_cdd.cc \
156     basis_reduction_glpk.c \
157     range.cc \
158     range.h \
159     bernstein.cc \
160     hilbert.c \
161     polysign_cddf.cc \
162     polysign_cdd.cc \
163     polysign.c \
164     initcdd.cc \
165     initcdd.h \
166     topcom.c \
167     topcom.h
168 if BUNDLED_POLYLIB
169     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
170 endif
171 if BUNDLED_PIPLIB
172     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
173 endif
174 if USE_ZSOLVE
175     ZSOLVE_LA = zsolve/libzsolve.la
176 endif
177 libbarvinok_core_la_LIBADD = @LTLIBOBJS@ $(POLYLIB_LA) @POLYLIB_LIBS@ \
178                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
179                              $(ZSOLVE_LA) lib/libgnu.la
180 libbarvinok_core_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
181 if HAVE_GINAC
182     BERNSTEIN_CC = bernstein.cc range.cc
183 endif
184 libbarvinok_la_SOURCES = \
185     $(BERNSTEIN_CC)
186 if HAVE_GINAC
187     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
188 endif
189 libbarvinok_la_LIBADD = libbarvinok-core.la $(BERNSTEIN_LA)
190 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
191 LDADD = libbarvinok-core.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
193 test_SOURCES = \
194         evalue_read.c \
195         evalue_read.h \
196         test.c
197 testlib_SOURCES = \
198         evalue_read.c \
199         evalue_read.h \
200         testlib.cc
201 barvinok_count_SOURCES = barvinok_count.c
202 barvinok_ehrhart_SOURCES = barvinok_ehrhart.cc
203 barvinok_union_SOURCES = barvinok_union.cc
204 if HAVE_OMEGA
205 BEEO_SOURCES = omega/Exit.cc omega/convert.cc omega/count.cc
206 else
207 BEEO_SOURCES = 
208 endif
209 if USE_FDSTREAM
210 FDSTREAM = fdstream.cc fdstream.h
211 endif
212 barvinok_enumerate_SOURCES = \
213         barvinok_enumerate.cc \
214         evalue_convert.cc \
215         evalue_convert.h \
216         $(FDSTREAM) \
217         skewed_genfun.cc \
218         skewed_genfun.h \
219         verify.h \
220         verify.c \
221         verif_ehrhart.h \
222         verif_ehrhart.c \
223         verify_series.h \
224         verify_series.cc
225 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
226 barvinok_enumerate_e_SOURCES = \
227         barvinok_enumerate_e.cc \
228         evalue_convert.cc \
229         evalue_convert.h \
230         $(FDSTREAM) \
231         skewed_genfun.cc \
232         skewed_genfun.h \
233         verify.h \
234         verify.c \
235         verif_ehrhart.h \
236         verif_ehrhart.c \
237         verify_series.h \
238         verify_series.cc \
239         $(BEEO_SOURCES)
240 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
241 if USE_PARKER
242     MONA_LIBS = -ldfa -lbdd -lmem
243     PARKER_LA = parker/libparker.la
244     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
245     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
246 endif
247 barvinok_enumerate_e_CPPFLAGS = \
248         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
249 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
250 barvinok_enumerate_e_LDADD = \
251         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ libbarvinok-core.la \
252         @POLYLIB_LIBS@ @PIPLIB_LIBS@
253 barvinok_bound_SOURCES = \
254         evalue_convert.cc \
255         evalue_convert.h \
256         evalue_read.c \
257         evalue_read.h \
258         $(FDSTREAM) \
259         bound.cc \
260         verify.h \
261         verify.c
262 EXTRA_barvinok_bound_SOURCES = fdstream.cc fdstream.h
263 barvinok_bound_LDADD = \
264         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
265 barvinok_summate_SOURCES = \
266         evalue_convert.cc \
267         evalue_convert.h \
268         evalue_read.c \
269         evalue_read.h \
270         $(FDSTREAM) \
271         summate.cc \
272         verify.h \
273         verify.c
274 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
275 4coins_SOURCES = 4coins.cc
276 lexmin_SOURCES = \
277         lexmin.h \
278         lexmin.cc \
279         combine.c \
280         combine.h \
281         edomain.cc \
282         edomain.h \
283         evalue_util.cc \
284         evalue_util.h \
285         verify.h \
286         verify.c
287 test_approx_SOURCES = \
288         test_approx.c \
289         verify.h \
290         verify.c
291 test_bound_SOURCES = \
292         test_bound.cc \
293         evalue_convert.cc \
294         evalue_convert.h \
295         evalue_read.c \
296         evalue_read.h \
297         $(FDSTREAM) \
298         verify.h \
299         verify.c
300 EXTRA_test_bound_SOURCES = fdstream.cc fdstream.h
301 test_bound_LDADD = \
302         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
304 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
306 EXTRA_DIST = \
307     ChangeLog \
308     $(TESTFILES) \
309     latte2polylib.pl \
310     NTL_5_3_2.patch \
311     basis_reduction_templ.c \
312     cdd94e-test \
313     polysign_cdd_template.cc \
314     barvinok/NTL.h.broken \
315     barvinok/NTL.h.normal \
316     barvinok/set.h.broken \
317     barvinok/set.h.normal \
318     doc/Internal.tex \
319     doc/applications.tex \
320     doc/barvinok.tex \
321     doc/omega.tex \
322     doc/polymake.tex \
323     doc/reports.tex \
324     doc/barvinok.bib \
325     doc/barvinok.gdf \
326     doc/chicago.bst \
327     doc/chicago.sty \
328     doc/mydefs.sty \
329     polymake/Makefile.in \
330     polymake/README \
331     polymake/autogen.sh \
332     polymake/configure.in \
333     polymake/convert.cc \
334     polymake/convert.h \
335     polymake/h_star_vector.cc \
336     polymake/lattice_points.cc
338 ACLOCAL_AMFLAGS = -I m4
340 install-data-local:
341         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
342         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
344 uninstall-local:
345         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
347 dist-hook:
348         (cd $(distdir)/polymake; \
349             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
350         (cd doc; make barvinok.pdf)
351         cp doc/barvinok.pdf $(distdir)/doc/
352         if test -f $(top_srcdir)/.git/HEAD; then \
353             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
354         else \
355             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
356         fi
358 dist-git: dist
359         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
361 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
363 check: check-testlib check-enumerate check-enumerate_e check-test \
364         check-lexmin check-approx check-evalue check-euler check-lw
365 check-testlib: testlib$(EXEEXT)
366         ./testlib$(EXEEXT)
367 check-approx: test_approx$(EXEEXT)
368         @for i in $(top_srcdir)/tests/ehrhart/*; do \
369             if test -f $$i; then \
370                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
371             fi \
372         done
373 check-evalue: @bv_barvinok_bound@ barvinok_summate$(EXEEXT)
374         @for i in $(top_srcdir)/tests/evalue/*; do \
375             if test -f $$i; then \
376                 echo $$i; \
377                 if test -n "@bv_barvinok_bound@"; then \
378                     ./barvinok_bound$(EXEEXT) -T < $$i || exit; \
379                     echo $$i | ./test_bound$(EXEEXT) -q || exit; \
380                 fi; \
381                 ./barvinok_summate$(EXEEXT) -T < $$i || exit; \
382             fi \
383         done
384 check-euler: barvinok_summate$(EXEEXT)
385         @for i in $(top_srcdir)/tests/euler/*; do \
386             if test -f $$i; then \
387                 echo $$i; \
388                 ./barvinok_summate$(EXEEXT) -T --summation=euler < $$i || exit; \
389             fi \
390         done
391 if HAVE_TOPCOM
392     TOPCOM_CD = '--chamber-decomposition=topcom'
393 endif
394 check-enumerate: barvinok_enumerate$(EXEEXT)
395         @for i in $(top_srcdir)/tests/ehrhart/*; do \
396             if test -f $$i; then \
397                 echo $$i; \
398                 for options in '' '--series' '--series --primal' $(TOPCOM_CD); do \
399                     for spec in 'random' 'bf' 'df'; do \
400                         opt="--specialization=$$spec $$options"; \
401                         echo "        $$opt"; \
402                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
403                     done \
404                 done; \
405                 opt="--summation=bernoulli"; \
406                 echo "        $$opt"; \
407                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
408             fi \
409         done
410 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
411         @for dir in $(BEE_TESTDIRS); do \
412             for i in $(top_srcdir)/tests/$$dir/*; do \
413                 if test -f $$i; then \
414                     for options in '' '--pip' '--pip --omega'; do \
415                         for spec in 'random' 'bf' 'df'; do \
416                             opt="--specialization=$$spec $$options"; \
417                             echo $$i $$opt; \
418                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
419                         done \
420                     done \
421                 fi \
422             done \
423         done
424         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
425             if test -f $$i; then \
426                 for spec in 'random' 'bf' 'df'; do \
427                     opt="--specialization=$$spec --scarf"; \
428                     echo $$i $$opt; \
429                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
430                 done; \
431                 echo $$i --series; \
432                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
433             fi \
434         done
435 check-test: test$(EXEEXT)
436         @for i in $(top_srcdir)/tests/*; do \
437             if test -f $$i; then \
438                 for options in '--index=10' '--primal --index=10'; do \
439                     for spec in 'random' 'bf' 'df' 'todd'; do \
440                         opt="--specialization=$$spec $$options"; \
441                         echo -n $$i $$opt; \
442                         ./test$(EXEEXT) $$opt < $$i || echo -n " NOT"; \
443                         echo " ok"; \
444                     done \
445                 done \
446             fi \
447         done
448 check-lw: test$(EXEEXT)
449         @for i in $(top_srcdir)/tests/lattice_width/*; do \
450             if test -f $$i; then \
451                 echo -n $$i; \
452                 ./test$(EXEEXT) < $$i || echo -n " NOT"; \
453                 echo " ok"; \
454             fi \
455         done
456 if HAVE_GLPK
457 check-lexmin: lexmin$(EXEEXT)
458         @for i in $(top_srcdir)/tests/lexmin/*; do \
459             if test -f $$i; then \
460                 for spec in 'random' 'bf' 'df'; do \
461                     opt="--specialization=$$spec"; \
462                     echo $$i $$opt; \
463                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
464                 done \
465             fi \
466         done
467 else
468 check-lexmin:
469 endif
471 version.h: @GIT_HEAD@
472         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@