replace obsolete AC_HELP_STRING calls by AS_HELP_STRING
[barvinok.git] / Makefile.am
blobd86cb2b3e6801e447926970a6c52f897068592c2
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 = @BV_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 iscc
54 noinst_PROGRAMS = test testlib randomtest \
55                   barvinok_union polytope_volume test_approx \
56                   barvinok_summate \
57                   4coins lexmin \
58                   @bv_cone_hilbert_basis@ cone_integer_hull \
59                   polyhedron_integer_hull vector_partition_chambers \
60                   semigroup_holes \
61                   barvinok_bound test_bound
62 EXTRA_PROGRAMS = cone_hilbert_basis
63 pkginclude_HEADERS = \
64     barvinok/NTL_QQ.h \
65     barvinok/isl.h \
66     barvinok/barvinok.h \
67     barvinok/util.h \
68     barvinok/evalue.h \
69     barvinok/genfun.h \
70     barvinok/options.h \
71     barvinok/polylib.h \
72     barvinok/sample.h \
73     barvinok/basis_reduction.h
74 nodist_pkginclude_HEADERS = \
75     barvinok/NTL.h \
76     barvinok/set.h
77 LINK = $(CXXLINK)
79 if HAVE_CDDLIB
80     BR_CDD = basis_reduction_cdd.cc initcdd.cc
81     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
82 endif
83 if HAVE_GLPK
84     BR_GLPK = basis_reduction_glpk.c
85     POLYSIGN_GLPK = polysign_glpk.c
86 endif
87 if HAVE_TOPCOM
88     TOPCOM = topcom.c topcom.h
89 endif
90 if USE_ZSOLVE
91     HILBERT_C = hilbert.c
92 endif
93 libbarvinok_la_SOURCES = \
94     barvinok/evalue.h \
95     barvinok/genfun.h \
96     barvinok/util.h \
97     barvinok/barvinok.h \
98     NTL_QQ.cc \
99     basis_reduction.c \
100     evalue.c \
101     genfun.cc \
102     util.c \
103     version.c \
104     bernoulli.c \
105     bernoulli.h \
106     bfcounter.cc \
107     bfcounter.h \
108     binomial.c \
109     binomial.h \
110     conversion.cc \
111     conversion.h \
112     counter.cc \
113     counter.h \
114     decomposer.cc \
115     decomposer.h \
116     dpoly.cc \
117     dpoly.h \
118     euler.cc \
119     euler.h \
120     evalue_isl.c \
121     genfun_constructor.cc \
122     genfun_constructor.h \
123     $(HILBERT_C) \
124     hilbert.h \
125     hull.c \
126     hull.h \
127     ilp.c \
128     ilp.h \
129     isl_aff_polylib.c \
130     isl_aff_polylib.h \
131     isl_map_polylib.c \
132     isl_map_polylib.h \
133     isl_set_polylib.h \
134     isl_param_util.c \
135     isl_param_util.h \
136     lattice_point.cc \
137     lattice_point.h \
138     lattice_width.c \
139     lattice_width.h \
140     laurent.cc \
141     laurent.h \
142     laurent_old.cc \
143     laurent_old.h \
144     normalization.c \
145     normalization.h \
146     options.c \
147     param_polynomial.cc \
148     param_polynomial.h \
149     param_util.c \
150     param_util.h \
151     $(POLYSIGN_CDD) \
152     $(POLYSIGN_GLPK) \
153     polysign.c \
154     polysign_isl.c \
155     polysign_polylib.c \
156     polysign.h \
157     power.h \
158     reduce_domain.c \
159     reduce_domain.h \
160     reducer.cc \
161     reducer.h \
162     remove_equalities.h \
163     remove_equalities.c \
164     sample.c \
165     scale.c \
166     scale.h \
167     scarf.cc \
168     section_array.h \
169     series.cc \
170     $(TOPCOM) \
171     summate.c \
172     summate.h \
173     vertex_cone.cc \
174     vertex_cone.h \
175     volume.c \
176     volume.h \
177     mat_util.cc \
178     mat_util.h \
179     matrix_read.cc \
180     matrix_read.h \
181     barvinok.cc \
182     barvinok_e.cc \
183     $(BR_CDD) \
184     $(BR_GLPK)
185 EXTRA_libbarvinok_la_SOURCES = \
186     basis_reduction_cdd.cc \
187     basis_reduction_glpk.c \
188     hilbert.c \
189     polysign_cddf.cc \
190     polysign_cdd.cc \
191     polysign.c \
192     initcdd.cc \
193     initcdd.h \
194     topcom.c \
195     topcom.h
196 if USE_ZSOLVE
197     ZSOLVE_LA = zsolve/libzsolve.la
198 endif
199 libbarvinok_la_LIBADD = @LTLIBOBJS@ $(LIB_ISL) \
200                              $(LIB_POLYLIB) $(ZSOLVE_LA)
201 libbarvinok_la_LDFLAGS = @BV_LIB_LDFLAGS@ -version-info @versioninfo@ \
202                                 $(AM_LDFLAGS)
203 LDADD = libbarvinok.la $(LIB_ISL) $(LIB_POLYLIB)
205 test_SOURCES = \
206         test.c
207 testlib_SOURCES = \
208         evalue_read.c \
209         evalue_read.h \
210         testlib.cc
211 barvinok_count_SOURCES = barvinok_count.c
212 barvinok_ehrhart_SOURCES = \
213         barvinok_ehrhart_options.c \
214         barvinok_ehrhart_options.h \
215         barvinok_ehrhart.cc \
216         evalue_convert_options.c \
217         evalue_convert.cc \
218         evalue_convert.h \
219         $(FDSTREAM)
220 barvinok_union_SOURCES = \
221         barvinok_union_options.c \
222         barvinok_union_options.h \
223         barvinok_union.cc
224 if HAVE_OMEGA
225 BEEO_SOURCES = \
226         omega_interface/Exit.cc \
227         omega_interface/convert.h \
228         omega_interface/convert.cc \
229         omega_interface/count.h \
230         omega_interface/count.cc
231 else
232 BEEO_SOURCES = 
233 endif
234 if USE_FDSTREAM
235 FDSTREAM = fdstream.cc fdstream.h
236 endif
237 barvinok_enumerate_SOURCES = \
238         barvinok_enumerate_options.c \
239         barvinok_enumerate_options.h \
240         barvinok_enumerate.cc \
241         evalue_convert_options.c \
242         evalue_convert.cc \
243         evalue_convert.h \
244         $(FDSTREAM) \
245         skewed_genfun.cc \
246         skewed_genfun.h \
247         verify.h \
248         verify.c \
249         verify_series.h \
250         verify_series.cc
251 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
252 barvinok_enumerate_e_SOURCES = \
253         barvinok_enumerate_e_options.c \
254         barvinok_enumerate_e_options.h \
255         barvinok_enumerate_e.cc \
256         evalue_convert_options.c \
257         evalue_convert.cc \
258         evalue_convert.h \
259         $(FDSTREAM) \
260         skewed_genfun.cc \
261         skewed_genfun.h \
262         verify.h \
263         verify.c \
264         verif_ehrhart.h \
265         verif_ehrhart.c \
266         verify_series.h \
267         verify_series.cc \
268         $(BEEO_SOURCES)
269 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
270 if USE_PARKER
271     MONA_LIBS = -ldfa -lbdd -lmem
272     PARKER_LA = parker/libparker.la
273     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
274     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
275 endif
276 barvinok_enumerate_e_CPPFLAGS = \
277         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
278 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
279 barvinok_enumerate_e_LDADD = \
280         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ libbarvinok.la \
281         $(LIB_ISL) $(LIB_POLYLIB)
282 barvinok_bound_SOURCES = \
283         bound.c \
284         verify.h \
285         verify.c
286 barvinok_summate_SOURCES = \
287         barvinok_summate.c \
288         verify.h \
289         verify.c
290 4coins_SOURCES = 4coins.cc
291 semigroup_holes_SOURCES = semigroup_holes.cc
292 lexmin_SOURCES = \
293         lexmin_options.c \
294         lexmin.h \
295         lexmin.cc \
296         edomain.cc \
297         edomain.h \
298         evalue_util.cc \
299         evalue_util.h \
300         verify.h \
301         verify.c
302 test_approx_SOURCES = \
303         test_approx.c \
304         verify.h \
305         verify.c
306 test_bound_SOURCES = \
307         test_bound.c \
308         verify.h \
309         verify.c
310 iscc_SOURCES =  \
311         isl_obj_list.h \
312         isl_obj_list.c \
313         isl_obj_str.h \
314         isl_obj_str.c \
315         iscc.c
316 iscc_CPPFLAGS = @PET_CFLAGS@ $(AM_CPPFLAGS)
317 iscc_LDADD = \
318         libbarvinok.la $(LIB_PET) $(LIB_ISL) \
319         $(LIB_POLYLIB)
321 if HAVE_ISL_BUILDDIR
322 # dummy library that captures the dependencies on all headers
323 # that are relevant for the bindings
324 noinst_LIBRARIES = libdep.a
325 libdep_a_CPPFLAGS = $(DEFAULT_INCLUDES) @ISL_CFLAGS@ -I"@ISL_SRCDIR@"
326 libdep_a_SOURCES = interface/all_barvinok.c
328 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT):
329         $(MAKE) -C @ISL_BUILDDIR@ interface/extract_interface$(EXEEXT)
331 isl.py: libdep.a interface/isl.py.top \
332                 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT)
333         (cat interface/isl.py.top && \
334                 @ISL_BUILDDIR@/interface/extract_interface$(EXEEXT) \
335                         --language=python \
336                         $(DEFAULT_INCLUDES) @ISL_CFLAGS@ -I"@ISL_SRCDIR@" \
337                         $(srcdir)/interface/all_barvinok.h) \
338                         > $@ || (rm $@ && false)
339 endif
341 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
343 CLEANFILES = \
344         zsolve/graver \
345         zsolve/hilbert \
346         isl.py \
347         version.h
348 DISTCLEANFILES = \
349         barvinok-uninstalled.sh \
350         barvinok-uninstalled.pc \
351         barvinok.pc \
352         barvinok.pc.in \
353         barvinok/set.h \
354         barvinok/NTL.h \
355         interface/isl.py.top
357 EXTRA_DIST = \
358     LICENSE \
359     ChangeLog \
360     $(TESTFILES) \
361     latte2polylib.pl \
362     NTL_5_3_2.patch \
363     basis_reduction_templ.c \
364     cdd94e-test \
365     polysign_cdd_template.cc \
366     barvinok/NTL.h.broken \
367     barvinok/NTL.h.normal \
368     barvinok/set.h.broken \
369     barvinok/set.h.normal \
370     config_post.h \
371     doc/isl.tex \
372     doc/Internal.tex \
373     doc/applications.tex \
374     doc/barvinok.tex \
375     doc/polymake.tex \
376     doc/reports.tex \
377     doc/barvinok.bib \
378     doc/barvinok.gdf \
379     doc/chicago.bst \
380     doc/chicago.sty \
381     doc/glosstex.ist \
382     doc/mydefs.sty \
383     interface/all_barvinok.h \
384     interface/isl.py.top.no_pet \
385     interface/isl.py.top.pet \
386     polymake/Makefile.in \
387     polymake/README \
388     polymake/autogen.sh \
389     polymake/configure.in \
390     polymake/convert.cc \
391     polymake/convert.h \
392     polymake/h_star_vector.cc \
393     polymake/lattice_points.cc
395 ACLOCAL_AMFLAGS = -I m4
397 install-data-local:
398         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
399         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
401 uninstall-local:
402         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
404 dist-hook: isl.py
405         cp isl.py $(distdir)/
406         (cd $(distdir)/polymake; \
407             ./autogen.sh; rm -rf autom4te.cache)
408         (cd doc; make barvinok.pdf)
409         cp doc/barvinok.pdf $(distdir)/doc/
410         if test -f $(top_srcdir)/.git/HEAD; then \
411             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
412         else \
413             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
414         fi
416 dist-git: dist
417         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
419 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
421 check: check-testlib check-enumerate check-enumerate_e check-test \
422         check-lexmin check-approx check-pwqp check-euler check-iscc \
423         check-union
424 check-testlib: testlib$(EXEEXT)
425         ./testlib$(EXEEXT)
426 check-approx: test_approx$(EXEEXT)
427         @for i in $(top_srcdir)/tests/ehrhart/*; do \
428             if test -f $$i; then \
429                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
430             fi \
431         done
432 check-pwqp: barvinok_bound$(EXEEXT) test_bound$(EXEEXT) barvinok_summate$(EXEEXT)
433         @for i in $(top_srcdir)/tests/pwqp/*; do \
434             if test -f $$i; then \
435                 echo $$i; \
436                 ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
437                 echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
438                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
439             fi \
440         done
441         @echo $(top_srcdir)/tests/pwqp/hong1.pwqp --iterate
442         @./barvinok_bound$(EXEEXT) --iterate -T -r30 < \
443                 $(top_srcdir)/tests/pwqp/hong1.pwqp || exit
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_p2 \
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_p2 \
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: iscc$(EXEEXT)
524         @failed=0; \
525         for i in $(top_srcdir)/tests/iscc/count/*; 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                         ./iscc$(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         if test $$failed != 0; then \
543                 echo "$$failed tests failed"; \
544                 exit -1; \
545         fi
546 check-lexmin: lexmin$(EXEEXT)
547         @for i in $(top_srcdir)/tests/lexmin/*; do \
548             if test -f $$i; then \
549                 for spec in 'random' 'bf' 'df'; do \
550                     opt="--specialization=$$spec"; \
551                     echo $$i $$opt; \
552                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
553                 done \
554             fi \
555         done
556 check-iscc: iscc$(EXEEXT)
557         @for i in $(top_srcdir)/tests/iscc/*; do \
558                 if test -f $$i; then \
559                         echo $$i; \
560                         ./iscc$(EXEEXT) < $$i || exit; \
561                 fi \
562         done
563 check-union: barvinok_union$(EXEEXT)
564         @for i in $(top_srcdir)/tests/ehrhart_union/*; do \
565             if test -f $$i; then \
566                 for spec in 'random' 'bf' 'df'; do \
567                     opt="--specialization=$$spec $$options"; \
568                     echo $$i $$opt; \
569                     ./barvinok_union$(EXEEXT) -c $$opt < $$i || exit; \
570                 done \
571             fi \
572         done
574 version.h: @GIT_HEAD@
575         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@