update isl to version 0.23
[barvinok.git] / Makefile.am
blob8a9027117ac557a2ec8f2cad59ac86f5f08703c8
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 USE_ZSOLVE
22     MAYBE_ZSOLVE = zsolve
23 endif
24 if USE_PARKER
25     MAYBE_PARKER = parker
26 endif
27 SUBDIRS = $(MAYBE_POLYLIB) $(MAYBE_ISL) $(MAYBE_PET) \
28                 $(MAYBE_ZSOLVE) $(MAYBE_PARKER) . doc
29 DIST_SUBDIRS = $(MAYBE_POLYLIB) $(MAYBE_ISL) $(MAYBE_PET) \
30                 zsolve parker doc
32 FORCE:
33 polylib/libpolylibgmp.la: FORCE
34         cd polylib; $(MAKE) $(AM_MAKEFLAGS) libpolylibgmp.la
35 isl/libisl.la: FORCE
36         cd isl; $(MAKE) $(AM_MAKEFLAGS) libisl.la
37 pet/libpet.la: FORCE
38         cd pet; $(MAKE) $(AM_MAKEFLAGS) libpet.la
39 zsolve/libzsolve.la: FORCE
40         cd zsolve; $(MAKE) $(AM_MAKEFLAGS) libzsolve.la
41 parker/libparker.la: FORCE
42         cd parker; $(MAKE) $(AM_MAKEFLAGS) libparker.la
44 AM_CPPFLAGS = @POLYLIB_CPPFLAGS@ \
45               @ISL_CFLAGS@ @NTL_CPPFLAGS@
46 AM_LDFLAGS = @POLYLIB_LDFLAGS@ @NTL_LDFLAGS@
48 LIB_ISL = $(ISL_LA) @ISL_LIBS@
49 LIB_PET = $(PET_LA) @PET_LIBS@
50 LIB_POLYLIB = $(POLYLIB_LA) @POLYLIB_LIBS@
52 lib_LTLIBRARIES = libbarvinok.la
53 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
54                   barvinok_ehrhart polytope_scan iscc
55 noinst_PROGRAMS = test testlib randomtest \
56                   remove_redundant_equalities \
57                   barvinok_union polytope_volume test_approx \
58                   barvinok_summate verify_lexsmaller \
59                   polyhedron_sample 4coins lexmin \
60                   @bv_cone_hilbert_basis@ cone_integer_hull \
61                   polytope_lattice_width \
62                   polyhedron_integer_hull vector_partition_chambers \
63                   semigroup_holes \
64                   barvinok_bound test_bound
65 EXTRA_PROGRAMS = cone_hilbert_basis
66 pkginclude_HEADERS = \
67     barvinok/NTL_QQ.h \
68     barvinok/isl.h \
69     barvinok/barvinok.h \
70     barvinok/util.h \
71     barvinok/evalue.h \
72     barvinok/genfun.h \
73     barvinok/options.h \
74     barvinok/polylib.h \
75     barvinok/sample.h \
76     barvinok/basis_reduction.h
77 nodist_pkginclude_HEADERS = \
78     barvinok/NTL.h \
79     barvinok/set.h
80 LINK = $(CXXLINK)
82 if HAVE_CDDLIB
83     BR_CDD = basis_reduction_cdd.cc initcdd.cc
84     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
85 endif
86 if HAVE_GLPK
87     BR_GLPK = basis_reduction_glpk.c
88     POLYSIGN_GLPK = polysign_glpk.c
89 endif
90 if HAVE_TOPCOM
91     TOPCOM = topcom.c topcom.h
92 endif
93 if USE_ZSOLVE
94     HILBERT_C = hilbert.c
95 endif
96 libbarvinok_la_SOURCES = \
97     barvinok/evalue.h \
98     barvinok/genfun.h \
99     barvinok/util.h \
100     barvinok/barvinok.h \
101     NTL_QQ.cc \
102     basis_reduction.c \
103     evalue.c \
104     genfun.cc \
105     util.c \
106     version.c \
107     bernoulli.c \
108     bernoulli.h \
109     bfcounter.cc \
110     bfcounter.h \
111     binomial.c \
112     binomial.h \
113     conversion.cc \
114     conversion.h \
115     counter.cc \
116     counter.h \
117     decomposer.cc \
118     decomposer.h \
119     dpoly.cc \
120     dpoly.h \
121     euler.cc \
122     euler.h \
123     evalue_isl.c \
124     genfun_constructor.cc \
125     genfun_constructor.h \
126     $(HILBERT_C) \
127     hilbert.h \
128     hull.c \
129     hull.h \
130     ilp.c \
131     ilp.h \
132     isl_aff_polylib.c \
133     isl_aff_polylib.h \
134     isl_map_polylib.c \
135     isl_map_polylib.h \
136     isl_set_polylib.h \
137     isl_param_util.c \
138     isl_param_util.h \
139     lattice_point.cc \
140     lattice_point.h \
141     lattice_width.c \
142     lattice_width.h \
143     laurent.cc \
144     laurent.h \
145     laurent_old.cc \
146     laurent_old.h \
147     normalization.c \
148     normalization.h \
149     options.c \
150     param_polynomial.cc \
151     param_polynomial.h \
152     param_util.c \
153     param_util.h \
154     $(POLYSIGN_CDD) \
155     $(POLYSIGN_GLPK) \
156     polysign.c \
157     polysign_isl.c \
158     polysign_polylib.c \
159     polysign.h \
160     power.h \
161     reduce_domain.c \
162     reduce_domain.h \
163     reducer.cc \
164     reducer.h \
165     remove_equalities.h \
166     remove_equalities.c \
167     sample.c \
168     scale.c \
169     scale.h \
170     scarf.cc \
171     section_array.h \
172     series.cc \
173     $(TOPCOM) \
174     summate.c \
175     summate.h \
176     vertex_cone.cc \
177     vertex_cone.h \
178     volume.c \
179     volume.h \
180     mat_util.cc \
181     mat_util.h \
182     matrix_read.cc \
183     matrix_read.h \
184     barvinok.cc \
185     barvinok_e.cc \
186     $(BR_CDD) \
187     $(BR_GLPK)
188 EXTRA_libbarvinok_la_SOURCES = \
189     basis_reduction_cdd.cc \
190     basis_reduction_glpk.c \
191     hilbert.c \
192     polysign_cddf.cc \
193     polysign_cdd.cc \
194     polysign.c \
195     initcdd.cc \
196     initcdd.h \
197     topcom.c \
198     topcom.h
199 if USE_ZSOLVE
200     ZSOLVE_LA = zsolve/libzsolve.la
201 endif
202 libbarvinok_la_LIBADD = @LTLIBOBJS@ $(LIB_ISL) \
203                              $(LIB_POLYLIB) $(ZSOLVE_LA)
204 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
205                                 $(AM_LDFLAGS)
206 LDADD = libbarvinok.la $(LIB_ISL) $(LIB_POLYLIB)
208 test_SOURCES = \
209         test.c
210 testlib_SOURCES = \
211         evalue_read.c \
212         evalue_read.h \
213         testlib.cc
214 barvinok_count_SOURCES = barvinok_count.c
215 barvinok_ehrhart_SOURCES = \
216         barvinok_ehrhart_options.c \
217         barvinok_ehrhart_options.h \
218         barvinok_ehrhart.cc \
219         evalue_convert_options.c \
220         evalue_convert.cc \
221         evalue_convert.h \
222         $(FDSTREAM)
223 barvinok_union_SOURCES = \
224         barvinok_union_options.c \
225         barvinok_union_options.h \
226         barvinok_union.cc
227 if HAVE_OMEGA
228 BEEO_SOURCES = \
229         omega_interface/Exit.cc \
230         omega_interface/convert.h \
231         omega_interface/convert.cc \
232         omega_interface/count.h \
233         omega_interface/count.cc
234 else
235 BEEO_SOURCES = 
236 endif
237 if USE_FDSTREAM
238 FDSTREAM = fdstream.cc fdstream.h
239 endif
240 barvinok_enumerate_SOURCES = \
241         barvinok_enumerate_options.c \
242         barvinok_enumerate_options.h \
243         barvinok_enumerate.cc \
244         evalue_convert_options.c \
245         evalue_convert.cc \
246         evalue_convert.h \
247         $(FDSTREAM) \
248         skewed_genfun.cc \
249         skewed_genfun.h \
250         verify.h \
251         verify.c \
252         verify_series.h \
253         verify_series.cc
254 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
255 barvinok_enumerate_e_SOURCES = \
256         barvinok_enumerate_e_options.c \
257         barvinok_enumerate_e_options.h \
258         barvinok_enumerate_e.cc \
259         evalue_convert_options.c \
260         evalue_convert.cc \
261         evalue_convert.h \
262         $(FDSTREAM) \
263         skewed_genfun.cc \
264         skewed_genfun.h \
265         verify.h \
266         verify.c \
267         verif_ehrhart.h \
268         verif_ehrhart.c \
269         verify_series.h \
270         verify_series.cc \
271         $(BEEO_SOURCES)
272 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
273 if USE_PARKER
274     MONA_LIBS = -ldfa -lbdd -lmem
275     PARKER_LA = parker/libparker.la
276     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
277     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
278 endif
279 barvinok_enumerate_e_CPPFLAGS = \
280         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
281 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
282 barvinok_enumerate_e_LDADD = \
283         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ libbarvinok.la \
284         $(LIB_ISL) $(LIB_POLYLIB)
285 barvinok_bound_SOURCES = \
286         bound.c \
287         verify.h \
288         verify.c
289 barvinok_summate_SOURCES = \
290         barvinok_summate.c \
291         verify.h \
292         verify.c
293 4coins_SOURCES = 4coins.cc
294 semigroup_holes_SOURCES = semigroup_holes.cc
295 lexmin_SOURCES = \
296         lexmin_options.c \
297         lexmin.h \
298         lexmin.cc \
299         edomain.cc \
300         edomain.h \
301         evalue_util.cc \
302         evalue_util.h \
303         verify.h \
304         verify.c
305 test_approx_SOURCES = \
306         test_approx.c \
307         verify.h \
308         verify.c
309 test_bound_SOURCES = \
310         test_bound.c \
311         verify.h \
312         verify.c
313 iscc_SOURCES =  \
314         isl_obj_list.h \
315         isl_obj_list.c \
316         isl_obj_str.h \
317         isl_obj_str.c \
318         iscc.c
319 iscc_CPPFLAGS = @PET_CFLAGS@ $(AM_CPPFLAGS)
320 iscc_LDADD = \
321         libbarvinok.la $(LIB_PET) $(LIB_ISL) \
322         $(LIB_POLYLIB)
324 if HAVE_ISL_BUILDDIR
325 # dummy library that captures the dependencies on all headers
326 # that are relevant for the bindings
327 noinst_LIBRARIES = libdep.a
328 libdep_a_CPPFLAGS = $(DEFAULT_INCLUDES) @ISL_CFLAGS@ -I"@ISL_SRCDIR@"
329 libdep_a_SOURCES = interface/all_barvinok.c
331 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT):
332         $(MAKE) -C @ISL_BUILDDIR@ interface/extract_interface$(EXEEXT)
334 isl.py: libdep.a interface/isl.py.top \
335                 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT)
336         (cat interface/isl.py.top && \
337                 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT) \
338                         --language=python \
339                         $(DEFAULT_INCLUDES) @ISL_CFLAGS@ -I"@ISL_SRCDIR@" \
340                         $(srcdir)/interface/all_barvinok.h) \
341                         > $@ || (rm $@ && false)
342 endif
344 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
346 CLEANFILES = \
347         zsolve/graver \
348         zsolve/hilbert \
349         isl.py \
350         version.h
351 DISTCLEANFILES = \
352         barvinok-uninstalled.sh \
353         barvinok-uninstalled.pc \
354         barvinok.pc \
355         barvinok.pc.in \
356         barvinok/set.h \
357         barvinok/NTL.h \
358         interface/isl.py.top
360 EXTRA_DIST = \
361     LICENSE \
362     ChangeLog \
363     $(TESTFILES) \
364     latte2polylib.pl \
365     NTL_5_3_2.patch \
366     basis_reduction_templ.c \
367     cdd94e-test \
368     polysign_cdd_template.cc \
369     barvinok/NTL.h.broken \
370     barvinok/NTL.h.normal \
371     barvinok/set.h.broken \
372     barvinok/set.h.normal \
373     config_post.h \
374     doc/isl.tex \
375     doc/Internal.tex \
376     doc/applications.tex \
377     doc/barvinok.tex \
378     doc/polymake.tex \
379     doc/reports.tex \
380     doc/barvinok.bib \
381     doc/barvinok.gdf \
382     doc/chicago.bst \
383     doc/chicago.sty \
384     doc/glosstex.ist \
385     doc/mydefs.sty \
386     interface/all_barvinok.h \
387     interface/isl.py.top.no_pet \
388     interface/isl.py.top.pet \
389     polymake/Makefile.in \
390     polymake/README \
391     polymake/autogen.sh \
392     polymake/configure.in \
393     polymake/convert.cc \
394     polymake/convert.h \
395     polymake/h_star_vector.cc \
396     polymake/lattice_points.cc
398 ACLOCAL_AMFLAGS = -I m4
400 install-data-local:
401         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
402         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
404 uninstall-local:
405         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
407 dist-hook: isl.py
408         cp isl.py $(distdir)/
409         (cd $(distdir)/polymake; \
410             ./autogen.sh; rm -rf autom4te.cache)
411         (cd doc; make barvinok.pdf)
412         cp doc/barvinok.pdf $(distdir)/doc/
413         if test -f $(top_srcdir)/.git/HEAD; then \
414             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
415         else \
416             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
417         fi
419 dist-git: dist
420         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
422 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
424 check: check-testlib check-enumerate check-enumerate_e check-test \
425         check-lexmin check-approx check-pwqp check-euler check-iscc \
426         check-union
427 check-testlib: testlib$(EXEEXT)
428         ./testlib$(EXEEXT)
429 check-approx: test_approx$(EXEEXT)
430         @for i in $(top_srcdir)/tests/ehrhart/*; do \
431             if test -f $$i; then \
432                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
433             fi \
434         done
435 check-pwqp: barvinok_bound$(EXEEXT) test_bound$(EXEEXT) barvinok_summate$(EXEEXT)
436         @for i in $(top_srcdir)/tests/pwqp/*; do \
437             if test -f $$i; then \
438                 echo $$i; \
439                 ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
440                 echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
441                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
442             fi \
443         done
444 check-euler: barvinok_summate$(EXEEXT)
445         @for i in $(top_srcdir)/tests/euler/*; do \
446             if test -f $$i; then \
447                 for method in 'euler' 'laurent_old' 'laurent'; do \
448                     opt="--summation=$$method"; \
449                     echo $$i $$opt; \
450                     ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
451                 done \
452             fi \
453         done
454         @for t in dull EML_p EML-product EML line square square_p square \
455                 square_p3 triangle triangle2 triangle_p quasi; do \
456             i=$(top_srcdir)/tests/euler/$$t.pwqp; \
457             if test -f $$i; then \
458                 opt="--summation=box"; \
459                 echo $$i $$opt; \
460                 ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
461             fi \
462         done
463         @for t in dull dull_p EML line square square_p square \
464                 square_p3 triangle triangle2 triangle_p; do \
465             i=$(top_srcdir)/tests/euler/$$t.pwqp; \
466             if test -f $$i; then \
467                 opt="--summation=bernoulli"; \
468                 echo $$i $$opt; \
469                 ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
470             fi \
471         done
472 if HAVE_TOPCOM
473     TOPCOM_CD = '--chamber-decomposition=topcom'
474 endif
475 ISL_CD = '--chamber-decomposition=isl'
476 check-enumerate: barvinok_enumerate$(EXEEXT)
477         @for i in $(top_srcdir)/tests/ehrhart/*; do \
478             if test -f $$i; then \
479                 echo $$i; \
480                 for options in '' '--series' '--series --primal' $(TOPCOM_CD) $(ISL_CD); do \
481                     for spec in 'random' 'bf' 'df'; do \
482                         opt="--specialization=$$spec $$options"; \
483                         echo "        $$opt"; \
484                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
485                     done \
486                 done; \
487                 opt="--index=4"; \
488                 echo "        $$opt"; \
489                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
490                 opt="--summation=bernoulli"; \
491                 echo "        $$opt"; \
492                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
493             fi \
494         done
495 if HAVE_OMEGA
496     SPEC_OMEGA = '--isl --omega'
497 endif
498 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
499         @for dir in $(BEE_TESTDIRS); do \
500             for i in $(top_srcdir)/tests/$$dir/*; do \
501                 if test -f $$i; then \
502                     for options in '' $(SPEC_OMEGA) '--isl'; do \
503                         for spec in 'random' 'bf' 'df'; do \
504                             opt="--specialization=$$spec $$options"; \
505                             echo $$i $$opt; \
506                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
507                         done \
508                     done \
509                 fi \
510             done \
511         done
512         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
513             if test -f $$i; then \
514                 for spec in 'random' 'bf' 'df'; do \
515                     opt="--specialization=$$spec --scarf"; \
516                     echo $$i $$opt; \
517                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
518                 done; \
519                 echo $$i --series; \
520                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
521             fi \
522         done
523 check-test: test$(EXEEXT)
524         @failed=0; \
525         for i in $(top_srcdir)/tests/*; do \
526             if test -f $$i; then \
527                 for options in '--index=10' '--primal --index=10'; do \
528                     for spec in 'random' 'bf' 'df' 'todd'; do \
529                         opt="--specialization=$$spec $$options"; \
530                         echo -n $$i $$opt; \
531                         ./test$(EXEEXT) $$opt < $$i; \
532                         if test "$$?" -ne "0"; then \
533                             failed=`expr $$failed + 1`; \
534                             echo " NOT ok"; \
535                         else \
536                             echo " ok"; \
537                         fi; \
538                     done \
539                 done \
540             fi \
541         done; \
542         for i in $(top_srcdir)/tests/sample/*; do \
543             echo -n $$i; \
544             ./test$(EXEEXT) < $$i; \
545             if test "$$?" -ne "0"; then \
546                 failed=`expr $$failed + 1`; \
547                 echo " NOT ok"; \
548             else \
549                 echo " ok"; \
550             fi; \
551         done; \
552         if test $$failed != 0; then \
553                 echo "$$failed tests failed"; \
554                 exit -1; \
555         fi
556 check-lexmin: lexmin$(EXEEXT)
557         @for i in $(top_srcdir)/tests/lexmin/*; do \
558             if test -f $$i; then \
559                 for spec in 'random' 'bf' 'df'; do \
560                     opt="--specialization=$$spec"; \
561                     echo $$i $$opt; \
562                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
563                 done \
564             fi \
565         done
566 check-iscc: iscc$(EXEEXT)
567         @for i in $(top_srcdir)/tests/iscc/*; do \
568                 if test -f $$i; then \
569                         echo $$i; \
570                         ./iscc$(EXEEXT) < $$i || exit; \
571                 fi \
572         done
573 check-union: barvinok_union$(EXEEXT)
574         @for i in $(top_srcdir)/tests/ehrhart_union/*; do \
575             if test -f $$i; then \
576                 for spec in 'random' 'bf' 'df'; do \
577                     opt="--specialization=$$spec $$options"; \
578                     echo $$i $$opt; \
579                     ./barvinok_union$(EXEEXT) -c $$opt < $$i || exit; \
580                 done \
581             fi \
582         done
584 version.h: @GIT_HEAD@
585         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@