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