summaryrefslogtreecommitdiff
path: root/devel/libgetopt
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-05-15 19:18:14 +0000
committerjlam <jlam@pkgsrc.org>2001-05-15 19:18:14 +0000
commit3650011653bcd6d0aff19ae1971187a06b861277 (patch)
treeb5c2f7dde6540de9f9928414dae023a8f47e3096 /devel/libgetopt
parent2ae7288d4c326c820ff0fae29cb847edda940e5e (diff)
downloadpkgsrc-3650011653bcd6d0aff19ae1971187a06b861277.tar.gz
Move this file from databases/postgresql/Makefile.getopt to be usable by
more packages.
Diffstat (limited to 'devel/libgetopt')
-rw-r--r--devel/libgetopt/Makefile.getopt30
1 files changed, 30 insertions, 0 deletions
diff --git a/devel/libgetopt/Makefile.getopt b/devel/libgetopt/Makefile.getopt
new file mode 100644
index 00000000000..21c7cbbcad5
--- /dev/null
+++ b/devel/libgetopt/Makefile.getopt
@@ -0,0 +1,30 @@
+# $NetBSD: Makefile.getopt,v 1.1 2001/05/15 19:18:14 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.
+
+.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}/include, which is
+# searched first by the C preprocessor.
+#
+link-getopt-headers:
+ ${MKDIR} -p ${WRKINCDIR}
+ ${RM} -f ${WRKINCDIR}/getopt.h
+ ${LN} -sf ${GETOPT_H} ${WRKINCDIR}