libpthread: Add pthread_mutex_timedlock() reference to some manual pages.
[dragonfly.git] / contrib / bmake / mk / libs.mk
blob7f974bfa86b9060266586c822b63b81d77cf1a4a
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
10 # left intact.
12 # Please send copies of changes and bug-fixes to:
13 # sjg@crufty.net
16 .MAIN: all
18 .if defined(LIBS)
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
25 .endif
27 .ifndef LIB
28 # They may have asked us to build just one
29 .for t in ${LIBS:R:T:S,^lib,,}
30 .if make(lib$t)
31 LIB?= $t
32 lib$t: all
33 .endif
34 .endfor
35 .endif
37 .if defined(LIB)
38 # just one of many
39 LIB_VARS += \
40 LIBDIR \
41 CFLAGS \
42 COPTS \
43 CPPFLAGS \
44 CXXFLAGS \
45 DPADD \
46 DPLIBS \
47 LDADD \
48 LDFLAGS \
49 MAN \
50 SRCS
52 .for v in ${LIB_VARS:O:u}
53 .if defined(${v}.${LIB}) || defined(${v}_${LIB})
54 $v += ${${v}_${LIB}:U${${v}.${LIB}}}
55 .endif
56 .endfor
58 # for meta mode, there can be only one!
59 .if ${LIB} == ${UPDATE_DEPENDFILE_LIB:Uno}
60 UPDATE_DEPENDFILE ?= yes
61 .endif
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
67 .else
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.
73 .NOTPARALLEL:
74 .endif
75 .endif
77 # handle being called [bsd.]libs.mk
78 .include <${.PARSEFILE:S,libs,lib,}>
80 .ifndef 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}
89 $b.$t: .PHONY .MAKE
90 (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b ${@:E})
91 .endfor
92 .endfor
93 .endif