1 # $Id: libs.mk,v 1.3 2013/08/02 18:28:48 sjg Exp $
3 # @(#) Copyright (c) 2006, Simon J. Gerraty
5 # This file is provided in the hope that it will
6 # be of use. There is absolutely NO WARRANTY.
7 # Permission to copy, redistribute or otherwise
8 # use this file is hereby granted provided that
9 # the above copyright notice and this notice are
12 # Please send copies of changes and bug-fixes to:
20 # In meta mode, we can capture dependenices for _one_ of the progs.
21 # if makefile doesn't nominate one, we use the first.
22 .ifndef UPDATE_DEPENDFILE_LIB
23 UPDATE_DEPENDFILE_LIB = ${LIBS:[1]}
24 .export UPDATE_DEPENDFILE_LIB
28 # They may have asked us to build just one
29 .for t in ${LIBS:R:T:S,^lib,,}
52 .for v in ${LIB_VARS:O:u}
53 .if defined(${v}.${LIB}) || defined(${v}_${LIB})
54 $v += ${${v}_${LIB}:U${${v}.${LIB}}}
58 # for meta mode, there can be only one!
59 .if ${LIB} == ${UPDATE_DEPENDFILE_LIB:Uno}
60 UPDATE_DEPENDFILE ?= yes
62 UPDATE_DEPENDFILE ?= NO
64 # ensure that we don't clobber each other's dependencies
65 DEPENDFILE?= .depend.${LIB}
66 # lib.mk will do the rest
68 all: ${LIBS:S,^lib,,:@t@lib$t.a@} .MAKE
70 # We cannot capture dependencies for meta mode here
71 UPDATE_DEPENDFILE = NO
72 # nor can we safely run in parallel.
77 # handle being called [bsd.]libs.mk
78 .include <${.PARSEFILE:S,libs,lib,}>
81 # tell libs.mk we might want to install things
82 LIBS_TARGETS+= cleandepend cleandir cleanobj depend install
84 .for b in ${LIBS:R:T:S,^lib,,}
85 lib$b.a: ${SRCS} ${DPADD} ${SRCS_lib$b} ${DPADD_lib$b}
86 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b)
88 .for t in ${LIBS_TARGETS:O:u}
90 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b ${@:E})