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