summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-13 15:06:29 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-13 15:06:29 -0500
commitd8c8bf19aa2cce3257f3fc28c384d5fbf798ad77 (patch)
tree888ea6cedbbed8d62d06d0e8afd8bdc1a9e3395a
parent529f40fc3f0f5f4cc7726be8f59e28e0da161e49 (diff)
downloaddimension-d8c8bf19aa2cce3257f3fc28c384d5fbf798ad77.tar.xz
PGO build improvements.
-rw-r--r--Makefile.am26
-rw-r--r--configure.ac2
-rw-r--r--libdimension/Makefile.am16
-rw-r--r--tests/libdimension/Makefile.am7
4 files changed, 29 insertions, 22 deletions
diff --git a/Makefile.am b/Makefile.am
index 0328b10..9ba1193 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,20 +27,20 @@ SUBDIRS = libdimension \
EXTRA_DIST = autogen.sh
if PGO
-all-recursive:
- @if ! ls $(top_builddir)/tests/libdimension/pgo/.libs/*.gcda >/dev/null; then \
- (cd $(top_builddir)/libdimension && $(MAKE) $(AM_MAKEFLAGS) libdimension-pgo.la) && \
- (cd $(top_builddir)/tests/libdimension && $(MAKE) check) && \
- for gcda in $$(ls $(top_builddir)/tests/libdimension/pgo/.libs/*_pgo*.gcda); do \
- mv $$gcda $${gcda/_pgo/}; \
- done \
+
+.PHONY: pgo bench
+pgo:
+ @if [ ! -d $(top_builddir)/libdimension/pgo/.libs ] || [ -z "$$(ls $(top_builddir)/libdimension/pgo/.libs/*.gcda 2>/dev/null)" ]; then \
+ $(MAKE) $(AM_MAKEFLAGS) -C libdimension libdimension-pgo.la && \
+ $(MAKE) -j1 -C tests/libdimension check; \
fi
- 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
+ @rename _pgo_la _la $$(find $(top_builddir)/libdimension/pgo/.libs/)
-bench: all
- cd bench && $(MAKE) $(AM_MAKEFLAGS) bench
+all-recursive check-recursive install-recursive installcheck-recursive distdir: pgo
+else ## PGO
.PHONY: bench
+endif ## PGO
+
+bench: all-recursive
+ cd bench && $(MAKE) $(AM_MAKEFLAGS) bench
diff --git a/configure.ac b/configure.ac
index 2ce2001..d1f03f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ AC_PROG_LIBTOOL
dnl Profile-guided optimization (default disabled)
AC_ARG_ENABLE([pgo],
[AS_HELP_STRING([--enable-pgo],
- [Enable profile-guided optimization])],
+ [Enable profile-guided optimization [default=no]])],
[],
[enable_pgo=no])
AM_CONDITIONAL([PGO], [test "$enable_pgo" != "no"])
diff --git a/libdimension/Makefile.am b/libdimension/Makefile.am
index 274cbf3..e67f09e 100644
--- a/libdimension/Makefile.am
+++ b/libdimension/Makefile.am
@@ -67,10 +67,20 @@ libdimension_la_LDFLAGS = -version-info 0:0:0
libdimension_la_LIBADD = -lm -lpthread -lpng -lGL
if PGO
-EXTRA_LTLIBRARIES = libdimension-pgo.la
+
+noinst_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_pgo_la_CFLAGS = -fprofile-generate=$$(readlink -f $(builddir))/pgo
+
+libdimension_la_CFLAGS = -fprofile-correction -fprofile-use=./pgo
+
+all-local: libdimension.la
+ @for Plo in .deps/libdimension_la*.Plo; do \
+ [ -f "pgo/.libs/$$(basename $$Plo .Plo).gcda" ] && sed -ri 's|^(libdimension_la-.*).lo: ([^ ])|\1.lo: pgo/.libs/\1.gcda \2|g' "$$Plo"; \
+ true; \
+ done
-libdimension_la_CFLAGS = -fprofile-correction -fprofile-use=$(top_builddir)/tests/libdimension/pgo
+clean-local:
+ rm -rf pgo
endif
diff --git a/tests/libdimension/Makefile.am b/tests/libdimension/Makefile.am
index 50fa645..7b238da 100644
--- a/tests/libdimension/Makefile.am
+++ b/tests/libdimension/Makefile.am
@@ -28,18 +28,15 @@ check_PROGRAMS = error-test \
TESTS = $(check_PROGRAMS)
XFAIL_TESTS = error-test
-.PHONY: clean-local-tests clean-local-png-test
-clean-local: clean-local-tests clean-local-png-test
+.PHONY: clean-local-png-test
+clean-local: clean-local-png-test
libdimension_tests_la_SOURCES = tests.c tests.h
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