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