1 # $NetBSD: builtin.mk,v 1.5 2008/10/29 20:50:16 christos Exp $
5 BUILTIN_FIND_FILES_VAR:= H_FILE BIN_FILE
6 BUILTIN_FIND_FILES.H_FILE= /usr/include/magic.h
7 BUILTIN_FIND_GREP.H_FILE= magic_file
8 BUILTIN_FIND_FILES.BIN_FILE= /bin/file /usr/bin/file
10 .include "../../mk/buildlink3/bsd.builtin.mk"
13 ### Determine if there is a built-in implementation of the package and
14 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
16 .if !defined(IS_BUILTIN.file)
18 . if empty(H_FILE:M__nonexistent__) && empty(H_FILE:M${LOCALBASE}/*)
21 . if empty(BIN_FILE:M__nonexistent__) && empty(BIN_FILE:M{LOCALBASE}/*)
22 BUILTIN_CMD.file= ${BIN_FILE}
24 BUILTIN_CMD.file= file
27 MAKEVARS+= IS_BUILTIN.file
29 .if !defined(BUILTIN_PKG.file) && !empty(IS_BUILTIN.file:M[yY][eE][sS])
30 BUILTIN_VERSION.file!= ${BUILTIN_CMD.file} --version 2>&1 | ${GREP} 'file-' | ${SED} 's/file-//'
31 BUILTIN_PKG.file= file-${BUILTIN_VERSION.file}
33 MAKEVARS+= BUILTIN_PKG.file
36 ### Determine whether we should use the built-in implementation if it
37 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
39 .if !defined(USE_BUILTIN.file)
40 . if ${PREFER.file} == "pkgsrc"
43 USE_BUILTIN.file= ${IS_BUILTIN.file}
44 . if defined(BUILTIN_PKG.file) && \
45 !empty(IS_BUILTIN.file:M[yY][eE][sS])
47 . for _dep_ in ${BUILDLINK_API_DEPENDS.file}
48 . if !empty(USE_BUILTIN.file:M[yY][eE][sS])
50 if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.file:Q}; then \
60 MAKEVARS+= USE_BUILTIN.file