aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlioux <lioux@FreeBSD.org>2009-04-22 09:27:20 +0800
committerlioux <lioux@FreeBSD.org>2009-04-22 09:27:20 +0800
commita2e4a124c003bd0b1b216f207d448dcdd59d0b3d (patch)
treeb17ce86c4ee3b7a7823bc9b891ff538dc1ed52e6
parent8ffa263ca06bbcc3fb9657d00ba8ad1c02d723c3 (diff)
downloadfreebsd-ports-gnome-a2e4a124c003bd0b1b216f207d448dcdd59d0b3d.tar.gz
freebsd-ports-gnome-a2e4a124c003bd0b1b216f207d448dcdd59d0b3d.tar.zst
freebsd-ports-gnome-a2e4a124c003bd0b1b216f207d448dcdd59d0b3d.zip
Add WITH_PGO to build with Profile-Guided Optimization
PR: 133356 Approved by: maintainer
-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>