[BACK]Return to buildlink.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / devel / zlib

Annotation of pkgsrc/devel/zlib/buildlink.mk, Revision 1.2

1.2     ! jlam        1: # $NetBSD: buildlink.mk,v 1.1 2001/05/26 16:30:18 jlam Exp $
1.1       jlam        2: #
                      3: # This Makefile fragment is included by packages that use zlib.
                      4: #
                      5: # To use this Makefile fragment, simply:
                      6: #
                      7: # (1) Optionally define ZLIB_REQD to the version of zlib desired.
                      8: # (2) Include this Makefile fragment in the package Makefile,
                      9: # (3) Optionally define BUILDLINK_INCDIR and BUILDLINK_LIBDIR,
1.2     ! jlam       10: # (4) Add ${BUILDLINK_INCDIR} to the front of the C preprocessor's header
1.1       jlam       11: #     search path, and
1.2     ! jlam       12: # (5) Add ${BUILDLINK_LIBDIR} to the front of the linker's library search
1.1       jlam       13: #     path.
                     14:
                     15: .if !defined(ZLIB_BUILDLINK_MK)
                     16: ZLIB_BUILDLINK_MK=     # defined
                     17:
                     18: ZLIB_REQD?=            1.1.3
                     19:
                     20: .if exists(/usr/include/zlib.h)
                     21: _NEED_ZLIB=            NO
                     22: .else
                     23: _NEED_ZLIB=            YES
                     24: .endif
                     25:
                     26: .if ${_NEED_ZLIB} == "YES"
                     27: DEPENDS+=              zlib>=${ZLIB_REQD}:../../devel/zlib
                     28: ZLIB_HEADERS=          ${LOCALBASE}/include/zconf.h
                     29: ZLIB_HEADERS=          ${LOCALBASE}/include/zlib.h
                     30: ZLIB_LIBS=             ${LOCALBASE}/lib/libz.*
                     31: .else
                     32: ZLIB_HEADERS=          /usr/include/zconf.h
                     33: ZLIB_HEADERS+=         /usr/include/zlib.h
                     34: ZLIB_LIBS=             /usr/lib/libz.*
                     35: .endif
                     36:
                     37: BUILDLINK_INCDIR?=     ${WRKDIR}/include
                     38: BUILDLINK_LIBDIR?=     ${WRKDIR}/lib
                     39:
1.2     ! jlam       40: ZLIB_BUILDLINK_COOKIE=         ${WRKDIR}/.zlib_buildlink_done
        !            41: ZLIB_BUILDLINK_TARGETS=                link-zlib-headers
        !            42: ZLIB_BUILDLINK_TARGETS+=       link-zlib-libs
        !            43: BUILDLINK_TARGETS+=            ${ZLIB_BUILDLINK_COOKIE}
        !            44:
        !            45: pre-configure: ${ZLIB_BUILDLINK_COOKIE}
        !            46:
        !            47: ${ZLIB_BUILDLINK_COOKIE}: ${ZLIB_BUILDLINK_TARGETS}
        !            48:        @${TOUCH} ${TOUCH_FLAGS} ${ZLIB_BUILDLINK_COOKIE}
1.1       jlam       49:
                     50: # This target links the headers into ${BUILDLINK_INCDIR}, which should
                     51: # be searched first by the C preprocessor.
                     52: #
                     53: link-zlib-headers:
                     54:        @${ECHO} "Linking zlib headers into ${BUILDLINK_INCDIR}."
                     55:        @${MKDIR} ${BUILDLINK_INCDIR}
                     56:        @for inc in ${ZLIB_HEADERS}; do                                 \
                     57:                dest=${BUILDLINK_INCDIR}/`${BASENAME} $${inc}`;         \
                     58:                if [ -f $${inc} ]; then                                 \
                     59:                        ${RM} -f $${dest};                              \
                     60:                        ${LN} -sf $${inc} $${dest};                     \
                     61:                fi;                                                     \
                     62:        done
                     63:
                     64: # This target links the libraries into ${BUILDLINK_LIBDIR}, which should
                     65: # be searched first by the linker.
                     66: #
                     67: link-zlib-libs:
                     68:        @${ECHO} "Linking zlib libraries into ${BUILDLINK_LIBDIR}."
                     69:        @${MKDIR} ${BUILDLINK_LIBDIR}
                     70:        @for lib in ${ZLIB_LIBS}; do                                    \
                     71:                dest=${BUILDLINK_LIBDIR}/`${BASENAME} $${lib}`;         \
                     72:                if [ -f $${lib} ]; then                                 \
                     73:                        ${RM} -f $${dest};                              \
                     74:                        ${LN} -sf $${lib} $${dest};                     \
                     75:                fi;                                                     \
                     76:        done
                     77:
                     78: .endif # ZLIB_BUILDLINK_MK

CVSweb <webmaster@jp.NetBSD.org>