add isl.py to distribution
[barvinok.git] / Makefile.am
blobb40dc6c67738d79febafb416912d7fcd1ff608bf
1 if BUNDLED_POLYLIB
2     MAYBE_POLYLIB = polylib
3     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
4     LOCAL_POLYLIB_LA = polylib/libpolylibgmp.la
5 endif
6 if BUNDLED_ISL
7     MAYBE_ISL = isl
8     ISL_LA = $(top_builddir)/isl/libisl.la
9     LOCAL_ISL_LA = isl/libisl.la
10 endif
11 if BUILD_ISL
12     ISL_LA = $(ISL_BUILDDIR)/libisl.la
13 endif
14 if BUNDLED_PET
15     MAYBE_PET = pet
16     PET_LA = $(top_builddir)/pet/libpet.la
17 endif
18 if BUILD_PET
19     PET_LA = $(PET_BUILDDIR)/libpet.la
20 endif
21 if BUNDLED_ISL_POLYLIB
22     MAYBE_ISL_POLYLIB = isl-polylib
23     ISL_POLYLIB_LA = $(top_builddir)/isl-polylib/libisl-polylib.la
24 endif
25 if BUNDLED_CLOOG
26     MAYBE_CLOOG = cloog
27     CLOOG_LA = $(top_builddir)/cloog/libcloog-isl.la
28 endif
29 if USE_ZSOLVE
30     MAYBE_ZSOLVE = zsolve
31 endif
32 if USE_PARKER
33     MAYBE_PARKER = parker
34 endif
35 SUBDIRS = $(MAYBE_POLYLIB) $(MAYBE_ISL) $(MAYBE_PET) $(MAYBE_ISL_POLYLIB) \
36                 $(MAYBE_CLOOG) \
37                 $(MAYBE_ZSOLVE) $(MAYBE_PARKER) . doc
38 DIST_SUBDIRS = $(MAYBE_POLYLIB) $(MAYBE_ISL) $(MAYBE_PET) \
39                 $(MAYBE_ISL_POLYLIB) $(MAYBE_CLOOG) \
40                 zsolve parker doc
42 FORCE:
43 polylib/libpolylibgmp.la: FORCE
44         cd polylib; $(MAKE) $(AM_MAKEFLAGS) libpolylibgmp.la
45 isl/libisl.la: FORCE
46         cd isl; $(MAKE) $(AM_MAKEFLAGS) libisl.la
47 pet/libpet.la: FORCE
48         cd pet; $(MAKE) $(AM_MAKEFLAGS) libpet.la
49 isl-polylib/libisl-polylib.la: $(LOCAL_ISL_LA) $(LOCAL_POLYLIB_LA) FORCE
50         cd isl-polylib; $(MAKE) $(AM_MAKEFLAGS) libisl-polylib.la
51 cloog/libcloog-isl.la: $(LOCAL_ISL_LA) FORCE
52         cd cloog; $(MAKE) $(AM_MAKEFLAGS) libcloog-isl.la
53 zsolve/libzsolve.la: FORCE
54         cd zsolve; $(MAKE) $(AM_MAKEFLAGS) libzsolve.la
55 parker/libparker.la: FORCE
56         cd parker; $(MAKE) $(AM_MAKEFLAGS) libparker.la
58 AM_CPPFLAGS = @POLYLIB_CPPFLAGS@ \
59               @ISL_CFLAGS@ @ISL_POLYLIB_CFLAGS@ @NTL_CPPFLAGS@
60 AM_LDFLAGS = @POLYLIB_LDFLAGS@ @NTL_LDFLAGS@
62 LIB_ISL = $(ISL_LA) @ISL_LIBS@
63 LIB_PET = $(PET_LA) @PET_LIBS@
64 LIB_ISL_POLYLIB = $(ISL_POLYLIB_LA) @ISL_POLYLIB_LIBS@
65 LIB_CLOOG = $(CLOOG_LA) @CLOOG_LIBS@
66 LIB_POLYLIB = $(POLYLIB_LA) @POLYLIB_LIBS@
68 lib_LTLIBRARIES = libbarvinok.la
69 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
70                   barvinok_ehrhart polytope_scan iscc
71 noinst_PROGRAMS = test testlib randomtest \
72                   remove_redundant_equalities \
73                   barvinok_union polytope_volume test_approx \
74                   barvinok_summate verify_lexsmaller \
75                   polyhedron_sample 4coins lexmin \
76                   @bv_cone_hilbert_basis@ cone_integer_hull \
77                   polytope_lattice_width \
78                   polyhedron_integer_hull vector_partition_chambers \
79                   semigroup_holes \
80                   barvinok_bound test_bound
81 EXTRA_PROGRAMS = cone_hilbert_basis
82 pkginclude_HEADERS = \
83     barvinok/NTL_QQ.h \
84     barvinok/isl.h \
85     barvinok/barvinok.h \
86     barvinok/util.h \
87     barvinok/evalue.h \
88     barvinok/genfun.h \
89     barvinok/options.h \
90     barvinok/polylib.h \
91     barvinok/sample.h \
92     barvinok/basis_reduction.h
93 nodist_pkginclude_HEADERS = \
94     barvinok/NTL.h \
95     barvinok/set.h
96 LINK = $(CXXLINK)
98 if HAVE_CDDLIB
99     BR_CDD = basis_reduction_cdd.cc initcdd.cc
100     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
101 endif
102 if HAVE_GLPK
103     BR_GLPK = basis_reduction_glpk.c
104     POLYSIGN_GLPK = polysign_glpk.c
105 endif
106 if HAVE_TOPCOM
107     TOPCOM = topcom.c topcom.h
108 endif
109 if USE_ZSOLVE
110     HILBERT_C = hilbert.c
111 endif
112 libbarvinok_la_SOURCES = \
113     barvinok/evalue.h \
114     barvinok/genfun.h \
115     barvinok/util.h \
116     barvinok/barvinok.h \
117     NTL_QQ.cc \
118     basis_reduction.c \
119     evalue.c \
120     genfun.cc \
121     util.c \
122     version.c \
123     bernoulli.c \
124     bernoulli.h \
125     bfcounter.cc \
126     bfcounter.h \
127     binomial.c \
128     binomial.h \
129     conversion.cc \
130     conversion.h \
131     counter.cc \
132     counter.h \
133     decomposer.cc \
134     decomposer.h \
135     dpoly.cc \
136     dpoly.h \
137     euler.cc \
138     euler.h \
139     evalue_isl.c \
140     genfun_constructor.cc \
141     genfun_constructor.h \
142     $(HILBERT_C) \
143     hilbert.h \
144     hull.c \
145     hull.h \
146     ilp.c \
147     ilp.h \
148     isl_param_util.c \
149     isl_param_util.h \
150     lattice_point.cc \
151     lattice_point.h \
152     lattice_width.c \
153     lattice_width.h \
154     laurent.cc \
155     laurent.h \
156     laurent_old.cc \
157     laurent_old.h \
158     normalization.c \
159     normalization.h \
160     options.c \
161     param_polynomial.cc \
162     param_polynomial.h \
163     param_util.c \
164     param_util.h \
165     $(POLYSIGN_CDD) \
166     $(POLYSIGN_GLPK) \
167     $(POLYSIGN_PIP) \
168     polysign.c \
169     polysign_isl.c \
170     polysign_polylib.c \
171     polysign.h \
172     power.h \
173     reduce_domain.c \
174     reduce_domain.h \
175     reducer.cc \
176     reducer.h \
177     remove_equalities.h \
178     remove_equalities.c \
179     sample.c \
180     scale.c \
181     scale.h \
182     scarf.cc \
183     section_array.h \
184     series.cc \
185     $(TOPCOM) \
186     summate.c \
187     summate.h \
188     vertex_cone.cc \
189     vertex_cone.h \
190     volume.c \
191     volume.h \
192     mat_util.cc \
193     mat_util.h \
194     matrix_read.cc \
195     matrix_read.h \
196     barvinok.cc \
197     barvinok_e.cc \
198     $(BR_CDD) \
199     $(BR_GLPK) \
200     $(BR_PIP)
201 EXTRA_libbarvinok_la_SOURCES = \
202     basis_reduction_cdd.cc \
203     basis_reduction_glpk.c \
204     hilbert.c \
205     polysign_cddf.cc \
206     polysign_cdd.cc \
207     polysign.c \
208     initcdd.cc \
209     initcdd.h \
210     topcom.c \
211     topcom.h
212 if USE_ZSOLVE
213     ZSOLVE_LA = zsolve/libzsolve.la
214 endif
215 libbarvinok_la_LIBADD = @LTLIBOBJS@ $(LIB_ISL_POLYLIB) $(LIB_ISL) \
216                              $(LIB_POLYLIB) $(ZSOLVE_LA)
217 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
218                                 $(AM_LDFLAGS)
219 LDADD = libbarvinok.la $(LIB_ISL_POLYLIB) $(LIB_ISL) $(LIB_POLYLIB)
221 test_SOURCES = \
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@ libbarvinok.la \
299         $(LIB_ISL_POLYLIB) $(LIB_ISL) $(LIB_POLYLIB)
300 barvinok_bound_SOURCES = \
301         bound.c \
302         verify.h \
303         verify.c
304 EXTRA_barvinok_bound_SOURCES = fdstream.cc fdstream.h
305 barvinok_summate_SOURCES = \
306         barvinok_summate.c \
307         verify.h \
308         verify.c
309 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
310 4coins_SOURCES = 4coins.cc
311 semigroup_holes_SOURCES = semigroup_holes.cc
312 lexmin_SOURCES = \
313         lexmin_options.c \
314         lexmin.h \
315         lexmin.cc \
316         edomain.cc \
317         edomain.h \
318         evalue_util.cc \
319         evalue_util.h \
320         verify.h \
321         verify.c
322 test_approx_SOURCES = \
323         test_approx.c \
324         verify.h \
325         verify.c
326 test_bound_SOURCES = \
327         test_bound.c \
328         verify.h \
329         verify.c
330 EXTRA_test_bound_SOURCES = fdstream.cc fdstream.h
331 iscc_SOURCES =  \
332         isl_obj_list.h \
333         isl_obj_list.c \
334         isl_obj_str.h \
335         isl_obj_str.c \
336         iscc.c
337 iscc_CPPFLAGS = @PET_CFLAGS@ @CLOOG_CFLAGS@ $(AM_CPPFLAGS)
338 iscc_LDADD = \
339         libbarvinok.la $(LIB_CLOOG) $(LIB_ISL_POLYLIB) $(LIB_PET) $(LIB_ISL) \
340         $(LIB_POLYLIB)
342 isl.py: interface/isl.py.top
343         (cat $(srcdir)/interface/isl.py.top; \
344                 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT) $(DEFAULT_INCLUDES) @ISL_CFLAGS@ $(srcdir)/interface/all.h) \
345                         > isl.py
347 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
349 EXTRA_DIST = \
350     ChangeLog \
351     $(TESTFILES) \
352     latte2polylib.pl \
353     NTL_5_3_2.patch \
354     basis_reduction_templ.c \
355     cdd94e-test \
356     polysign_cdd_template.cc \
357     barvinok/NTL.h.broken \
358     barvinok/NTL.h.normal \
359     barvinok/set.h.broken \
360     barvinok/set.h.normal \
361     doc/isl.tex \
362     doc/Internal.tex \
363     doc/applications.tex \
364     doc/barvinok.tex \
365     doc/polymake.tex \
366     doc/reports.tex \
367     doc/barvinok.bib \
368     doc/barvinok.gdf \
369     doc/chicago.bst \
370     doc/chicago.sty \
371     doc/mydefs.sty \
372     interface/all.h \
373     interface/isl.py.top \
374     polymake/Makefile.in \
375     polymake/README \
376     polymake/autogen.sh \
377     polymake/configure.in \
378     polymake/convert.cc \
379     polymake/convert.h \
380     polymake/h_star_vector.cc \
381     polymake/lattice_points.cc
383 ACLOCAL_AMFLAGS = -I m4
385 install-data-local:
386         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
387         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
389 uninstall-local:
390         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
392 dist-hook: isl.py
393         cp isl.py $(distdir)/
394         (cd $(distdir)/polymake; \
395             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
396         (cd doc; make barvinok.pdf)
397         cp doc/barvinok.pdf $(distdir)/doc/
398         if test -f $(top_srcdir)/.git/HEAD; then \
399             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
400         else \
401             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
402         fi
404 dist-git: dist
405         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
407 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
409 check: check-testlib check-enumerate check-enumerate_e check-test \
410         check-lexmin check-approx check-pwqp check-euler check-lw check-iscc
411 check-testlib: testlib$(EXEEXT)
412         ./testlib$(EXEEXT)
413 check-approx: test_approx$(EXEEXT)
414         @for i in $(top_srcdir)/tests/ehrhart/*; do \
415             if test -f $$i; then \
416                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
417             fi \
418         done
419 check-pwqp: barvinok_bound$(EXEEXT) test_bound$(EXEEXT) barvinok_summate$(EXEEXT)
420         @for i in $(top_srcdir)/tests/pwqp/*; do \
421             if test -f $$i; then \
422                 echo $$i; \
423                 ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
424                 echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
425                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
426             fi \
427         done
428 check-euler: barvinok_summate$(EXEEXT)
429         @for i in $(top_srcdir)/tests/euler/*; do \
430             if test -f $$i; then \
431                 for method in 'euler' 'laurent_old' 'laurent'; do \
432                     opt="--summation=$$method"; \
433                     echo $$i $$opt; \
434                     ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
435                 done \
436             fi \
437         done
438 if HAVE_TOPCOM
439     TOPCOM_CD = '--chamber-decomposition=topcom'
440 endif
441 ISL_CD = '--chamber-decomposition=isl'
442 check-enumerate: barvinok_enumerate$(EXEEXT)
443         @for i in $(top_srcdir)/tests/ehrhart/*; do \
444             if test -f $$i; then \
445                 echo $$i; \
446                 for options in '' '--series' '--series --primal' $(TOPCOM_CD) $(ISL_CD); do \
447                     for spec in 'random' 'bf' 'df'; do \
448                         opt="--specialization=$$spec $$options"; \
449                         echo "        $$opt"; \
450                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
451                     done \
452                 done; \
453                 opt="--summation=bernoulli"; \
454                 echo "        $$opt"; \
455                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
456             fi \
457         done
458 if HAVE_OMEGA
459     SPEC_OMEGA = '--isl --omega'
460 endif
461 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
462         @for dir in $(BEE_TESTDIRS); do \
463             for i in $(top_srcdir)/tests/$$dir/*; do \
464                 if test -f $$i; then \
465                     for options in '' $(SPEC_OMEGA) '--isl'; do \
466                         for spec in 'random' 'bf' 'df'; do \
467                             opt="--specialization=$$spec $$options"; \
468                             echo $$i $$opt; \
469                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
470                         done \
471                     done \
472                 fi \
473             done \
474         done
475         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
476             if test -f $$i; then \
477                 for spec in 'random' 'bf' 'df'; do \
478                     opt="--specialization=$$spec --scarf"; \
479                     echo $$i $$opt; \
480                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
481                 done; \
482                 echo $$i --series; \
483                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
484             fi \
485         done
486 check-test: test$(EXEEXT)
487         @failed=0; \
488         for i in $(top_srcdir)/tests/*; do \
489             if test -f $$i; then \
490                 for options in '--index=10' '--primal --index=10'; do \
491                     for spec in 'random' 'bf' 'df' 'todd'; do \
492                         opt="--specialization=$$spec $$options"; \
493                         echo -n $$i $$opt; \
494                         ./test$(EXEEXT) $$opt < $$i; \
495                         if test "$$?" -ne "0"; then \
496                             failed=`expr $$failed + 1`; \
497                             echo " NOT ok"; \
498                         else \
499                             echo " ok"; \
500                         fi; \
501                     done \
502                 done \
503             fi \
504         done; \
505         for i in $(top_srcdir)/tests/sample/*; do \
506             echo -n $$i; \
507             ./test$(EXEEXT) < $$i; \
508             if test "$$?" -ne "0"; then \
509                 failed=`expr $$failed + 1`; \
510                 echo " NOT ok"; \
511             else \
512                 echo " ok"; \
513             fi; \
514         done; \
515         if test $$failed != 0; then \
516                 echo "$$failed tests failed"; \
517                 exit -1; \
518         fi
519 check-lw: test$(EXEEXT)
520         @failed=0; \
521         for i in $(top_srcdir)/tests/lattice_width/*; do \
522             if test -f $$i; then \
523                 echo -n $$i; \
524                 ./test$(EXEEXT) < $$i; \
525                 if test "$$?" -ne "0"; then \
526                     failed=`expr $$failed + 1`; \
527                     echo " NOT ok"; \
528                 else \
529                     echo " ok"; \
530                 fi; \
531             fi \
532         done; \
533         if test $$failed != 0; then \
534                 echo "$$failed tests failed"; \
535                 exit -1; \
536         fi
537 check-lexmin: lexmin$(EXEEXT)
538         @for i in $(top_srcdir)/tests/lexmin/*; do \
539             if test -f $$i; then \
540                 for spec in 'random' 'bf' 'df'; do \
541                     opt="--specialization=$$spec"; \
542                     echo $$i $$opt; \
543                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
544                 done \
545             fi \
546         done
547 check-iscc: iscc$(EXEEXT)
548         @for i in $(top_srcdir)/tests/iscc/*; do \
549                 if test -f $$i; then \
550                         echo $$i; \
551                         ./iscc$(EXEEXT) < $$i || exit; \
552                 fi \
553         done
555 version.h: @GIT_HEAD@
556         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@