update pet for support for recent clangs
[barvinok.git] / Makefile.am
blobe2d1643cf3f5abf8ba4468dc14e84fa100ac908d
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     polymake/Makefile.in \
373     polymake/README \
374     polymake/autogen.sh \
375     polymake/configure.in \
376     polymake/convert.cc \
377     polymake/convert.h \
378     polymake/h_star_vector.cc \
379     polymake/lattice_points.cc
381 ACLOCAL_AMFLAGS = -I m4
383 install-data-local:
384         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
385         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
387 uninstall-local:
388         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
390 dist-hook:
391         (cd $(distdir)/polymake; \
392             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
393         (cd doc; make barvinok.pdf)
394         cp doc/barvinok.pdf $(distdir)/doc/
395         if test -f $(top_srcdir)/.git/HEAD; then \
396             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
397         else \
398             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
399         fi
401 dist-git: dist
402         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
404 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
406 check: check-testlib check-enumerate check-enumerate_e check-test \
407         check-lexmin check-approx check-pwqp check-euler check-lw check-iscc
408 check-testlib: testlib$(EXEEXT)
409         ./testlib$(EXEEXT)
410 check-approx: test_approx$(EXEEXT)
411         @for i in $(top_srcdir)/tests/ehrhart/*; do \
412             if test -f $$i; then \
413                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
414             fi \
415         done
416 check-pwqp: barvinok_bound$(EXEEXT) test_bound$(EXEEXT) barvinok_summate$(EXEEXT)
417         @for i in $(top_srcdir)/tests/pwqp/*; do \
418             if test -f $$i; then \
419                 echo $$i; \
420                 ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
421                 echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
422                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
423             fi \
424         done
425 check-euler: barvinok_summate$(EXEEXT)
426         @for i in $(top_srcdir)/tests/euler/*; do \
427             if test -f $$i; then \
428                 for method in 'euler' 'laurent_old' 'laurent'; do \
429                     opt="--summation=$$method"; \
430                     echo $$i $$opt; \
431                     ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
432                 done \
433             fi \
434         done
435 if HAVE_TOPCOM
436     TOPCOM_CD = '--chamber-decomposition=topcom'
437 endif
438 ISL_CD = '--chamber-decomposition=isl'
439 check-enumerate: barvinok_enumerate$(EXEEXT)
440         @for i in $(top_srcdir)/tests/ehrhart/*; do \
441             if test -f $$i; then \
442                 echo $$i; \
443                 for options in '' '--series' '--series --primal' $(TOPCOM_CD) $(ISL_CD); do \
444                     for spec in 'random' 'bf' 'df'; do \
445                         opt="--specialization=$$spec $$options"; \
446                         echo "        $$opt"; \
447                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
448                     done \
449                 done; \
450                 opt="--summation=bernoulli"; \
451                 echo "        $$opt"; \
452                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
453             fi \
454         done
455 if HAVE_OMEGA
456     SPEC_OMEGA = '--isl --omega'
457 endif
458 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
459         @for dir in $(BEE_TESTDIRS); do \
460             for i in $(top_srcdir)/tests/$$dir/*; do \
461                 if test -f $$i; then \
462                     for options in '' $(SPEC_OMEGA) '--isl'; do \
463                         for spec in 'random' 'bf' 'df'; do \
464                             opt="--specialization=$$spec $$options"; \
465                             echo $$i $$opt; \
466                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
467                         done \
468                     done \
469                 fi \
470             done \
471         done
472         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
473             if test -f $$i; then \
474                 for spec in 'random' 'bf' 'df'; do \
475                     opt="--specialization=$$spec --scarf"; \
476                     echo $$i $$opt; \
477                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
478                 done; \
479                 echo $$i --series; \
480                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
481             fi \
482         done
483 check-test: test$(EXEEXT)
484         @failed=0; \
485         for i in $(top_srcdir)/tests/*; do \
486             if test -f $$i; then \
487                 for options in '--index=10' '--primal --index=10'; do \
488                     for spec in 'random' 'bf' 'df' 'todd'; do \
489                         opt="--specialization=$$spec $$options"; \
490                         echo -n $$i $$opt; \
491                         ./test$(EXEEXT) $$opt < $$i; \
492                         if test "$$?" -ne "0"; then \
493                             failed=`expr $$failed + 1`; \
494                             echo " NOT ok"; \
495                         else \
496                             echo " ok"; \
497                         fi; \
498                     done \
499                 done \
500             fi \
501         done; \
502         for i in $(top_srcdir)/tests/sample/*; do \
503             echo -n $$i; \
504             ./test$(EXEEXT) < $$i; \
505             if test "$$?" -ne "0"; then \
506                 failed=`expr $$failed + 1`; \
507                 echo " NOT ok"; \
508             else \
509                 echo " ok"; \
510             fi; \
511         done; \
512         if test $$failed != 0; then \
513                 echo "$$failed tests failed"; \
514                 exit -1; \
515         fi
516 check-lw: test$(EXEEXT)
517         @failed=0; \
518         for i in $(top_srcdir)/tests/lattice_width/*; do \
519             if test -f $$i; then \
520                 echo -n $$i; \
521                 ./test$(EXEEXT) < $$i; \
522                 if test "$$?" -ne "0"; then \
523                     failed=`expr $$failed + 1`; \
524                     echo " NOT ok"; \
525                 else \
526                     echo " ok"; \
527                 fi; \
528             fi \
529         done; \
530         if test $$failed != 0; then \
531                 echo "$$failed tests failed"; \
532                 exit -1; \
533         fi
534 check-lexmin: lexmin$(EXEEXT)
535         @for i in $(top_srcdir)/tests/lexmin/*; do \
536             if test -f $$i; then \
537                 for spec in 'random' 'bf' 'df'; do \
538                     opt="--specialization=$$spec"; \
539                     echo $$i $$opt; \
540                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
541                 done \
542             fi \
543         done
544 check-iscc: iscc$(EXEEXT)
545         @for i in $(top_srcdir)/tests/iscc/*; do \
546                 if test -f $$i; then \
547                         echo $$i; \
548                         ./iscc$(EXEEXT) < $$i || exit; \
549                 fi \
550         done
552 version.h: @GIT_HEAD@
553         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@