blob: ebf41e5991bcb0ca592914eb0574a15b0aa1083e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# $NetBSD: buildlink.mk,v 1.5 2001/05/26 05:44:09 jlam Exp $
#
# This Makefile fragment is included by packages that use getopt_long().
#
# If getopt_long() is not present in the base system, then a dependency
# on devel/libgetopt is added, and the appropriate headers are linked
# into ${BUILDLINK_INCDIR} (${WRKDIR}/include).
#
# To use this Makefile fragment, simply:
#
# (1) Include this Makefile fragment in the package Makefile,
# (2) Optionally define BUILDLINK_INCDIR and BUILDLINK_LIBDIR,
# (3) Add ${BUILDLINK_TARGETS} to the prerequisite targets for pre-configure,
# (4) Add ${BUILDLINK_INCDIR} to the front of the C preprocessor's header
# search path.
# (5) Add ${BUILDLINK_LIBDIR} to the front of the linker's library search
# path.
.if !defined(GETOPT_BUILDLINK_MK)
GETOPT_BUILDLINK_MK= # defined
.if exists(/usr/include/getopt.h)
GETOPT_H= /usr/include/getopt.h
.else
GETOPT_H= ${LOCALBASE}/include/getopt.h
LIBGETOPT= ${LOCALBASE}/lib/libgetopt.a
LIBGETOPT+= ${LOCALBASE}/lib/libgetopt_pic.a
LIBGETOPT+= ${LOCALBASE}/lib/libgetopt.so*
DEPENDS+= libgetopt>=1.3:../../devel/libgetopt
.if defined(GNU_CONFIGURE)
CONFIGURE_ENV+= LIBS="${LIBS}"
LIBS+= -lgetopt
.endif
.endif
BUILDLINK_INCDIR?= ${WRKDIR}/include
BUILDLINK_LIBDIR?= ${WRKDIR}/lib
BUILDLINK_TARGETS+= link-getopt-headers
BUILDLINK_TARGETS+= link-getopt-libs
# This target links the headers into ${BUILDLINK_INCDIR}, which should
# be searched first by the C preprocessor.
#
link-getopt-headers:
@${ECHO} "Linking getopt headers into ${BUILDLINK_INCDIR}."
@${MKDIR} ${BUILDLINK_INCDIR}
@${RM} -f ${BUILDLINK_INCDIR}/getopt.h
@${LN} -sf ${GETOPT_H} ${BUILDLINK_INCDIR}/getopt.h
# This target links the libraries into ${BUILDLINK_LIBDIR}, which should
# be searched first by the linker.
#
link-getopt-libs:
@${ECHO} "Linking getopt libraries into ${BUILDLINK_LIBDIR}."
@${MKDIR} ${BUILDLINK_LIBDIR}
.if defined(LIBGETOPT)
@for lib in ${LIBGETOPT}; do \
dest=${BUILDLINK_LIBDIR}/`${BASENAME} $${lib}`; \
if [ -f $${lib} ]; then \
${RM} -f $${dest}; \
${LN} -sf $${lib} $${dest}; \
fi; \
done
.endif
.endif # GETOPT_BUILDLINK_MK
|