View | Details | Raw Unified | Return to bug 133302
Collapse All | Expand All

(-)Makefile (-2 / +61 lines)
Lines 21-34 Link Here
21
USE_GNOME=	gnomehack gnometarget pkgconfig
21
USE_GNOME=	gnomehack gnometarget pkgconfig
22
USE_AUTOTOOLS=	libtool:15
22
USE_AUTOTOOLS=	libtool:15
23
CONFIGURE_ARGS+=	--enable-static
23
CONFIGURE_ARGS+=	--enable-static
24
CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
24
CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}"
25
USE_LDCONFIG=	yes
25
USE_LDCONFIG=	yes
26
26
27
CPPFLAGS+=	-I${LOCALBASE}/include
27
CPPFLAGS+=	-I${LOCALBASE}/include
28
LDFLAGS+=	-L${LOCALBASE}/lib
28
LDFLAGS+=	-L${LOCALBASE}/lib
29
29
30
OPTIONS=	NLS "native language support" off \
30
OPTIONS=	NLS "native language support" off \
31
		OPTIMIZED_CFLAGS "append optimization flags to CFLAGS" off
31
		OPTIMIZED_CFLAGS "append optimization flags to CFLAGS" off \
32
		PGO "Enable Profile-Guided Optimization" off
32
33
33
MAN1=	tre_agrep.1
34
MAN1=	tre_agrep.1
34
35
Lines 48-59 Link Here
48
		-fforce-mem -fforce-addr -O3
49
		-fforce-mem -fforce-addr -O3
49
.endif
50
.endif
50
51
52
.if defined(WITH_PGO)
53
CONFIGURE_ENV+=	CFLAGS="${CFLAGS} -fprofile-generate" \
54
		LDFLAGS="${LDFLAGS} -fprofile-generate"
55
.else
56
CONFIGURE_ENV+=	CFLAGS="${CFLAGS}" \
57
		LDFLAGS="${LDFLAGS}"
58
.endif
59
51
post-patch:
60
post-patch:
52
	${MV} ${WRKSRC}/doc/agrep.1.in ${WRKSRC}/doc/tre_agrep.1.in
61
	${MV} ${WRKSRC}/doc/agrep.1.in ${WRKSRC}/doc/tre_agrep.1.in
53
	${REINPLACE_CMD} -e 's;agrep\.1;tre_agrep\.1;g' ${WRKSRC}/configure \
62
	${REINPLACE_CMD} -e 's;agrep\.1;tre_agrep\.1;g' ${WRKSRC}/configure \
54
	${WRKSRC}/tre.spec.in ${WRKSRC}/doc/Makefile.in
63
	${WRKSRC}/tre.spec.in ${WRKSRC}/doc/Makefile.in
55
	${REINPLACE_CMD} -e 's;agrep;tre_agrep;g' ${WRKSRC}/tests/agrep/*.ok
64
	${REINPLACE_CMD} -e 's;agrep;tre_agrep;g' ${WRKSRC}/tests/agrep/*.ok
56
65
66
.if defined(WITH_PGO)
67
.if target(pre-build)
68
.error Makefile error since pre-build target has already been defined
69
.endif
70
pre-build: pgo
71
.endif
72
57
post-install:
73
post-install:
58
.if !defined(NOPORTDOCS)
74
.if !defined(NOPORTDOCS)
59
	${MKDIR} ${DOCSDIR}
75
	${MKDIR} ${DOCSDIR}
Lines 65-68 Link Here
65
regression-test: build
81
regression-test: build
66
	@(cd ${BUILD_WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE} check )
82
	@(cd ${BUILD_WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE} check )
67
83
84
.if defined(WITH_PGO)
85
pgo: pgo-pre-build pgo-build pgo-run pgo-post-run pgo-clean
86
87
pgo-pre-build:
88
	@${FIND} ${BUILD_WRKSRC} -type f -name Makefile -exec \
89
		${REINPLACE_CMD} -E \
90
			-e 's,^((C|LD)FLAGS[[:space:]]*=.*)-fprofile-generate,\1,' \
91
			-e 's,^(CFLAGS[[:space:]]*=.*)-fprofile-use,\1,' \
92
			-e 's,^((C|LD)FLAGS[[:space:]]*=.*)$$,\1 -fprofile-generate,' \
93
			{} \;
94
95
pgo-build:
96
	@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET})
97
98
pgo-run:
99
# Check everything to generate profiling information.
100
	@-(cd ${BUILD_WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE} check)
101
102
pgo-post-run:
103
	@${FIND} ${BUILD_WRKSRC} -type f -name Makefile -exec \
104
		${REINPLACE_CMD} -E \
105
			-e 's,^((C|LD)FLAGS[[:space:]]*=.*)-fprofile-generate,\1,' \
106
			-e 's,^(CFLAGS[[:space:]]*=.*)-fprofile-use,\1,' \
107
			-e 's,^(CFLAGS[[:space:]]*=.*)$$,\1 -fprofile-use,' \
108
			{} \;
109
	@${REINPLACE_CMD} -E \
110
		-e 's,-fprofile-generate,-fprofile-use,g' \
111
		${CONFIGURE_WRKSRC}/config.status \
112
		${CONFIGURE_WRKSRC}/libtool
113
	@${REINPLACE_CMD} -E \
114
		-e 's,-fprofile-generate,,g' \
115
		${BUILD_WRKSRC}/tre.pc
116
117
pgo-clean:
118
# Selectively clean some directories.
119
. for dir in gnulib src tests
120
	@(cd ${BUILD_WRKSRC}/${dir}; ${SETENV} ${MAKE_ENV} ${MAKE} clean)
121
. endfor
122
# Only remove some files from lib to preserve profiling information.
123
	@${FIND} -E ${BUILD_WRKSRC}/lib -iregex ".*\.(a|la|lai|lo|o|so|so\..*)$$" \
124
		-exec ${RM} -f {} \;
125
.endif # if defined(WITH_PGO)
126
68
.include <bsd.port.post.mk>
127
.include <bsd.port.post.mk>

Return to bug 133302