aboutsummaryrefslogtreecommitdiff
path: root/mail/crm114
diff options
context:
space:
mode:
authorMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2009-04-22 01:27:20 +0000
committerMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2009-04-22 01:27:20 +0000
commitcbf8f70d65c2a772153cc3b825e7f7e75b2512e0 (patch)
tree0f57f6fa7dc8ece762a956058abe8c15a504a770 /mail/crm114
parent42bd109dcc6a026b9865eaf09ffaf35b376cc7ef (diff)
downloadports-cbf8f70d65c2a772153cc3b825e7f7e75b2512e0.tar.gz
ports-cbf8f70d65c2a772153cc3b825e7f7e75b2512e0.zip
Add WITH_PGO to build with Profile-Guided Optimization
PR: 133356 Approved by: maintainer
Notes
Notes: svn path=/head/; revision=232481
Diffstat (limited to 'mail/crm114')
-rw-r--r--mail/crm114/Makefile40
1 files changed, 37 insertions, 3 deletions
diff --git a/mail/crm114/Makefile b/mail/crm114/Makefile
index 21d8d3f1abcf..0cfce46f2b73 100644
--- a/mail/crm114/Makefile
+++ b/mail/crm114/Makefile
@@ -27,8 +27,8 @@ CRM114RELEASENAME=BlameSentansoken
USE_GETTEXT= yes
USE_ICONV= yes
-MAKE_ARGS= CC="${CC}" CFLAGS="${CFLAGS}" prefix="${PREFIX}" \
- LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \
+MAKE_ARGS= CC="${CC}" prefix="${PREFIX}" \
+ LIBS="${LIBS}" \
INSTALL_PROGRAM="${INSTALL_PROGRAM}"
CFLAGS+= -I${LOCALBASE}/include
@@ -43,11 +43,30 @@ CRM_FILES= mailfilter.crm mailfilter.cf mailreaver.crm mailtrainer.crm \
blacklist.mfp.example whitelist.mfp.example crm114-mode.el \
procmailrc.recipe
+OPTIONS= PGO "Enable Profile-Guided Optimization" off
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_PGO)
+MAKE_ARGS+= CFLAGS="${CFLAGS} -fprofile-use" \
+ LDFLAGS="${LDFLAGS} -fprofile-use"
+.else
+MAKE_ARGS+= CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}"
+.endif
+
post-patch:
@${REINPLACE_CMD} -Ee \
's,^((LD|C)FLAGS),#\1,;;s,^(prefix=),#\1,;;s,^(.*-install),#\1,' \
${WRKSRC}/Makefile
+.if defined(WITH_PGO)
+.if target(pre-build)
+.error Makefile error since pre-build target has already been defined
+.endif
+pre-build: pgo
+.endif
+
# Peter Jeremy recommended the use of b64decode and md5 20040302
post-install:
@${REINPLACE_CMD} -Ee 's|^(.*/openssl base64 -d/)|#\1|' \
@@ -78,4 +97,19 @@ post-install:
done
.endif
-.include <bsd.port.mk>
+.if defined(WITH_PGO)
+pgo: pgo-build pgo-run pgo-clean
+
+pgo-build:
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} CFLAGS="${CFLAGS} -fprofile-generate" LDFLAGS="${LDFLAGS} -fprofile-generate" ${ALL_TARGET})
+
+pgo-run:
+# Check everything to generate profiling information.
+# We will ignore any errors.
+ @-(cd ${BUILD_WRKSRC}; ${MAKE} megatest)
+
+pgo-clean:
+ @(cd ${BUILD_WRKSRC}; ${MAKE} clean)
+.endif # if defined(WITH_PGO)
+
+.include <bsd.port.post.mk>