summaryrefslogtreecommitdiff
path: root/devel/libgetopt/Makefile.getopt
blob: a4a2e5b197106b6a9c766ae498649e4e792f9227 (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
# $NetBSD: Makefile.getopt,v 1.2 2001/05/16 04:37:46 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 ${WRKINCDIR} (${WRKSRC}/include).
#
# To use this Makefile, simply include this Makefile fragment in the
# package Makefile, optionally define WRKINCDIR, add
# link-getopt-headers to the prerequisite targets for pre-configure,
# and add ${WRKINCDIR} to the compiler's header search path.
#
# You may need to add LIBS to CONFIGURE_ENV if you the packages uses a GNU
# configure script.

.if exists(/usr/include/getopt.h)
GETOPT_H=	/usr/include/getopt.h
.else
GETOPT_H=	${LOCALBASE}/include/getopt.h
DEPENDS+=	libgetopt>=1.3:../../devel/libgetopt
LIBS+=		-lgetopt
.endif

WRKINCDIR?=	${WRKDIR}/include

# This target links the getopt header into ${WRKINCDIR}, which should be
# searched first by the C preprocessor.
# 
link-getopt-headers:
	${MKDIR} -p ${WRKINCDIR}
	${RM} -f ${WRKINCDIR}/getopt.h
	${LN} -sf ${GETOPT_H} ${WRKINCDIR}