summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-12 16:57:58 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-12 16:57:58 -0500
commit2afbbde4cb6aab900cdf41a27da126ccbc361e52 (patch)
tree535adc0208fb12a264d97572999dd4724b77dc9b
parent98f1ff740af109f99cd35ae44108f3fc5842a4d5 (diff)
downloaddimension-2afbbde4cb6aab900cdf41a27da126ccbc361e52.tar.xz
Implement profile-guided optimization builds.
-rw-r--r--Makefile.am12
-rw-r--r--configure.ac10
-rw-r--r--libdimension/Makefile.am9
-rw-r--r--tests/libdimension/Makefile.am14
4 files changed, 41 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index c1e3046..4746c81 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,18 @@ SUBDIRS = libdimension \
EXTRA_DIST = autogen.sh
+if PGO
+all-recursive:
+ cd $(top_builddir)/libdimension && $(MAKE) $(AM_MAKEFLAGS) libdimension-pgo.la
+ cd $(top_builddir)/tests/libdimension && $(MAKE) check
+ @for gcda in $(top_builddir)/tests/libdimension/pgo/.libs/*_pgo*.gcda; do \
+ mv $$gcda $${gcda/_pgo/}; \
+ done
+ cd $(top_builddir)/libdimension && $(MAKE) $(AM_MAKEFLAGS) libdimension.la
+ cd $(top_builddir)/dimension && $(MAKE) $(AM_MAKEFLAGS) all
+ cd $(top_builddir)/doc && $(MAKE) $(AM_MAKEFLAGS) all
+endif
+
bench: all-recursive
cd bench && $(MAKE) $(AM_MAKEFLAGS) bench
diff --git a/configure.ac b/configure.ac
index e81c598..2ce2001 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,10 +28,18 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
+dnl Profile-guided optimization (default disabled)
+AC_ARG_ENABLE([pgo],
+ [AS_HELP_STRING([--enable-pgo],
+ [Enable profile-guided optimization])],
+ [],
+ [enable_pgo=no])
+AM_CONDITIONAL([PGO], [test "$enable_pgo" != "no"])
+
dnl Timing library for benchmarks
AC_CHECK_LIB([sandglass], [sandglass_create],
[],
- [AC_MSG_WARN([libsandglass not found - benchmarking suite will not work correctly])])
+ [AC_MSG_WARN([libsandglass not found - benchmarking suite will not work])])
dnl Generate Makefiles
AC_CONFIG_MACRO_DIR([m4])
diff --git a/libdimension/Makefile.am b/libdimension/Makefile.am
index fb15f44..274cbf3 100644
--- a/libdimension/Makefile.am
+++ b/libdimension/Makefile.am
@@ -65,3 +65,12 @@ libdimension_la_SOURCES = $(nobase_include_HEADERS) \
texture.c
libdimension_la_LDFLAGS = -version-info 0:0:0
libdimension_la_LIBADD = -lm -lpthread -lpng -lGL
+
+if PGO
+EXTRA_LTLIBRARIES = libdimension-pgo.la
+libdimension_pgo_la_SOURCES = $(libdimension_la_SOURCES)
+libdimension_pgo_la_LIBADD = $(libdimension_la_LIBADD) -lgcov
+libdimension_pgo_la_CFLAGS = -fprofile-generate=./pgo
+
+libdimension_la_CFLAGS = -fprofile-correction -fprofile-use=$(top_builddir)/tests/libdimension/pgo
+endif
diff --git a/tests/libdimension/Makefile.am b/tests/libdimension/Makefile.am
index fe19ad4..50fa645 100644
--- a/tests/libdimension/Makefile.am
+++ b/tests/libdimension/Makefile.am
@@ -28,11 +28,19 @@ check_PROGRAMS = error-test \
TESTS = $(check_PROGRAMS)
XFAIL_TESTS = error-test
-.PHONY: clean-local-png-test
-clean-local: clean-local-png-test
+.PHONY: clean-local-tests clean-local-png-test
+clean-local: clean-local-tests clean-local-png-test
libdimension_tests_la_SOURCES = tests.c tests.h
-libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension.la
+
+if PGO
+libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension-pgo.la
+clean-local-tests:
+ rm -rf ./pgo
+else
+libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension.la
+clean-local-tests:
+endif
error_test_SOURCES = error.c
error_test_LDADD = libdimension-tests.la