bsd.own.mk revision 229319
1# $FreeBSD: head/share/mk/bsd.own.mk 229319 2012-01-02 21:57:58Z rwatson $
2#
3# The include file <bsd.own.mk> set common variables for owner,
4# group, mode, and directories. Defaults are in brackets.
5#
6#
7# +++ variables +++
8#
9# DESTDIR	Change the tree where the file gets installed. [not set]
10#
11# DISTDIR	Change the tree where the file for a distribution
12# 		gets installed (see /usr/src/release/Makefile). [not set]
13#
14# COMPRESS_CMD	Program to compress documents.
15#		Output is to stdout. [gzip -cn]
16#
17# COMPRESS_EXT	File name extension of ${COMPRESS_CMD} command. [.gz]
18#
19# BINOWN	Binary owner. [root]
20#
21# BINGRP	Binary group. [wheel]
22#
23# BINMODE	Binary mode. [555]
24#
25# NOBINMODE	Mode for non-executable files. [444]
26#
27# LIBDIR	Base path for libraries. [/usr/lib]
28#
29# LIBCOMPATDIR	Base path for compat libraries. [/usr/lib/compat]
30#
31# LIBDATADIR	Base path for misc. utility data files. [/usr/libdata]
32#
33# LIBEXECDIR	Base path for system daemons and utilities. [/usr/libexec]
34#
35# LINTLIBDIR	Base path for lint libraries. [/usr/libdata/lint]
36#
37# SHLIBDIR	Base path for shared libraries. [${LIBDIR}]
38#
39# LIBOWN	Library owner. [${BINOWN}]
40#
41# LIBGRP	Library group. [${BINGRP}]
42#
43# LIBMODE	Library mode. [${NOBINMODE}]
44#
45#
46# KMODDIR	Base path for loadable kernel modules
47#		(see kld(4)). [/boot/kernel]
48#
49# KMODOWN	Kernel and KLD owner. [${BINOWN}]
50#
51# KMODGRP	Kernel and KLD group. [${BINGRP}]
52#
53# KMODMODE	KLD mode. [${BINMODE}]
54#
55#
56# SHAREDIR	Base path for architecture-independent ascii
57#		text files. [/usr/share]
58#
59# SHAREOWN	ASCII text file owner. [root]
60#
61# SHAREGRP	ASCII text file group. [wheel]
62#
63# SHAREMODE	ASCII text file mode. [${NOBINMODE}]
64#
65#
66# CONFDIR	Base path for configuration files. [/etc]
67#
68# CONFOWN	Configuration file owner. [root]
69#
70# CONFGRP	Configuration file group. [wheel]
71#
72# CONFMODE	Configuration file mode. [644]
73#
74#
75# DOCDIR	Base path for system documentation (e.g. PSD, USD,
76#		handbook, FAQ etc.). [${SHAREDIR}/doc]
77#
78# DOCOWN	Documentation owner. [${SHAREOWN}]
79#
80# DOCGRP	Documentation group. [${SHAREGRP}]
81#
82# DOCMODE	Documentation mode. [${NOBINMODE}]
83#
84#
85# INFODIR	Base path for GNU's hypertext system
86#		called Info (see info(1)). [${SHAREDIR}/info]
87#
88# INFOOWN	Info owner. [${SHAREOWN}]
89#
90# INFOGRP	Info group. [${SHAREGRP}]
91#
92# INFOMODE	Info mode. [${NOBINMODE}]
93#
94#
95# MANDIR	Base path for manual installation. [${SHAREDIR}/man/man]
96#
97# MANOWN	Manual owner. [${SHAREOWN}]
98#
99# MANGRP	Manual group. [${SHAREGRP}]
100#
101# MANMODE	Manual mode. [${NOBINMODE}]
102#
103#
104# NLSDIR	Base path for National Language Support files
105#		installation. [${SHAREDIR}/nls]
106#
107# NLSOWN	National Language Support files owner. [${SHAREOWN}]
108#
109# NLSGRP	National Language Support files group. [${SHAREGRP}]
110#
111# NLSMODE	National Language Support files mode. [${NOBINMODE}]
112#
113# INCLUDEDIR	Base path for standard C include files [/usr/include]
114
115.if !target(__<bsd.own.mk>__)
116__<bsd.own.mk>__:
117
118.if !defined(_WITHOUT_SRCCONF)
119SRCCONF?=	/etc/src.conf
120.if exists(${SRCCONF})
121.include "${SRCCONF}"
122.endif
123.endif
124
125# Binaries
126BINOWN?=	root
127BINGRP?=	wheel
128BINMODE?=	555
129NOBINMODE?=	444
130
131.if defined(MODULES_WITH_WORLD)
132KMODDIR?=	/boot/modules
133.else
134KMODDIR?=	/boot/kernel
135.endif
136KMODOWN?=	${BINOWN}
137KMODGRP?=	${BINGRP}
138KMODMODE?=	${BINMODE}
139
140LIBDIR?=	/usr/lib
141LIBCOMPATDIR?=	/usr/lib/compat
142LIBDATADIR?=	/usr/libdata
143LIBEXECDIR?=	/usr/libexec
144LINTLIBDIR?=	/usr/libdata/lint
145SHLIBDIR?=	${LIBDIR}
146LIBOWN?=	${BINOWN}
147LIBGRP?=	${BINGRP}
148LIBMODE?=	${NOBINMODE}
149
150
151# Share files
152SHAREDIR?=	/usr/share
153SHAREOWN?=	root
154SHAREGRP?=	wheel
155SHAREMODE?=	${NOBINMODE}
156
157CONFDIR?=	/etc
158CONFOWN?=	root
159CONFGRP?=	wheel
160CONFMODE?=	644
161
162MANDIR?=	${SHAREDIR}/man/man
163MANOWN?=	${SHAREOWN}
164MANGRP?=	${SHAREGRP}
165MANMODE?=	${NOBINMODE}
166
167DOCDIR?=	${SHAREDIR}/doc
168DOCOWN?=	${SHAREOWN}
169DOCGRP?=	${SHAREGRP}
170DOCMODE?=	${NOBINMODE}
171
172INFODIR?=	${SHAREDIR}/info
173INFOOWN?=	${SHAREOWN}
174INFOGRP?=	${SHAREGRP}
175INFOMODE?=	${NOBINMODE}
176
177NLSDIR?=	${SHAREDIR}/nls
178NLSOWN?=	${SHAREOWN}
179NLSGRP?=	${SHAREGRP}
180NLSMODE?=	${NOBINMODE}
181
182INCLUDEDIR?=	/usr/include
183
184# Common variables
185.if !defined(DEBUG_FLAGS)
186STRIP?=		-s
187.endif
188
189COMPRESS_CMD?=	gzip -cn
190COMPRESS_EXT?=	.gz
191
192.if !defined(_WITHOUT_SRCCONF)
193#
194# Define MK_* variables (which are either "yes" or "no") for users
195# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
196# make(1) environment.
197# These should be tested with `== "no"' or `!= "no"' in makefiles.
198# The NO_* variables should only be set by makefiles.
199#
200
201#
202# Supported NO_* options (if defined, MK_* will be forced to "no",
203# regardless of user's setting).
204#
205.for var in \
206    CTF \
207    INSTALLLIB \
208    MAN \
209    PROFILE
210.if defined(NO_${var})
211.if defined(WITH_${var})
212.undef WITH_${var}
213.endif
214WITHOUT_${var}=
215.endif
216.endfor
217
218#
219# Compat NO_* options (same as above, except their use is deprecated).
220#
221.if !defined(BURN_BRIDGES)
222.for var in \
223    ACPI \
224    ATM \
225    AUDIT \
226    AUTHPF \
227    BIND \
228    BIND_DNSSEC \
229    BIND_ETC \
230    BIND_LIBS_LWRES \
231    BIND_MTREE \
232    BIND_NAMED \
233    BIND_UTILS \
234    BLUETOOTH \
235    BOOT \
236    CALENDAR \
237    CPP \
238    CRYPT \
239    CVS \
240    CXX \
241    DICT \
242    DYNAMICROOT \
243    EXAMPLES \
244    FORTH \
245    FP_LIBC \
246    GAMES \
247    GCOV \
248    GDB \
249    GNU \
250    GPIB \
251    GROFF \
252    HTML \
253    INET6 \
254    INFO \
255    IPFILTER \
256    IPX \
257    KERBEROS \
258    LIB32 \
259    LIBPTHREAD \
260    LIBTHR \
261    LOCALES \
262    LPR \
263    MAILWRAPPER \
264    NETCAT \
265    NIS \
266    NLS \
267    NLS_CATALOGS \
268    NS_CACHING \
269    OPENSSH \
270    OPENSSL \
271    PAM \
272    PF \
273    RCMDS \
274    RCS \
275    RESCUE \
276    SENDMAIL \
277    SETUID_LOGIN \
278    SHAREDOCS \
279    SYSCONS \
280    TCSH \
281    TOOLCHAIN \
282    USB \
283    WPA_SUPPLICANT_EAPOL
284.if defined(NO_${var})
285#.warning NO_${var} is deprecated in favour of WITHOUT_${var}=
286WITHOUT_${var}=
287.endif
288.endfor
289.endif # !defined(BURN_BRIDGES)
290
291#
292# Older-style variables that enabled behaviour when set.
293#
294.if defined(YES_HESIOD)
295WITH_HESIOD=
296.endif
297.if defined(MAKE_IDEA)
298WITH_IDEA=
299.endif
300
301__DEFAULT_YES_OPTIONS = \
302    ACCT \
303    ACPI \
304    AMD \
305    APM \
306    ASSERT_DEBUG \
307    AT \
308    ATM \
309    AUDIT \
310    AUTHPF \
311    BIND \
312    BIND_DNSSEC \
313    BIND_ETC \
314    BIND_LIBS_LWRES \
315    BIND_MTREE \
316    BIND_NAMED \
317    BIND_UTILS \
318    BINUTILS \
319    BLUETOOTH \
320    BOOT \
321    BSD_CPIO \
322    BSNMP \
323    BZIP2 \
324    CALENDAR \
325    CAPSICUM \
326    CDDL \
327    CPP \
328    CRYPT \
329    CTM \
330    CVS \
331    CXX \
332    DICT \
333    DYNAMICROOT \
334    EXAMPLES \
335    FLOPPY \
336    FORTH \
337    FP_LIBC \
338    FREEBSD_UPDATE \
339    GAMES \
340    GCC \
341    GCOV \
342    GDB \
343    GNU \
344    GPIB \
345    GPIO \
346    GROFF \
347    HTML \
348    INET \
349    INET6 \
350    INFO \
351    INSTALLLIB \
352    IPFILTER \
353    IPFW \
354    IPX \
355    JAIL \
356    KERBEROS \
357    KERNEL_SYMBOLS \
358    KVM \
359    LEGACY_CONSOLE \
360    LIB32 \
361    LIBPTHREAD \
362    LIBTHR \
363    LOCALES \
364    LOCATE \
365    LPR \
366    MAIL \
367    MAILWRAPPER \
368    MAKE \
369    MAN \
370    NCP \
371    NDIS \
372    NETCAT \
373    NETGRAPH \
374    NIS \
375    NLS \
376    NLS_CATALOGS \
377    NS_CACHING \
378    NTP \
379    OPENSSH \
380    OPENSSL \
381    PAM \
382    PF \
383    PKGTOOLS \
384    PMC \
385    PORTSNAP \
386    PPP \
387    PROFILE \
388    QUOTAS \
389    RCMDS \
390    RCS \
391    RESCUE \
392    ROUTED \
393    SENDMAIL \
394    SETUID_LOGIN \
395    SHAREDOCS \
396    SSP \
397    SYSINSTALL \
398    SYMVER \
399    SYSCONS \
400    TCSH \
401    TELNET \
402    TEXTPROC \
403    TOOLCHAIN \
404    USB \
405    UTMPX \
406    WIRELESS \
407    WPA_SUPPLICANT_EAPOL \
408    ZFS \
409    ZONEINFO
410
411__DEFAULT_NO_OPTIONS = \
412    BSD_GREP \
413    BIND_IDN \
414    BIND_LARGE_FILE \
415    BIND_LIBS \
416    BIND_SIGCHASE \
417    BIND_XML \
418    CTF \
419    HESIOD \
420    ICONV \
421    IDEA \
422    LIBCPLUSPLUS \
423    OFED
424
425#
426# Default behaviour of some options depends on the architecture.  Unfortunately
427# this means that we have to test TARGET_ARCH (the buildworld case) as well
428# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
429# used at all in bsd.*.mk, but we have to make an exception here if we want
430# to allow defaults for some things like clang and fdt to vary by target
431# architecture.
432#
433.if defined(TARGET_ARCH)
434__T=${TARGET_ARCH}
435.else
436__T=${MACHINE_ARCH}
437.endif
438# Clang is only for x86 and powerpc right now, by default.
439.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
440__DEFAULT_YES_OPTIONS+=CLANG
441.else
442__DEFAULT_NO_OPTIONS+=CLANG
443.endif
444# FDT is needed only for arm, mips and powerpc
445.if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
446__DEFAULT_YES_OPTIONS+=FDT
447.else
448__DEFAULT_NO_OPTIONS+=FDT
449.endif
450.undef __T
451
452#
453# MK_* options which default to "yes".
454#
455.for var in ${__DEFAULT_YES_OPTIONS}
456.if defined(WITH_${var}) && defined(WITHOUT_${var})
457.error WITH_${var} and WITHOUT_${var} can't both be set.
458.endif
459.if defined(MK_${var})
460.error MK_${var} can't be set by a user.
461.endif
462.if defined(WITHOUT_${var})
463MK_${var}:=	no
464.else
465MK_${var}:=	yes
466.endif
467.endfor
468.undef __DEFAULT_YES_OPTIONS
469
470#
471# MK_* options which default to "no".
472#
473.for var in ${__DEFAULT_NO_OPTIONS}
474.if defined(WITH_${var}) && defined(WITHOUT_${var})
475.error WITH_${var} and WITHOUT_${var} can't both be set.
476.endif
477.if defined(MK_${var})
478.error MK_${var} can't be set by a user.
479.endif
480.if defined(WITH_${var})
481MK_${var}:=	yes
482.else
483MK_${var}:=	no
484.endif
485.endfor
486.undef __DEFAULT_NO_OPTIONS
487
488#
489# Force some options off if their dependencies are off.
490# Order is somewhat important.
491#
492.if ${MK_LIBPTHREAD} == "no"
493MK_LIBTHR:=	no
494.endif
495
496.if ${MK_LIBTHR} == "no"
497MK_BIND:=	no
498.endif
499
500.if ${MK_BIND} == "no"
501MK_BIND_DNSSEC:= no
502MK_BIND_ETC:=	no
503MK_BIND_LIBS:=	no
504MK_BIND_LIBS_LWRES:= no
505MK_BIND_MTREE:=	no
506MK_BIND_NAMED:=	no
507MK_BIND_UTILS:=	no
508.endif
509
510.if ${MK_BIND_MTREE} == "no"
511MK_BIND_ETC:=	no
512.endif
513
514.if ${MK_CDDL} == "no"
515MK_ZFS:=	no
516MK_CTF:=	no
517.endif
518
519.if ${MK_CRYPT} == "no"
520MK_OPENSSL:=	no
521MK_OPENSSH:=	no
522MK_KERBEROS:=	no
523.endif
524
525.if ${MK_CXX} == "no"
526MK_CLANG:=	no
527MK_GROFF:=	no
528.endif
529
530.if ${MK_IPX} == "no"
531MK_NCP:=	no
532.endif
533
534.if ${MK_MAIL} == "no"
535MK_MAILWRAPPER:= no
536MK_SENDMAIL:=	no
537.endif
538
539.if ${MK_NETGRAPH} == "no"
540MK_ATM:=	no
541MK_BLUETOOTH:=	no
542.endif
543
544.if ${MK_OPENSSL} == "no"
545MK_OPENSSH:=	no
546MK_KERBEROS:=	no
547.endif
548
549.if ${MK_PF} == "no"
550MK_AUTHPF:=	no
551.endif
552
553.if ${MK_TEXTPROC} == "no"
554MK_GROFF:=	no
555.endif
556
557.if ${MK_TOOLCHAIN} == "no"
558MK_BINUTILS:=	no
559MK_CLANG:=	no
560MK_GCC:=	no
561MK_GDB:=	no
562.endif
563
564#
565# Set defaults for the MK_*_SUPPORT variables.
566#
567
568#
569# MK_*_SUPPORT options which default to "yes" unless their corresponding
570# MK_* variable is set to "no".
571#
572.for var in \
573    BZIP2 \
574    GNU \
575    INET \
576    INET6 \
577    IPX \
578    KERBEROS \
579    KVM \
580    NETGRAPH \
581    PAM \
582    WIRELESS
583.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
584.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
585.endif
586.if defined(MK_${var}_SUPPORT)
587.error MK_${var}_SUPPORT can't be set by a user.
588.endif
589.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
590MK_${var}_SUPPORT:= no
591.else
592MK_${var}_SUPPORT:= yes
593.endif
594.endfor
595
596#
597# MK_* options whose default value depends on another option.
598#
599.for vv in \
600    GSSAPI/KERBEROS \
601    MAN_UTILS/MAN
602.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
603.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
604.endif
605.if defined(MK_${vv:H})
606.error MK_${vv:H} can't be set by a user.
607.endif
608.if defined(WITH_${vv:H})
609MK_${vv:H}:=	yes
610.elif defined(WITHOUT_${vv:H})
611MK_${vv:H}:=	no
612.else
613MK_${vv:H}:=	${MK_${vv:T}}
614.endif
615.endfor
616
617.if ${MK_CTF} != "no"
618CTFCONVERT_CMD=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
619.elif ${MAKE_VERSION} >= 5201111300
620CTFCONVERT_CMD=
621.else
622CTFCONVERT_CMD=	@:
623.endif 
624
625.endif # !_WITHOUT_SRCCONF
626
627.endif	# !target(__<bsd.own.mk>__)
628