]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/bmake/mk/options.mk
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / bmake / mk / options.mk
1 # $Id: options.mk,v 1.7 2013/04/17 20:32:38 sjg Exp $
2 #
3 #       @(#) Copyright (c) 2012, Simon J. Gerraty
4 #
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. 
11 #      
12 #       Please send copies of changes and bug-fixes to:
13 #       sjg@crufty.net
14 #
15
16 # Inspired by FreeBSD bsd.own.mk, but intentionally simpler and more flexible.
17
18 # Options are normally listed in either OPTIONS_DEFAULT_{YES,NO}
19 # We convert these to ${OPTION}/{yes,no} in OPTIONS_DEFAULT_VALUES.
20 # We add the OPTIONS_DEFAULT_NO first so they take precedence.
21 # This allows override of an OPTIONS_DEFAULT_YES by adding it to
22 # OPTIONS_DEFAULT_NO or adding ${OPTION}/no to OPTIONS_DEFAULT_VALUES.
23 # An OPTIONS_DEFAULT_NO option can only be overridden by putting
24 # ${OPTION}/yes in OPTIONS_DEFAULT_VALUES.
25 # A makefile may set NO_* (or NO*) to indicate it cannot do something.
26 # User sets WITH_* and WITHOUT_* to indicate what they want.
27 # We set ${OPTION_PREFIX:UMK_}* which is then all we need care about.
28 OPTIONS_DEFAULT_VALUES += \
29         ${OPTIONS_DEFAULT_NO:O:u:S,$,/no,} \
30         ${OPTIONS_DEFAULT_YES:O:u:S,$,/yes,}
31
32 OPTION_PREFIX ?= MK_
33 .for o in ${OPTIONS_DEFAULT_VALUES:M*/*}
34 .if ${o:T:tl} == "no"
35 .if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
36 ${OPTION_PREFIX}${o:H} ?= yes
37 .else
38 ${OPTION_PREFIX}${o:H} ?= no
39 .endif
40 .else
41 .if defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
42 ${OPTION_PREFIX}${o:H} ?= no
43 .else
44 ${OPTION_PREFIX}${o:H} ?= yes
45 .endif
46 .endif
47 .endfor
48
49 # OPTIONS_DEFAULT_DEPENDENT += FOO_UTILS/FOO
50 # if neither WITH[OUT]_FOO_UTILS is set, use value of ${OPTION_PREFIX}FOO
51 .for o in ${OPTIONS_DEFAULT_DEPENDENT:M*/*:O:u}
52 .if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
53 ${OPTION_PREFIX}${o:H} ?= yes
54 .elif defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
55 ${OPTION_PREFIX}${o:H} ?= no
56 .else
57 ${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}}
58 .endif
59 .endfor