correctly reflect extra sources for libbarvinok and libbarvinok-core
[barvinok.git] / Makefile.am
blob5b38ff2a5a8673732648170b39be577bd56fd3d5
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 if USE_ZSOLVE
11     MAYBE_ZSOLVE = zsolve
12 endif
13 if USE_PARKER
14     MAYBE_PARKER = parker
15 endif
16 SUBDIRS = $(MAYBE_PIPLIB) $(MAYBE_POLYLIB) $(MAYBE_BERNSTEIN) \
17                 lib $(MAYBE_ZSOLVE) $(MAYBE_PARKER) . omega doc
19 FORCE:
20 lib/libgnu.la: FORCE
21         $(MAKE) $(AM_MAKEFLAGS) -C lib libgnu.la
22 bernstein/libbernstein.la: FORCE
23         $(MAKE) $(AM_MAKEFLAGS) -C bernstein libbernstein.la
24 polylib/libpolylibgmp.la: FORCE
25         $(MAKE) $(AM_MAKEFLAGS) -C polylib libpolylibgmp.la
26 piplib/libpiplibMP.la: FORCE
27         $(MAKE) $(AM_MAKEFLAGS) -C piplib libpiplibMP.la
28 zsolve/libzsolve.la: FORCE
29         $(MAKE) $(AM_MAKEFLAGS) -C zsolve libzsolve.la
30 parker/libparker.la: FORCE
31         $(MAKE) $(AM_MAKEFLAGS) -C parker libparker.la
33 AM_CPPFLAGS = -I$(srcdir)/bernstein/include -I$(srcdir)/lib \
34               @POLYLIB_CPPFLAGS@ @PIPLIB_CPPFLAGS@ @ginac_CFLAGS@ \
35               @NTL_CPPFLAGS@
36 AM_LDFLAGS = -Llib @POLYLIB_LDFLAGS@ @PIPLIB_LDFLAGS@ @NTL_LDFLAGS@
38 lib_LTLIBRARIES = libbarvinok-core.la libbarvinok.la
39 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
40                   barvinok_ehrhart polytope_scan
41 noinst_PROGRAMS = test testlib randomtest \
42                   remove_redundant_equalities \
43                   barvinok_union polytope_volume test_approx \
44                   barvinok_summate verify_lexsmaller piptest \
45                   polyhedron_sample 4coins lexmin @bv_barvinok_bound@ \
46                   @bv_cone_hilbert_basis@ cone_integer_hull \
47                   polytope_lattice_width polytope_minimize \
48                   polyhedron_integer_hull
49 EXTRA_PROGRAMS = barvinok_bound test_bound cone_hilbert_basis
50 pkginclude_HEADERS = \
51     barvinok/NTL_QQ.h \
52     barvinok/barvinok.h \
53     barvinok/util.h \
54     barvinok/evalue.h \
55     barvinok/genfun.h \
56     barvinok/options.h \
57     barvinok/polylib.h \
58     barvinok/sample.h \
59     barvinok/basis_reduction.h \
60     barvinok/bernstein.h
61 nodist_pkginclude_HEADERS = \
62     barvinok/NTL.h \
63     barvinok/set.h
64 LINK = $(CXXLINK)
66 if HAVE_CDDLIB
67     BR_CDD = basis_reduction_cdd.cc initcdd.cc
68     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
69 endif
70 if HAVE_GLPK
71     BR_GLPK = basis_reduction_glpk.c
72     POLYSIGN_GLPK = polysign_glpk.c
73 endif
74 if HAVE_TOPCOM
75     TOPCOM = topcom.c topcom.h
76 endif
77 if USE_ZSOLVE
78     HILBERT_C = hilbert.c
79 endif
80 libbarvinok_core_la_SOURCES = \
81     barvinok/evalue.h \
82     barvinok/genfun.h \
83     barvinok/util.h \
84     barvinok/barvinok.h \
85     NTL_QQ.cc \
86     basis_reduction.c \
87     basis_reduction_pip.c \
88     basis_reduction_pip_dual.c \
89     evalue.c \
90     genfun.cc \
91     util.c \
92     version.c \
93     bernoulli.c \
94     bernoulli.h \
95     bfcounter.cc \
96     bfcounter.h \
97     binomial.c \
98     binomial.h \
99     conversion.cc \
100     conversion.h \
101     counter.cc \
102     counter.h \
103     decomposer.cc \
104     decomposer.h \
105     dpoly.cc \
106     dpoly.h \
107     euler.cc \
108     euler.h \
109     genfun_constructor.cc \
110     genfun_constructor.h \
111     $(HILBERT_C) \
112     hilbert.h \
113     hull.c \
114     hull.h \
115     ilp.c \
116     ilp.h \
117     lattice_point.cc \
118     lattice_point.h \
119     lattice_width.c \
120     lattice_width.h \
121     laurent.cc \
122     laurent.h \
123     normalization.c \
124     normalization.h \
125     options.c \
126     param_util.c \
127     param_util.h \
128     piputil.h \
129     piputil.c \
130     $(POLYSIGN_CDD) \
131     $(POLYSIGN_GLPK) \
132     polysign.c \
133     polysign_pip.c \
134     polysign_polylib.c \
135     polysign.h \
136     power.h \
137     reduce_domain.c \
138     reduce_domain.h \
139     reducer.cc \
140     reducer.h \
141     remove_equalities.h \
142     remove_equalities.c \
143     sample.c \
144     scale.c \
145     scale.h \
146     scarf.cc \
147     section_array.h \
148     series.cc \
149     $(TOPCOM) \
150     summate.c \
151     summate.h \
152     volume.c \
153     volume.h \
154     mat_util.cc \
155     mat_util.h \
156     matrix_read.cc \
157     matrix_read.h \
158     barvinok.cc \
159     barvinok_e.cc \
160     $(BR_CDD) \
161     $(BR_GLPK)
162 EXTRA_libbarvinok_core_la_SOURCES = \
163     basis_reduction_cdd.cc \
164     basis_reduction_glpk.c \
165     hilbert.c \
166     polysign_cddf.cc \
167     polysign_cdd.cc \
168     polysign.c \
169     initcdd.cc \
170     initcdd.h \
171     topcom.c \
172     topcom.h
173 if BUNDLED_POLYLIB
174     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
175 endif
176 if BUNDLED_PIPLIB
177     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
178 endif
179 if USE_ZSOLVE
180     ZSOLVE_LA = zsolve/libzsolve.la
181 endif
182 libbarvinok_core_la_LIBADD = @LTLIBOBJS@ $(POLYLIB_LA) @POLYLIB_LIBS@ \
183                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
184                              $(ZSOLVE_LA) lib/libgnu.la
185 libbarvinok_core_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
186                                 $(AM_LDFLAGS)
187 if HAVE_GINAC
188     BERNSTEIN_CC = bernstein.cc ex_convert.cc range.cc
189 endif
190 libbarvinok_la_SOURCES = \
191     $(BERNSTEIN_CC)
192 EXTRA_libbarvinok_la_SOURCES = \
193     ex_convert.cc \
194     ex_convert.h \
195     range.cc \
196     range.h \
197     bernstein.cc
198 if HAVE_GINAC
199     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
200 endif
201 libbarvinok_la_LIBADD = libbarvinok-core.la $(BERNSTEIN_LA)
202 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@ \
203                                 $(AM_LDFLAGS)
204 LDADD = libbarvinok-core.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
206 test_SOURCES = \
207         evalue_read.c \
208         evalue_read.h \
209         test.c
210 testlib_SOURCES = \
211         evalue_read.c \
212         evalue_read.h \
213         testlib.cc
214 barvinok_count_SOURCES = barvinok_count.c
215 barvinok_ehrhart_SOURCES = \
216         barvinok_ehrhart.cc \
217         evalue_convert.cc \
218         evalue_convert.h \
219         $(FDSTREAM)
220 barvinok_union_SOURCES = barvinok_union.cc
221 if HAVE_OMEGA
222 BEEO_SOURCES = omega/Exit.cc omega/convert.cc omega/count.cc
223 else
224 BEEO_SOURCES = 
225 endif
226 if USE_FDSTREAM
227 FDSTREAM = fdstream.cc fdstream.h
228 endif
229 barvinok_enumerate_SOURCES = \
230         barvinok_enumerate.cc \
231         evalue_convert.cc \
232         evalue_convert.h \
233         $(FDSTREAM) \
234         skewed_genfun.cc \
235         skewed_genfun.h \
236         verify.h \
237         verify.c \
238         verif_ehrhart.h \
239         verif_ehrhart.c \
240         verify_series.h \
241         verify_series.cc
242 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
243 barvinok_enumerate_e_SOURCES = \
244         barvinok_enumerate_e.cc \
245         evalue_convert.cc \
246         evalue_convert.h \
247         $(FDSTREAM) \
248         skewed_genfun.cc \
249         skewed_genfun.h \
250         verify.h \
251         verify.c \
252         verif_ehrhart.h \
253         verif_ehrhart.c \
254         verify_series.h \
255         verify_series.cc \
256         $(BEEO_SOURCES)
257 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
258 if USE_PARKER
259     MONA_LIBS = -ldfa -lbdd -lmem
260     PARKER_LA = parker/libparker.la
261     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
262     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
263 endif
264 barvinok_enumerate_e_CPPFLAGS = \
265         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
266 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
267 barvinok_enumerate_e_LDADD = \
268         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ libbarvinok-core.la \
269         @POLYLIB_LIBS@ @PIPLIB_LIBS@
270 barvinok_bound_SOURCES = \
271         evalue_convert.cc \
272         evalue_convert.h \
273         evalue_read.c \
274         evalue_read.h \
275         $(FDSTREAM) \
276         bound.cc \
277         verify.h \
278         verify.c
279 EXTRA_barvinok_bound_SOURCES = fdstream.cc fdstream.h
280 barvinok_bound_LDADD = \
281         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
282 barvinok_summate_SOURCES = \
283         barvinok_summate.cc \
284         evalue_convert.cc \
285         evalue_convert.h \
286         evalue_read.c \
287         evalue_read.h \
288         $(FDSTREAM) \
289         verify.h \
290         verify.c
291 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
292 4coins_SOURCES = 4coins.cc
293 lexmin_SOURCES = \
294         lexmin.h \
295         lexmin.cc \
296         combine.c \
297         combine.h \
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.cc \
310         evalue_convert.cc \
311         evalue_convert.h \
312         evalue_read.c \
313         evalue_read.h \
314         $(FDSTREAM) \
315         verify.h \
316         verify.c
317 EXTRA_test_bound_SOURCES = fdstream.cc fdstream.h
318 test_bound_LDADD = \
319         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
321 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
323 EXTRA_DIST = \
324     ChangeLog \
325     $(TESTFILES) \
326     latte2polylib.pl \
327     NTL_5_3_2.patch \
328     basis_reduction_templ.c \
329     cdd94e-test \
330     polysign_cdd_template.cc \
331     barvinok/NTL.h.broken \
332     barvinok/NTL.h.normal \
333     barvinok/set.h.broken \
334     barvinok/set.h.normal \
335     doc/Internal.tex \
336     doc/applications.tex \
337     doc/barvinok.tex \
338     doc/omega.tex \
339     doc/polymake.tex \
340     doc/reports.tex \
341     doc/barvinok.bib \
342     doc/barvinok.gdf \
343     doc/chicago.bst \
344     doc/chicago.sty \
345     doc/mydefs.sty \
346     polymake/Makefile.in \
347     polymake/README \
348     polymake/autogen.sh \
349     polymake/configure.in \
350     polymake/convert.cc \
351     polymake/convert.h \
352     polymake/h_star_vector.cc \
353     polymake/lattice_points.cc
355 ACLOCAL_AMFLAGS = -I m4
357 install-data-local:
358         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
359         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
361 uninstall-local:
362         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
364 dist-hook:
365         (cd $(distdir)/polymake; \
366             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
367         (cd doc; make barvinok.pdf)
368         cp doc/barvinok.pdf $(distdir)/doc/
369         if test -f $(top_srcdir)/.git/HEAD; then \
370             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
371         else \
372             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
373         fi
375 dist-git: dist
376         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
378 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
380 check: check-testlib check-enumerate check-enumerate_e check-test \
381         check-lexmin check-approx check-evalue check-euler check-lw
382 check-testlib: testlib$(EXEEXT)
383         ./testlib$(EXEEXT)
384 check-approx: test_approx$(EXEEXT)
385         @for i in $(top_srcdir)/tests/ehrhart/*; do \
386             if test -f $$i; then \
387                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
388             fi \
389         done
390 check-evalue: @bv_barvinok_bound@ barvinok_summate$(EXEEXT)
391         @for i in $(top_srcdir)/tests/evalue/*; do \
392             if test -f $$i; then \
393                 echo $$i; \
394                 if test -n "@bv_barvinok_bound@"; then \
395                     ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \
396                     echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \
397                 fi; \
398                 ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \
399             fi \
400         done
401 check-euler: barvinok_summate$(EXEEXT)
402         @for i in $(top_srcdir)/tests/euler/*; do \
403             if test -f $$i; then \
404                 for method in 'euler' 'laurent'; do \
405                     opt="--summation=$$method"; \
406                     echo $$i $$opt; \
407                     ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \
408                 done \
409             fi \
410         done
411 if HAVE_TOPCOM
412     TOPCOM_CD = '--chamber-decomposition=topcom'
413 endif
414 check-enumerate: barvinok_enumerate$(EXEEXT)
415         @for i in $(top_srcdir)/tests/ehrhart/*; do \
416             if test -f $$i; then \
417                 echo $$i; \
418                 for options in '' '--series' '--series --primal' $(TOPCOM_CD); do \
419                     for spec in 'random' 'bf' 'df'; do \
420                         opt="--specialization=$$spec $$options"; \
421                         echo "        $$opt"; \
422                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
423                     done \
424                 done; \
425                 opt="--summation=bernoulli"; \
426                 echo "        $$opt"; \
427                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
428             fi \
429         done
430 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
431         @for dir in $(BEE_TESTDIRS); do \
432             for i in $(top_srcdir)/tests/$$dir/*; do \
433                 if test -f $$i; then \
434                     for options in '' '--pip' '--pip --omega'; do \
435                         for spec in 'random' 'bf' 'df'; do \
436                             opt="--specialization=$$spec $$options"; \
437                             echo $$i $$opt; \
438                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
439                         done \
440                     done \
441                 fi \
442             done \
443         done
444         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
445             if test -f $$i; then \
446                 for spec in 'random' 'bf' 'df'; do \
447                     opt="--specialization=$$spec --scarf"; \
448                     echo $$i $$opt; \
449                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
450                 done; \
451                 echo $$i --series; \
452                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
453             fi \
454         done
455 check-test: test$(EXEEXT)
456         @for i in $(top_srcdir)/tests/*; do \
457             if test -f $$i; then \
458                 for options in '--index=10' '--primal --index=10'; do \
459                     for spec in 'random' 'bf' 'df' 'todd'; do \
460                         opt="--specialization=$$spec $$options"; \
461                         echo -n $$i $$opt; \
462                         ./test$(EXEEXT) $$opt < $$i || echo -n " NOT"; \
463                         echo " ok"; \
464                     done \
465                 done \
466             fi \
467         done
468 check-lw: test$(EXEEXT)
469         @for i in $(top_srcdir)/tests/lattice_width/*; do \
470             if test -f $$i; then \
471                 echo -n $$i; \
472                 ./test$(EXEEXT) < $$i || echo -n " NOT"; \
473                 echo " ok"; \
474             fi \
475         done
476 if HAVE_GLPK
477 check-lexmin: lexmin$(EXEEXT)
478         @for i in $(top_srcdir)/tests/lexmin/*; do \
479             if test -f $$i; then \
480                 for spec in 'random' 'bf' 'df'; do \
481                     opt="--specialization=$$spec"; \
482                     echo $$i $$opt; \
483                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
484                 done \
485             fi \
486         done
487 else
488 check-lexmin:
489 endif
491 version.h: @GIT_HEAD@
492         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@