bsd.own.mk revision 228120
1# $FreeBSD: head/share/mk/bsd.own.mk 228120 2011-11-29 08:20:23Z fjoe $
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    INSTALLLIB \
207    MAN \
208    PROFILE
209.if defined(NO_${var})
210.if defined(WITH_${var})
211.undef WITH_${var}
212.endif
213WITHOUT_${var}=
214.endif
215.endfor
216
217#
218# Compat NO_* options (same as above, except their use is deprecated).
219#
220.if !defined(BURN_BRIDGES)
221.for var in \
222    ACPI \
223    ATM \
224    AUDIT \
225    AUTHPF \
226    BIND \
227    BIND_DNSSEC \
228    BIND_ETC \
229    BIND_LIBS_LWRES \
230    BIND_MTREE \
231    BIND_NAMED \
232    BIND_UTILS \
233    BLUETOOTH \
234    BOOT \
235    CALENDAR \
236    CPP \
237    CRYPT \
238    CVS \
239    CXX \
240    DICT \
241    DYNAMICROOT \
242    EXAMPLES \
243    FORTH \
244    FP_LIBC \
245    GAMES \
246    GCOV \
247    GDB \
248    GNU \
249    GPIB \
250    GROFF \
251    HTML \
252    INET6 \
253    INFO \
254    IPFILTER \
255    IPX \
256    KERBEROS \
257    LIB32 \
258    LIBPTHREAD \
259    LIBTHR \
260    LOCALES \
261    LPR \
262    MAILWRAPPER \
263    NETCAT \
264    NIS \
265    NLS \
266    NLS_CATALOGS \
267    NS_CACHING \
268    OPENSSH \
269    OPENSSL \
270    PAM \
271    PF \
272    RCMDS \
273    RCS \
274    RESCUE \
275    SENDMAIL \
276    SETUID_LOGIN \
277    SHAREDOCS \
278    SYSCONS \
279    TCSH \
280    TOOLCHAIN \
281    USB \
282    WPA_SUPPLICANT_EAPOL
283.if defined(NO_${var})
284#.warning NO_${var} is deprecated in favour of WITHOUT_${var}=
285WITHOUT_${var}=
286.endif
287.endfor
288.endif # !defined(BURN_BRIDGES)
289
290#
291# Older-style variables that enabled behaviour when set.
292#
293.if defined(YES_HESIOD)
294WITH_HESIOD=
295.endif
296.if defined(MAKE_IDEA)
297WITH_IDEA=
298.endif
299
300__DEFAULT_YES_OPTIONS = \
301    ACCT \
302    ACPI \
303    AMD \
304    APM \
305    ASSERT_DEBUG \
306    AT \
307    ATM \
308    AUDIT \
309    AUTHPF \
310    BIND \
311    BIND_DNSSEC \
312    BIND_ETC \
313    BIND_LIBS_LWRES \
314    BIND_MTREE \
315    BIND_NAMED \
316    BIND_UTILS \
317    BINUTILS \
318    BLUETOOTH \
319    BOOT \
320    BSD_CPIO \
321    BSNMP \
322    BZIP2 \
323    CALENDAR \
324    CDDL \
325    CPP \
326    CRYPT \
327    CTM \
328    CVS \
329    CXX \
330    DICT \
331    DYNAMICROOT \
332    EXAMPLES \
333    FLOPPY \
334    FORTH \
335    FP_LIBC \
336    FREEBSD_UPDATE \
337    GAMES \
338    GCC \
339    GCOV \
340    GDB \
341    GNU \
342    GPIB \
343    GPIO \
344    GROFF \
345    HTML \
346    INET \
347    INET6 \
348    INFO \
349    INSTALLLIB \
350    IPFILTER \
351    IPFW \
352    IPX \
353    JAIL \
354    KERBEROS \
355    KERNEL_SYMBOLS \
356    KVM \
357    LEGACY_CONSOLE \
358    LIB32 \
359    LIBPTHREAD \
360    LIBTHR \
361    LOCALES \
362    LOCATE \
363    LPR \
364    MAIL \
365    MAILWRAPPER \
366    MAKE \
367    MAN \
368    NCP \
369    NDIS \
370    NETCAT \
371    NETGRAPH \
372    NIS \
373    NLS \
374    NLS_CATALOGS \
375    NS_CACHING \
376    NTP \
377    OPENSSH \
378    OPENSSL \
379    PAM \
380    PF \
381    PKGTOOLS \
382    PMC \
383    PORTSNAP \
384    PPP \
385    PROFILE \
386    QUOTAS \
387    RCMDS \
388    RCS \
389    RESCUE \
390    ROUTED \
391    SENDMAIL \
392    SETUID_LOGIN \
393    SHAREDOCS \
394    SSP \
395    SYSINSTALL \
396    SYMVER \
397    SYSCONS \
398    TCSH \
399    TELNET \
400    TEXTPROC \
401    TOOLCHAIN \
402    USB \
403    UTMPX \
404    WIRELESS \
405    WPA_SUPPLICANT_EAPOL \
406    ZFS \
407    ZONEINFO
408
409__DEFAULT_NO_OPTIONS = \
410    BSD_GREP \
411    BIND_IDN \
412    BIND_LARGE_FILE \
413    BIND_LIBS \
414    BIND_SIGCHASE \
415    BIND_XML \
416    HESIOD \
417    ICONV \
418    IDEA \
419    LIBCPLUSPLUS \
420    OFED
421
422#
423# Default behaviour of some options depends on the architecture.  Unfortunately
424# this means that we have to test TARGET_ARCH (the buildworld case) as well
425# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
426# used at all in bsd.*.mk, but we have to make an exception here if we want
427# to allow defaults for some things like clang and fdt to vary by target
428# architecture.
429#
430.if defined(TARGET_ARCH)
431__T=${TARGET_ARCH}
432.else
433__T=${MACHINE_ARCH}
434.endif
435# Clang is only for x86 and powerpc right now, by default.
436.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
437__DEFAULT_YES_OPTIONS+=CLANG
438.else
439__DEFAULT_NO_OPTIONS+=CLANG
440.endif
441# FDT is needed only for arm, mips and powerpc
442.if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
443__DEFAULT_YES_OPTIONS+=FDT
444.else
445__DEFAULT_NO_OPTIONS+=FDT
446.endif
447.undef __T
448
449#
450# MK_* options which default to "yes".
451#
452.for var in ${__DEFAULT_YES_OPTIONS}
453.if defined(WITH_${var}) && defined(WITHOUT_${var})
454.error WITH_${var} and WITHOUT_${var} can't both be set.
455.endif
456.if defined(MK_${var})
457.error MK_${var} can't be set by a user.
458.endif
459.if defined(WITHOUT_${var})
460MK_${var}:=	no
461.else
462MK_${var}:=	yes
463.endif
464.endfor
465.undef __DEFAULT_YES_OPTIONS
466
467#
468# MK_* options which default to "no".
469#
470.for var in ${__DEFAULT_NO_OPTIONS}
471.if defined(WITH_${var}) && defined(WITHOUT_${var})
472.error WITH_${var} and WITHOUT_${var} can't both be set.
473.endif
474.if defined(MK_${var})
475.error MK_${var} can't be set by a user.
476.endif
477.if defined(WITH_${var})
478MK_${var}:=	yes
479.else
480MK_${var}:=	no
481.endif
482.endfor
483.undef __DEFAULT_NO_OPTIONS
484
485#
486# Force some options off if their dependencies are off.
487# Order is somewhat important.
488#
489.if ${MK_LIBPTHREAD} == "no"
490MK_LIBTHR:=	no
491.endif
492
493.if ${MK_LIBTHR} == "no"
494MK_BIND:=	no
495.endif
496
497.if ${MK_BIND} == "no"
498MK_BIND_DNSSEC:= no
499MK_BIND_ETC:=	no
500MK_BIND_LIBS:=	no
501MK_BIND_LIBS_LWRES:= no
502MK_BIND_MTREE:=	no
503MK_BIND_NAMED:=	no
504MK_BIND_UTILS:=	no
505.endif
506
507.if ${MK_BIND_MTREE} == "no"
508MK_BIND_ETC:=	no
509.endif
510
511.if ${MK_CDDL} == "no"
512MK_ZFS:=	no
513.endif
514
515.if ${MK_CRYPT} == "no"
516MK_OPENSSL:=	no
517MK_OPENSSH:=	no
518MK_KERBEROS:=	no
519.endif
520
521.if ${MK_CXX} == "no"
522MK_CLANG:=	no
523MK_GROFF:=	no
524.endif
525
526.if ${MK_IPX} == "no"
527MK_NCP:=	no
528.endif
529
530.if ${MK_MAIL} == "no"
531MK_MAILWRAPPER:= no
532MK_SENDMAIL:=	no
533.endif
534
535.if ${MK_NETGRAPH} == "no"
536MK_ATM:=	no
537MK_BLUETOOTH:=	no
538.endif
539
540.if ${MK_OPENSSL} == "no"
541MK_OPENSSH:=	no
542MK_KERBEROS:=	no
543.endif
544
545.if ${MK_PF} == "no"
546MK_AUTHPF:=	no
547.endif
548
549.if ${MK_TEXTPROC} == "no"
550MK_GROFF:=	no
551.endif
552
553.if ${MK_TOOLCHAIN} == "no"
554MK_BINUTILS:=	no
555MK_CLANG:=	no
556MK_GCC:=	no
557MK_GDB:=	no
558.endif
559
560#
561# Set defaults for the MK_*_SUPPORT variables.
562#
563
564#
565# MK_*_SUPPORT options which default to "yes" unless their corresponding
566# MK_* variable is set to "no".
567#
568.for var in \
569    BZIP2 \
570    GNU \
571    INET \
572    INET6 \
573    IPX \
574    KERBEROS \
575    KVM \
576    NETGRAPH \
577    PAM \
578    WIRELESS
579.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
580.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
581.endif
582.if defined(MK_${var}_SUPPORT)
583.error MK_${var}_SUPPORT can't be set by a user.
584.endif
585.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
586MK_${var}_SUPPORT:= no
587.else
588MK_${var}_SUPPORT:= yes
589.endif
590.endfor
591
592#
593# MK_* options whose default value depends on another option.
594#
595.for vv in \
596    GSSAPI/KERBEROS \
597    MAN_UTILS/MAN
598.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
599.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
600.endif
601.if defined(MK_${vv:H})
602.error MK_${vv:H} can't be set by a user.
603.endif
604.if defined(WITH_${vv:H})
605MK_${vv:H}:=	yes
606.elif defined(WITHOUT_${vv:H})
607MK_${vv:H}:=	no
608.else
609MK_${vv:H}:=	${MK_${vv:T}}
610.endif
611.endfor
612
613.endif # !_WITHOUT_SRCCONF
614
615.endif	# !target(__<bsd.own.mk>__)
616