Sync Mk with ports
[dports.git] / Mk / Uses / gperf.mk
1 # $FreeBSD$
2 #
3 # handle dependency on gperf
4 #
5 # Feature:      gperf
6 # Usage:        USES=gperf
7 #
8 # Take no arguments
9
10 .if !defined(_INCLUDE_USES_GPERF_MK)
11 _INCLUDE_USES_GPERF_MK= yes
12
13 .if !exists(/usr/bin/gperf)
14 BUILD_DEPENDS+= ${LOCALBASE}/bin/gperf:devel/gperf
15 GPERF=  ${LOCALBASE}/bin/gperf
16 .else
17 _GPERF_VERSION!=        /usr/bin/gperf --version | head -1 || true
18 _GPERF_MAJ_VERSION=     ${_GPERF_VERSION:M[0-9].[0-9].[0-9]:C/.*([0-9]).[0-9].[0-9].*/\1/g}
19
20 .if empty(_GPERF_MAJ_VERSION)
21 _GPERF_MAJ_VERSION=     0
22 .endif
23
24 .if ${_GPERF_MAJ_VERSION} < 3
25 BUILD_DEPENDS+= ${LOCALBASE}/bin/gperf:devel/gperf
26 GPERF=  ${LOCALBASE}/bin/gperf
27 .else
28 GPERF=  /usr/bin/gperf
29 .endif
30 .endif
31
32 CONFIGURE_ENV+= GPERF=${GPERF}
33 MAKE_ENV+=      GPERF=${GPERF}
34
35 .endif