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