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