pkgsrc/devel/ncurses/buildlink3.mk
joerg 2d1ba244e9 Simply and speed up buildlink3.mk files and processing.
This changes the buildlink3.mk files to use an include guard for the
recursive include. The use of BUILDLINK_DEPTH, BUILDLINK_DEPENDS,
BUILDLINK_PACKAGES and BUILDLINK_ORDER is handled by a single new
variable BUILDLINK_TREE. Each buildlink3.mk file adds a pair of
enter/exit marker, which can be used to reconstruct the tree and
to determine first level includes. Avoiding := for large variables
(BUILDLINK_ORDER) speeds up parse time as += has linear complexity.
The include guard reduces system time by avoiding reading files over and
over again. For complex packages this reduces both %user and %sys time to
half of the former time.
2009-03-20 19:23:50 +00:00

33 lines
1 KiB
Makefile

# $NetBSD: buildlink3.mk,v 1.33 2009/03/20 19:24:24 joerg Exp $
BUILDLINK_TREE+= ncurses
.if !defined(NCURSES_BUILDLINK3_MK)
NCURSES_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.ncurses+= ncurses>=5.3nb1
BUILDLINK_ABI_DEPENDS.ncurses+= ncurses>=5.4nb1
BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses
BUILDLINK_LIBNAME.ncurses= ncurses
BUILDLINK_LDADD.ncurses?= ${BUILDLINK_LIBNAME.ncurses:S/^/-l/:S/^-l$//}
# Many packages expect the ncurses headers and libraries to be usable as
# <curses.h> and -lcurses.
#
BUILDLINK_TARGETS+= buildlink-ncurses-curses-h
BUILDLINK_TRANSFORM+= l:curses:${BUILDLINK_LIBNAME.ncurses}
.PHONY: buildlink-ncurses-curses-h
buildlink-ncurses-curses-h:
${RUN} \
src=${BUILDLINK_PREFIX.ncurses:Q}"/include/ncurses.h"; \
dest=${BUILDLINK_DIR:Q}"/include/curses.h"; \
if ${TEST} ! -f "$$dest" -a -f "$$src"; then \
${ECHO_BUILDLINK_MSG} "Linking curses.h -> ncurses.h."; \
${MKDIR} `${DIRNAME} "$$dest"`; \
${LN} -s "$$src" "$$dest"; \
fi
.endif # NCURSES_BUILDLINK3_MK
BUILDLINK_TREE+= -ncurses