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