Move GiNaC-independent part of library to barvinok-core
[barvinok.git] / Makefile.am
blob22779f186990531961d93027c19e7a7e947c3962
1 if HAVE_GINAC
2     MAYBE_BERNSTEIN = bernstein
3 endif
4 if BUNDLED_POLYLIB
5     MAYBE_POLYLIB = polylib
6 endif
7 if BUNDLED_PIPLIB
8     MAYBE_PIPLIB = piplib
9 endif
10 SUBDIRS = $(MAYBE_PIPLIB) $(MAYBE_POLYLIB) $(MAYBE_BERNSTEIN) lib zsolve . omega doc
12 FORCE:
13 lib/libgnu.la: FORCE
14         $(MAKE) $(AM_MAKEFLAGS) -C lib libgnu.la
15 bernstein/libbernstein.la: FORCE
16         $(MAKE) $(AM_MAKEFLAGS) -C bernstein libbernstein.la
17 polylib/libpolylibgmp.la: FORCE
18         $(MAKE) $(AM_MAKEFLAGS) -C polylib libpolylibgmp.la
19 piplib/libpiplibMP.la: FORCE
20         $(MAKE) $(AM_MAKEFLAGS) -C piplib libpiplibMP.la
21 zsolve/libzsolve.la: FORCE
22         $(MAKE) $(AM_MAKEFLAGS) -C zsolve libzsolve.la
24 AM_CPPFLAGS = -I$(srcdir)/bernstein/include -I$(srcdir)/lib \
25               @POLYLIB_CPPFLAGS@ @PIPLIB_CPPFLAGS@ @ginac_CFLAGS@
26 AM_LDFLAGS = -Llib @POLYLIB_LDFLAGS@ @PIPLIB_LDFLAGS@
28 lib_LTLIBRARIES = libbarvinok-core.la libbarvinok.la
29 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
30                   barvinok_ehrhart polytope_scan
31 noinst_PROGRAMS = test testlib randomtest \
32                   remove_redundant_equalities \
33                   barvinok_union polytope_volume test_approx \
34                   barvinok_summate verify_lexsmaller piptest \
35                   polyhedron_sample 4coins lexmin @bv_barvinok_maximize@ \
36                   cone_hilbert_basis cone_integer_hull \
37                   polytope_lattice_width polytope_minimize \
38                   polyhedron_integer_hull
39 EXTRA_PROGRAMS = barvinok_maximize
40 pkginclude_HEADERS = \
41     barvinok/NTL_QQ.h \
42     barvinok/barvinok.h \
43     barvinok/util.h \
44     barvinok/evalue.h \
45     barvinok/genfun.h \
46     barvinok/options.h \
47     barvinok/polylib.h \
48     barvinok/sample.h \
49     barvinok/basis_reduction.h \
50     barvinok/bernstein.h
51 nodist_pkginclude_HEADERS = \
52     barvinok/NTL.h \
53     barvinok/set.h
54 LINK = $(CXXLINK)
56 if HAVE_CDDLIB
57     BR_CDD = basis_reduction_cdd.cc initcdd.cc
58     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
59 endif
60 if HAVE_GLPK
61     BR_GLPK = basis_reduction_glpk.c
62     POLYSIGN_GLPK = polysign_glpk.c
63 endif
64 if HAVE_TOPCOM
65     TOPCOM = topcom.c topcom.h
66 endif
67 libbarvinok_core_la_SOURCES = \
68     barvinok/evalue.h \
69     barvinok/genfun.h \
70     barvinok/util.h \
71     barvinok/barvinok.h \
72     NTL_QQ.cc \
73     basis_reduction.c \
74     basis_reduction_pip.c \
75     basis_reduction_pip_dual.c \
76     evalue.c \
77     genfun.cc \
78     util.c \
79     version.c \
80     bernoulli.c \
81     bernoulli.h \
82     bfcounter.cc \
83     bfcounter.h \
84     conversion.cc \
85     conversion.h \
86     counter.cc \
87     counter.h \
88     decomposer.cc \
89     decomposer.h \
90     dpoly.cc \
91     dpoly.h \
92     euler.cc \
93     euler.h \
94     genfun_constructor.cc \
95     genfun_constructor.h \
96     hilbert.c \
97     hilbert.h \
98     hull.c \
99     hull.h \
100     ilp.c \
101     ilp.h \
102     lattice_point.cc \
103     lattice_point.h \
104     lattice_width.c \
105     lattice_width.h \
106     options.c \
107     param_util.c \
108     param_util.h \
109     piputil.h \
110     piputil.c \
111     $(POLYSIGN_CDD) \
112     $(POLYSIGN_GLPK) \
113     polysign.c \
114     polysign_pip.c \
115     polysign_polylib.c \
116     polysign.h \
117     reduce_domain.c \
118     reduce_domain.h \
119     reducer.cc \
120     reducer.h \
121     remove_equalities.h \
122     remove_equalities.c \
123     sample.c \
124     scale.c \
125     scale.h \
126     scarf.cc \
127     series.cc \
128     $(TOPCOM) \
129     volume.c \
130     volume.h \
131     mat_util.cc \
132     mat_util.h \
133     matrix_read.cc \
134     matrix_read.h \
135     barvinok.cc \
136     barvinok_e.cc \
137     $(BR_CDD) \
138     $(BR_GLPK)
139 EXTRA_libbarvinok_la_SOURCES = \
140     basis_reduction_cdd.cc \
141     basis_reduction_glpk.c \
142     bernstein.cc \
143     polysign_cddf.cc \
144     polysign_cdd.cc \
145     polysign.c \
146     initcdd.cc \
147     initcdd.h \
148     topcom.c \
149     topcom.h
150 if BUNDLED_POLYLIB
151     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
152 endif
153 if BUNDLED_PIPLIB
154     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
155 endif
156 libbarvinok_core_la_LIBADD = @LTLIBOBJS@ $(POLYLIB_LA) @POLYLIB_LIBS@ \
157                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
158                              zsolve/libzsolve.la lib/libgnu.la
159 libbarvinok_core_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
160 if HAVE_GINAC
161     BERNSTEIN_CC = bernstein.cc
162 endif
163 libbarvinok_la_SOURCES = \
164     $(BERNSTEIN_CC)
165 if HAVE_GINAC
166     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
167 endif
168 libbarvinok_la_LIBADD = libbarvinok-core.la $(BERNSTEIN_LA)
169 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
170 LDADD = libbarvinok-core.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
172 test_SOURCES = \
173         evalue_read.c \
174         evalue_read.h \
175         test.c
176 testlib_SOURCES = \
177         evalue_read.c \
178         evalue_read.h \
179         testlib.cc
180 barvinok_count_SOURCES = barvinok_count.c
181 barvinok_ehrhart_SOURCES = barvinok_ehrhart.cc
182 barvinok_union_SOURCES = barvinok_union.cc
183 if HAVE_OMEGA
184 BEEO_SOURCES = omega/Exit.cc omega/convert.cc
185 else
186 BEEO_SOURCES = 
187 endif
188 if USE_FDSTREAM
189 FDSTREAM = fdstream.cc fdstream.h
190 endif
191 barvinok_enumerate_SOURCES = \
192         barvinok_enumerate.cc \
193         evalue_convert.cc \
194         evalue_convert.h \
195         $(FDSTREAM) \
196         skewed_genfun.cc \
197         skewed_genfun.h \
198         verify.h \
199         verify.c \
200         verif_ehrhart.h \
201         verif_ehrhart.c \
202         verify_series.h \
203         verify_series.cc
204 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
205 barvinok_enumerate_e_SOURCES = \
206         barvinok_enumerate_e.cc \
207         evalue_convert.cc \
208         evalue_convert.h \
209         $(FDSTREAM) \
210         skewed_genfun.cc \
211         skewed_genfun.h \
212         verify.h \
213         verify.c \
214         verif_ehrhart.h \
215         verif_ehrhart.c \
216         verify_series.h \
217         verify_series.cc \
218         $(BEEO_SOURCES)
219 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
220 barvinok_enumerate_e_CPPFLAGS = @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
221 barvinok_enumerate_e_LDFLAGS = @OMEGA_LDFLAGS@ @LDFLAGS@
222 barvinok_enumerate_e_LDADD = \
223         @OMEGA_LIBS@ libbarvinok-core.la \
224         @POLYLIB_LIBS@ @PIPLIB_LIBS@
225 barvinok_maximize_SOURCES = \
226         evalue_convert.cc \
227         evalue_convert.h \
228         evalue_read.c \
229         evalue_read.h \
230         $(FDSTREAM) \
231         maximize.cc \
232         verify.h \
233         verify.c
234 EXTRA_barvinok_maximize_SOURCES = fdstream.cc fdstream.h
235 barvinok_maximize_LDADD = \
236         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
237 barvinok_summate_SOURCES = \
238         evalue_convert.cc \
239         evalue_convert.h \
240         evalue_read.c \
241         evalue_read.h \
242         $(FDSTREAM) \
243         summate.cc \
244         verify.h \
245         verify.c
246 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
247 4coins_SOURCES = 4coins.cc
248 lexmin_SOURCES = \
249         lexmin.h \
250         lexmin.cc \
251         combine.c \
252         combine.h \
253         edomain.cc \
254         edomain.h \
255         evalue_util.cc \
256         evalue_util.h \
257         verify.h \
258         verify.c
259 test_approx_SOURCES = \
260         test_approx.c \
261         verify.h \
262         verify.c
264 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
266 EXTRA_DIST = \
267     ChangeLog \
268     $(TESTFILES) \
269     latte2polylib.pl \
270     NTL_5_3_2.patch \
271     basis_reduction_templ.c \
272     polysign_cdd_template.cc \
273     barvinok/NTL.h.broken \
274     barvinok/NTL.h.normal \
275     barvinok/set.h.broken \
276     barvinok/set.h.normal \
277     doc/Internal.tex \
278     doc/applications.tex \
279     doc/barvinok.tex \
280     doc/omega.tex \
281     doc/polymake.tex \
282     doc/reports.tex \
283     doc/barvinok.bib \
284     doc/barvinok.gdf \
285     doc/chicago.bst \
286     doc/chicago.sty \
287     doc/mydefs.sty \
288     polymake/Makefile.in \
289     polymake/README \
290     polymake/autogen.sh \
291     polymake/configure.in \
292     polymake/convert.cc \
293     polymake/convert.h \
294     polymake/h_star_vector.cc \
295     polymake/lattice_points.cc
297 ACLOCAL_AMFLAGS = -I m4
299 install-data-local:
300         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
301         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
303 uninstall-local:
304         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
306 dist-hook:
307         (cd $(distdir)/polymake; \
308             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
309         (cd doc; make barvinok.pdf)
310         cp doc/barvinok.pdf $(distdir)/doc/
311         if test -f $(top_srcdir)/.git/HEAD; then \
312             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
313         else \
314             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
315         fi
317 dist-git: dist
318         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
320 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
322 check: check-testlib check-enumerate check-enumerate_e check-test \
323         check-lexmin check-approx check-evalue check-euler check-lw
324 check-testlib: testlib$(EXEEXT)
325         ./testlib$(EXEEXT)
326 check-approx: test_approx$(EXEEXT)
327         @for i in $(top_srcdir)/tests/ehrhart/*; do \
328             if test -f $$i; then \
329                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
330             fi \
331         done
332 check-evalue: @bv_barvinok_maximize@ barvinok_summate$(EXEEXT)
333         @for i in $(top_srcdir)/tests/evalue/*; do \
334             if test -f $$i; then \
335                 echo $$i; \
336                 if test -n "@bv_barvinok_maximize@"; then \
337                     ./barvinok_maximize$(EXEEXT) -T < $$i || exit; \
338                 fi; \
339                 ./barvinok_summate$(EXEEXT) -T < $$i || exit; \
340             fi \
341         done
342 check-euler: barvinok_summate$(EXEEXT)
343         @for i in $(top_srcdir)/tests/euler/*; do \
344             if test -f $$i; then \
345                 echo $$i; \
346                 ./barvinok_summate$(EXEEXT) -T --summation=euler < $$i || exit; \
347             fi \
348         done
349 if HAVE_TOPCOM
350     TOPCOM_CD = '--chamber-decomposition=topcom'
351 endif
352 check-enumerate: barvinok_enumerate$(EXEEXT)
353         @for i in $(top_srcdir)/tests/ehrhart/*; do \
354             if test -f $$i; then \
355                 echo $$i; \
356                 for options in '' '--series' '--series --primal' $(TOPCOM_CD); do \
357                     for spec in 'random' 'bf' 'df'; do \
358                         opt="--specialization=$$spec $$options"; \
359                         echo "        $$opt"; \
360                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
361                     done \
362                 done \
363             fi \
364         done
365 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
366         @for dir in $(BEE_TESTDIRS); do \
367             for i in $(top_srcdir)/tests/$$dir/*; do \
368                 if test -f $$i; then \
369                     for options in '' '--pip' '--pip --omega'; do \
370                         for spec in 'random' 'bf' 'df'; do \
371                             opt="--specialization=$$spec $$options"; \
372                             echo $$i $$opt; \
373                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
374                         done \
375                     done \
376                 fi \
377             done \
378         done
379         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
380             if test -f $$i; then \
381                 for spec in 'random' 'bf' 'df'; do \
382                     opt="--specialization=$$spec --scarf"; \
383                     echo $$i $$opt; \
384                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
385                 done \
386             fi \
387         done
388 check-test: test$(EXEEXT)
389         @for i in $(top_srcdir)/tests/*; do \
390             if test -f $$i; then \
391                 for options in '--index=10' '--primal --index=10'; do \
392                     for spec in 'random' 'bf' 'df' 'todd'; do \
393                         opt="--specialization=$$spec $$options"; \
394                         echo -n $$i $$opt; \
395                         ./test$(EXEEXT) $$opt < $$i || echo -n " NOT"; \
396                         echo " ok"; \
397                     done \
398                 done \
399             fi \
400         done
401 check-lw: test$(EXEEXT)
402         @for i in $(top_srcdir)/tests/lattice_width/*; do \
403             if test -f $$i; then \
404                 echo -n $$i; \
405                 ./test$(EXEEXT) < $$i || echo -n " NOT"; \
406                 echo " ok"; \
407             fi \
408         done
409 if HAVE_GLPK
410 check-lexmin: lexmin$(EXEEXT)
411         @for i in $(top_srcdir)/tests/lexmin/*; do \
412             if test -f $$i; then \
413                 for spec in 'random' 'bf' 'df'; do \
414                     opt="--specialization=$$spec"; \
415                     echo $$i $$opt; \
416                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
417                 done \
418             fi \
419         done
420 else
421 check-lexmin:
422 endif
424 version.h: @GIT_HEAD@
425         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@