2 # $FreeBSD: textproc/libtre/Makefile 314782 2013-03-21 00:11:34Z jgh $
8 MASTER_SITES= http://laurikari.net/tre/ \
10 DISTNAME= tre-${PORTVERSION}
12 MAINTAINER= bf@FreeBSD.org
13 COMMENT= Lightweight fully POSIX compliant regexp matching library
16 LICENSE_FILE= ${WRKSRC}/LICENSE
21 USE_AUTOTOOLS= libtool
22 CONFIGURE_ARGS+= --enable-static
25 CPPFLAGS+= -I${LOCALBASE}/include
26 LDFLAGS+= -L${LOCALBASE}/lib
28 OPTIONS_DEFINE= NLS OPTIMIZED_CFLAGS PGO DOCS
29 PGO_DESC= Enable Profile-Guided Optimization
33 .include <bsd.port.pre.mk>
34 .include <bsd.port.options.mk>
36 .if ${PORT_OPTIONS:MNLS}
40 CONFIGURE_ARGS+= --disable-nls
41 PLIST_SUB+= NLS="@comment "
44 .if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
45 CFLAGS+= -Wuninitialized -ffast-math -finline-functions \
46 -fomit-frame-pointer -fexpensive-optimizations \
47 -fforce-mem -fforce-addr -O3
50 .if ${PORT_OPTIONS:MPGO}
51 LDFLAGS+= -fprofile-generate
52 CFLAGS+= -fprofile-generate
56 ${MV} ${WRKSRC}/doc/agrep.1.in ${WRKSRC}/doc/tre_agrep.1.in
57 ${REINPLACE_CMD} -e 's;agrep\.1;tre_agrep\.1;g' ${WRKSRC}/configure \
58 ${WRKSRC}/tre.spec.in ${WRKSRC}/doc/Makefile.in
59 ${REINPLACE_CMD} -e 's;agrep;tre_agrep;g' ${WRKSRC}/tests/agrep/*.ok
61 .if ${PORT_OPTIONS:MPGO}
63 .error Makefile error since pre-build target has already been defined
69 .if ${PORT_OPTIONS:MDOCS}
71 .for i in tre-api.html tre-syntax.html
72 ${INSTALL_DATA} ${WRKSRC}/doc/${i} ${DOCSDIR}
76 regression-test: build
77 @(cd ${BUILD_WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE} check )
79 .if ${PORT_OPTIONS:MPGO}
80 pgo: pgo-pre-build pgo-build pgo-run pgo-post-run pgo-clean
83 @${FIND} ${BUILD_WRKSRC} -type f -name Makefile -exec \
85 -e 's,^((C|LD)FLAGS[[:space:]]*=.*)-fprofile-generate,\1,' \
86 -e 's,^(CFLAGS[[:space:]]*=.*)-fprofile-use,\1,' \
87 -e 's,^((C|LD)FLAGS[[:space:]]*=.*)$$,\1 -fprofile-generate,' \
91 @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET})
94 # Check everything to generate profiling information.
95 @-(cd ${BUILD_WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE} check)
98 @${FIND} ${BUILD_WRKSRC} -type f -name Makefile -exec \
100 -e 's,^((C|LD)FLAGS[[:space:]]*=.*)-fprofile-generate,\1,' \
101 -e 's,^(CFLAGS[[:space:]]*=.*)-fprofile-use,\1,' \
102 -e 's,^(CFLAGS[[:space:]]*=.*)$$,\1 -fprofile-use,' \
104 @${REINPLACE_CMD} -E \
105 -e 's,-fprofile-generate,-fprofile-use,g' \
106 ${CONFIGURE_WRKSRC}/config.status \
107 ${CONFIGURE_WRKSRC}/libtool
108 @${REINPLACE_CMD} -E \
109 -e 's,-fprofile-generate,,g' \
110 ${BUILD_WRKSRC}/tre.pc
113 # Selectively clean some directories.
114 . for dir in src tests
115 @(cd ${BUILD_WRKSRC}/${dir}; ${SETENV} ${MAKE_ENV} ${MAKE} clean)
117 # Only remove some files from lib to preserve profiling information.
118 @${FIND} -E ${BUILD_WRKSRC}/lib -iregex ".*\.(a|la|lai|lo|o|so|so\..*)$$" \
120 .endif # if ${PORT_OPTIONS:MPGO}
122 .include <bsd.port.post.mk>