allow building without piplib
[barvinok.git] / Makefile.am
blob0ba09a87ecdeac94662018b133395d8061ee5271
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 if HAVE_PIPLIB
102     BR_PIP = basis_reduction_pip.c basis_reduction_pip_dual.c
103     POLYSIGN_PIP = polysign_pip.c
104 endif
105 libbarvinok_la_SOURCES = \
106     barvinok/evalue.h \
107     barvinok/genfun.h \
108     barvinok/util.h \
109     barvinok/barvinok.h \
110     NTL_QQ.cc \
111     basis_reduction.c \
112     evalue.c \
113     genfun.cc \
114     util.c \
115     version.c \
116     bernoulli.c \
117     bernoulli.h \
118     bfcounter.cc \
119     bfcounter.h \
120     binomial.c \
121     binomial.h \
122     conversion.cc \
123     conversion.h \
124     counter.cc \
125     counter.h \
126     decomposer.cc \
127     decomposer.h \
128     dpoly.cc \
129     dpoly.h \
130     euler.cc \
131     euler.h \
132     evalue_isl.c \
133     genfun_constructor.cc \
134     genfun_constructor.h \
135     $(HILBERT_C) \
136     hilbert.h \
137     hull.c \
138     hull.h \
139     ilp.c \
140     ilp.h \
141     isl_param_util.c \
142     isl_param_util.h \
143     lattice_point.cc \
144     lattice_point.h \
145     lattice_width.c \
146     lattice_width.h \
147     laurent.cc \
148     laurent.h \
149     laurent_old.cc \
150     laurent_old.h \
151     normalization.c \
152     normalization.h \
153     options.c \
154     param_polynomial.cc \
155     param_polynomial.h \
156     param_util.c \
157     param_util.h \
158     $(POLYSIGN_CDD) \
159     $(POLYSIGN_GLPK) \
160     $(POLYSIGN_PIP) \
161     polysign.c \
162     polysign_polylib.c \
163     polysign.h \
164     power.h \
165     reduce_domain.c \
166     reduce_domain.h \
167     reducer.cc \
168     reducer.h \
169     remove_equalities.h \
170     remove_equalities.c \
171     sample.c \
172     scale.c \
173     scale.h \
174     scarf.cc \
175     section_array.h \
176     series.cc \
177     $(TOPCOM) \
178     summate.c \
179     summate.h \
180     vertex_cone.cc \
181     vertex_cone.h \
182     volume.c \
183     volume.h \
184     mat_util.cc \
185     mat_util.h \
186     matrix_read.cc \
187     matrix_read.h \
188     barvinok.cc \
189     barvinok_e.cc \
190     $(BR_CDD) \
191     $(BR_GLPK) \
192     $(BR_PIP)
193 EXTRA_libbarvinok_la_SOURCES = \
194     basis_reduction_cdd.cc \
195     basis_reduction_glpk.c \
196     hilbert.c \
197     polysign_cddf.cc \
198     polysign_cdd.cc \
199     polysign.c \
200     initcdd.cc \
201     initcdd.h \
202     topcom.c \
203     topcom.h
204 if BUNDLED_POLYLIB
205     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
206 endif
207 if BUNDLED_PIPLIB
208     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
209 endif
210 if USE_ZSOLVE
211     ZSOLVE_LA = zsolve/libzsolve.la
212 endif
213 libbarvinok_la_LIBADD = @LTLIBOBJS@ $(LIB_ISL_POLYLIB) $(LIB_ISL) \
214                              $(POLYLIB_LA) @POLYLIB_LIBS@ \
215                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
216                              $(ZSOLVE_LA)
217 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
218                                 $(AM_LDFLAGS)
219 LDADD = libbarvinok.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
220         @POLYLIB_LIBS@ @PIPLIB_LIBS@
222 test_SOURCES = \
223         evalue_read.c \
224         evalue_read.h \
225         test.c
226 testlib_SOURCES = \
227         evalue_read.c \
228         evalue_read.h \
229         testlib.cc
230 barvinok_count_SOURCES = barvinok_count.c
231 barvinok_ehrhart_SOURCES = \
232         barvinok_ehrhart_options.c \
233         barvinok_ehrhart_options.h \
234         barvinok_ehrhart.cc \
235         evalue_convert_options.c \
236         evalue_convert.cc \
237         evalue_convert.h \
238         $(FDSTREAM)
239 barvinok_union_SOURCES = \
240         barvinok_union_options.c \
241         barvinok_union_options.h \
242         barvinok_union.cc
243 if HAVE_OMEGA
244 BEEO_SOURCES = \
245         omega_interface/Exit.cc \
246         omega_interface/convert.h \
247         omega_interface/convert.cc \
248         omega_interface/count.h \
249         omega_interface/count.cc
250 else
251 BEEO_SOURCES = 
252 endif
253 if USE_FDSTREAM
254 FDSTREAM = fdstream.cc fdstream.h
255 endif
256 barvinok_enumerate_SOURCES = \
257         barvinok_enumerate_options.c \
258         barvinok_enumerate_options.h \
259         barvinok_enumerate.cc \
260         evalue_convert_options.c \
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 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
273 barvinok_enumerate_e_SOURCES = \
274         barvinok_enumerate_e_options.c \
275         barvinok_enumerate_e_options.h \
276         barvinok_enumerate_e.cc \
277         evalue_convert_options.c \
278         evalue_convert.cc \
279         evalue_convert.h \
280         $(FDSTREAM) \
281         skewed_genfun.cc \
282         skewed_genfun.h \
283         verify.h \
284         verify.c \
285         verif_ehrhart.h \
286         verif_ehrhart.c \
287         verify_series.h \
288         verify_series.cc \
289         $(BEEO_SOURCES)
290 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
291 if USE_PARKER
292     MONA_LIBS = -ldfa -lbdd -lmem
293     PARKER_LA = parker/libparker.la
294     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
295     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
296 endif
297 barvinok_enumerate_e_CPPFLAGS = \
298         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
299 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
300 barvinok_enumerate_e_LDADD = \
301         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ $(OMEGA_LA) libbarvinok.la \
302         @ISL_POLYLIB_LIBS@ @ISL_LIBS@ @POLYLIB_LIBS@ @PIPLIB_LIBS@
303 barvinok_bound_SOURCES = \
304         evalue_convert_options.c \
305         evalue_convert.cc \
306         evalue_convert.h \
307         evalue_read.c \
308         evalue_read.h \
309         $(FDSTREAM) \
310         bound_options.h \
311         bound_options.c \
312         bound.cc \
313         verify.h \
314         verify.c
315 EXTRA_barvinok_bound_SOURCES = fdstream.cc fdstream.h
316 barvinok_bound_LDADD = \
317         libbarvinok.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
318         @POLYLIB_LIBS@ @PIPLIB_LIBS@
319 barvinok_summate_SOURCES = \
320         barvinok_summate_options.c \
321         barvinok_summate_options.h \
322         barvinok_summate.cc \
323         evalue_convert_options.c \
324         evalue_convert.cc \
325         evalue_convert.h \
326         evalue_read.c \
327         evalue_read.h \
328         $(FDSTREAM) \
329         verify.h \
330         verify.c
331 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
332 4coins_SOURCES = 4coins.cc
333 semigroup_holes_SOURCES = semigroup_holes.cc
334 lexmin_SOURCES = \
335         lexmin_options.c \
336         lexmin.h \
337         lexmin.cc \
338         combine.c \
339         combine.h \
340         edomain.cc \
341         edomain.h \
342         evalue_util.cc \
343         evalue_util.h \
344         verify.h \
345         verify.c
346 test_approx_SOURCES = \
347         test_approx.c \
348         verify.h \
349         verify.c
350 test_bound_SOURCES = \
351         test_bound.c \
352         evalue_convert_options.c \
353         evalue_convert.cc \
354         evalue_convert.h \
355         evalue_read.c \
356         evalue_read.h \
357         $(FDSTREAM) \
358         verify.h \
359         verify.c
360 EXTRA_test_bound_SOURCES = fdstream.cc fdstream.h
361 test_bound_LDADD = \
362         libbarvinok.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
363         @POLYLIB_LIBS@ @PIPLIB_LIBS@
364 evalue_convert_SOURCES = \
365         evalue_convert_main.c \
366         evalue_convert_options.c \
367         evalue_convert.cc \
368         evalue_convert.h \
369         evalue_read.c \
370         evalue_read.h \
371         $(FDSTREAM)
372 iscc_SOURCES =  \
373         isl_obj_list.h \
374         isl_obj_list.c \
375         isl_obj_str.h \
376         isl_obj_str.c \
377         iscc.c
378 iscc_CPPFLAGS = @CLOOG_CFLAGS@ $(AM_CPPFLAGS)
379 iscc_LDADD = \
380         libbarvinok.la @CLOOG_LIBS@ @CLOOG_LIBS@ @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \
381         @POLYLIB_LIBS@ @PIPLIB_LIBS@
383 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
385 EXTRA_DIST = \
386     ChangeLog \
387     $(TESTFILES) \
388     latte2polylib.pl \
389     NTL_5_3_2.patch \
390     basis_reduction_templ.c \
391     cdd94e-test \
392     polysign_cdd_template.cc \
393     barvinok/NTL.h.broken \
394     barvinok/NTL.h.normal \
395     barvinok/set.h.broken \
396     barvinok/set.h.normal \
397     doc/isl.tex \
398     doc/Internal.tex \
399     doc/applications.tex \
400     doc/barvinok.tex \
401     doc/polymake.tex \
402     doc/reports.tex \
403     doc/barvinok.bib \
404     doc/barvinok.gdf \
405     doc/chicago.bst \
406     doc/chicago.sty \
407     doc/mydefs.sty \
408     polymake/Makefile.in \
409     polymake/README \
410     polymake/autogen.sh \
411     polymake/configure.in \
412     polymake/convert.cc \
413     polymake/convert.h \
414     polymake/h_star_vector.cc \
415     polymake/lattice_points.cc
417 ACLOCAL_AMFLAGS = -I m4
419 install-data-local:
420         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
421         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
423 uninstall-local:
424         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
426 dist-hook:
427         (cd $(distdir)/polymake; \
428             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
429         (cd doc; make barvinok.pdf)
430         cp doc/barvinok.pdf $(distdir)/doc/
431         if test -f $(top_srcdir)/.git/HEAD; then \
432             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
433         else \
434             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
435         fi
437 dist-git: dist
438         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
440 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
442 check: check-testlib check-enumerate check-enumerate_e check-test \
443         check-lexmin check-approx check-evalue check-euler check-lw
444 check-testlib: testlib$(EXEEXT)
445         ./testlib$(EXEEXT)
446 check-approx: test_approx$(EXEEXT)
447         @for i in $(top_srcdir)/tests/ehrhart/*; do \
448             if test -f $$i; then \
449                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
450             fi \
451         done
452 check-evalue: barvinok_bound$(EXEEXT) test_bound$(EXEEXT) barvinok_summate$(EXEEXT)
453         @for i in $(top_srcdir)/tests/evalue/*; do \
454             if test -f $$i; then \
455                 echo $$i; \
456                 ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
457                 echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
458                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
459             fi \
460         done
461 check-euler: barvinok_summate$(EXEEXT)
462         @for i in $(top_srcdir)/tests/euler/*; do \
463             if test -f $$i; then \
464                 for method in 'euler' 'laurent_old' 'laurent'; do \
465                     opt="--summation=$$method"; \
466                     echo $$i $$opt; \
467                     ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
468                 done \
469             fi \
470         done
471 if HAVE_TOPCOM
472     TOPCOM_CD = '--chamber-decomposition=topcom'
473 endif
474 ISL_CD = '--chamber-decomposition=isl'
475 check-enumerate: barvinok_enumerate$(EXEEXT)
476         @for i in $(top_srcdir)/tests/ehrhart/*; do \
477             if test -f $$i; then \
478                 echo $$i; \
479                 for options in '' '--series' '--series --primal' $(TOPCOM_CD) $(ISL_CD); do \
480                     for spec in 'random' 'bf' 'df'; do \
481                         opt="--specialization=$$spec $$options"; \
482                         echo "        $$opt"; \
483                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
484                     done \
485                 done; \
486                 opt="--summation=bernoulli"; \
487                 echo "        $$opt"; \
488                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
489             fi \
490         done
491 if HAVE_OMEGA
492     SPEC_OMEGA = '--isl --omega'
493 endif
494 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
495         @for dir in $(BEE_TESTDIRS); do \
496             for i in $(top_srcdir)/tests/$$dir/*; do \
497                 if test -f $$i; then \
498                     for options in '' $(SPEC_OMEGA) '--isl'; do \
499                         for spec in 'random' 'bf' 'df'; do \
500                             opt="--specialization=$$spec $$options"; \
501                             echo $$i $$opt; \
502                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
503                         done \
504                     done \
505                 fi \
506             done \
507         done
508         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
509             if test -f $$i; then \
510                 for spec in 'random' 'bf' 'df'; do \
511                     opt="--specialization=$$spec --scarf"; \
512                     echo $$i $$opt; \
513                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
514                 done; \
515                 echo $$i --series; \
516                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
517             fi \
518         done
519 check-test: test$(EXEEXT)
520         @failed=0; \
521         for i in $(top_srcdir)/tests/*; do \
522             if test -f $$i; then \
523                 for options in '--index=10' '--primal --index=10'; do \
524                     for spec in 'random' 'bf' 'df' 'todd'; do \
525                         opt="--specialization=$$spec $$options"; \
526                         echo -n $$i $$opt; \
527                         ./test$(EXEEXT) $$opt < $$i; \
528                         if test "$$?" -ne "0"; then \
529                             failed=`expr $$failed + 1`; \
530                             echo " NOT ok"; \
531                         else \
532                             echo " ok"; \
533                         fi; \
534                     done \
535                 done \
536             fi \
537         done; \
538         for i in $(top_srcdir)/tests/sample/*; do \
539             echo -n $$i; \
540             ./test$(EXEEXT) < $$i; \
541             if test "$$?" -ne "0"; then \
542                 failed=`expr $$failed + 1`; \
543                 echo " NOT ok"; \
544             else \
545                 echo " ok"; \
546             fi; \
547         done; \
548         if test $$failed != 0; then \
549                 echo "$$failed tests failed"; \
550                 exit -1; \
551         fi
552 check-lw: test$(EXEEXT)
553         @failed=0; \
554         for i in $(top_srcdir)/tests/lattice_width/*; do \
555             if test -f $$i; then \
556                 echo -n $$i; \
557                 ./test$(EXEEXT) < $$i; \
558                 if test "$$?" -ne "0"; then \
559                     failed=`expr $$failed + 1`; \
560                     echo " NOT ok"; \
561                 else \
562                     echo " ok"; \
563                 fi; \
564             fi \
565         done; \
566         if test $$failed != 0; then \
567                 echo "$$failed tests failed"; \
568                 exit -1; \
569         fi
570 if HAVE_GLPK
571 check-lexmin: lexmin$(EXEEXT)
572         @for i in $(top_srcdir)/tests/lexmin/*; do \
573             if test -f $$i; then \
574                 for spec in 'random' 'bf' 'df'; do \
575                     opt="--specialization=$$spec"; \
576                     echo $$i $$opt; \
577                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
578                 done \
579             fi \
580         done
581 else
582 check-lexmin:
583 endif
585 version.h: @GIT_HEAD@
586         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@