bsd.own.mk revision 234782
1# $FreeBSD: head/share/mk/bsd.own.mk 234782 2012-04-29 09:32:44Z kib $
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    SOURCELESS \
324    SOURCELESS_HOST \
325    SOURCELESS_UCODE \
326    BZIP2 \
327    CALENDAR \
328    CAPSICUM \
329    CDDL \
330    CPP \
331    CRYPT \
332    CTM \
333    CVS \
334    CXX \
335    DICT \
336    DYNAMICROOT \
337    EXAMPLES \
338    FLOPPY \
339    FORTH \
340    FP_LIBC \
341    FREEBSD_UPDATE \
342    GAMES \
343    GCC \
344    GCOV \
345    GDB \
346    GNU \
347    GPIB \
348    GPIO \
349    GROFF \
350    HTML \
351    INET \
352    INET6 \
353    INFO \
354    INSTALLLIB \
355    IPFILTER \
356    IPFW \
357    IPX \
358    JAIL \
359    KERBEROS \
360    KERNEL_SYMBOLS \
361    KVM \
362    LEGACY_CONSOLE \
363    LIB32 \
364    LIBPTHREAD \
365    LIBTHR \
366    LOCALES \
367    LOCATE \
368    LPR \
369    MAIL \
370    MAILWRAPPER \
371    MAKE \
372    MAN \
373    NCP \
374    NDIS \
375    NETCAT \
376    NETGRAPH \
377    NIS \
378    NLS \
379    NLS_CATALOGS \
380    NS_CACHING \
381    NTP \
382    OPENSSH \
383    OPENSSL \
384    PAM \
385    PF \
386    PKGTOOLS \
387    PMC \
388    PORTSNAP \
389    PPP \
390    PROFILE \
391    QUOTAS \
392    RCMDS \
393    RCS \
394    RESCUE \
395    ROUTED \
396    SENDMAIL \
397    SETUID_LOGIN \
398    SHAREDOCS \
399    SSP \
400    SYSINSTALL \
401    SYMVER \
402    SYSCONS \
403    TCSH \
404    TELNET \
405    TEXTPROC \
406    TOOLCHAIN \
407    USB \
408    UTMPX \
409    WIRELESS \
410    WPA_SUPPLICANT_EAPOL \
411    ZFS \
412    ZONEINFO
413
414__DEFAULT_NO_OPTIONS = \
415    BSD_GREP \
416    BIND_IDN \
417    BIND_LARGE_FILE \
418    BIND_LIBS \
419    BIND_SIGCHASE \
420    BIND_XML \
421    CLANG_EXTRAS \
422    CLANG_IS_CC \
423    CTF \
424    HESIOD \
425    ICONV \
426    IDEA \
427    LIBCPLUSPLUS \
428    OFED \
429    SHARED_TOOLCHAIN
430
431#
432# Default behaviour of some options depends on the architecture.  Unfortunately
433# this means that we have to test TARGET_ARCH (the buildworld case) as well
434# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
435# used at all in bsd.*.mk, but we have to make an exception here if we want
436# to allow defaults for some things like clang and fdt to vary by target
437# architecture.
438#
439.if defined(TARGET_ARCH)
440__T=${TARGET_ARCH}
441.else
442__T=${MACHINE_ARCH}
443.endif
444# Clang is only for x86 and powerpc right now, by default.
445# XXX: Temporarily disabled for 32-bit powerpc, due to a binutils bug.
446.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64"
447__DEFAULT_YES_OPTIONS+=CLANG
448.else
449__DEFAULT_NO_OPTIONS+=CLANG
450.endif
451# FDT is needed only for arm, mips and powerpc
452.if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
453__DEFAULT_YES_OPTIONS+=FDT
454.else
455__DEFAULT_NO_OPTIONS+=FDT
456.endif
457.undef __T
458
459#
460# MK_* options which default to "yes".
461#
462.for var in ${__DEFAULT_YES_OPTIONS}
463.if defined(WITH_${var}) && defined(WITHOUT_${var})
464.error WITH_${var} and WITHOUT_${var} can't both be set.
465.endif
466.if defined(MK_${var})
467.error MK_${var} can't be set by a user.
468.endif
469.if defined(WITHOUT_${var})
470MK_${var}:=	no
471.else
472MK_${var}:=	yes
473.endif
474.endfor
475.undef __DEFAULT_YES_OPTIONS
476
477#
478# MK_* options which default to "no".
479#
480.for var in ${__DEFAULT_NO_OPTIONS}
481.if defined(WITH_${var}) && defined(WITHOUT_${var})
482.error WITH_${var} and WITHOUT_${var} can't both be set.
483.endif
484.if defined(MK_${var})
485.error MK_${var} can't be set by a user.
486.endif
487.if defined(WITH_${var})
488MK_${var}:=	yes
489.else
490MK_${var}:=	no
491.endif
492.endfor
493.undef __DEFAULT_NO_OPTIONS
494
495#
496# Force some options off if their dependencies are off.
497# Order is somewhat important.
498#
499.if ${MK_LIBPTHREAD} == "no"
500MK_LIBTHR:=	no
501.endif
502
503.if ${MK_LIBTHR} == "no"
504MK_BIND:=	no
505.endif
506
507.if ${MK_BIND} == "no"
508MK_BIND_DNSSEC:= no
509MK_BIND_ETC:=	no
510MK_BIND_LIBS:=	no
511MK_BIND_LIBS_LWRES:= no
512MK_BIND_MTREE:=	no
513MK_BIND_NAMED:=	no
514MK_BIND_UTILS:=	no
515.endif
516
517.if ${MK_BIND_MTREE} == "no"
518MK_BIND_ETC:=	no
519.endif
520
521.if ${MK_SOURCELESS} == "no"
522MK_SOURCELESS_HOST:=	no
523MK_SOURCELESS_UCODE:= no
524.endif
525
526.if ${MK_CDDL} == "no"
527MK_ZFS:=	no
528MK_CTF:=	no
529.endif
530
531.if ${MK_CLANG} == "no"
532MK_CLANG_EXTRAS:= no
533.endif
534
535.if ${MK_CRYPT} == "no"
536MK_OPENSSL:=	no
537MK_OPENSSH:=	no
538MK_KERBEROS:=	no
539.endif
540
541.if ${MK_CXX} == "no"
542MK_CLANG:=	no
543MK_GROFF:=	no
544.endif
545
546.if ${MK_IPX} == "no"
547MK_NCP:=	no
548.endif
549
550.if ${MK_MAIL} == "no"
551MK_MAILWRAPPER:= no
552MK_SENDMAIL:=	no
553.endif
554
555.if ${MK_NETGRAPH} == "no"
556MK_ATM:=	no
557MK_BLUETOOTH:=	no
558.endif
559
560.if ${MK_OPENSSL} == "no"
561MK_OPENSSH:=	no
562MK_KERBEROS:=	no
563.endif
564
565.if ${MK_PF} == "no"
566MK_AUTHPF:=	no
567.endif
568
569.if ${MK_TEXTPROC} == "no"
570MK_GROFF:=	no
571.endif
572
573.if ${MK_TOOLCHAIN} == "no"
574MK_BINUTILS:=	no
575MK_CLANG:=	no
576MK_GCC:=	no
577MK_GDB:=	no
578.endif
579
580.if ${MK_CLANG} == "no"
581MK_CLANG_IS_CC:= no
582.endif
583
584#
585# Set defaults for the MK_*_SUPPORT variables.
586#
587
588#
589# MK_*_SUPPORT options which default to "yes" unless their corresponding
590# MK_* variable is set to "no".
591#
592.for var in \
593    BZIP2 \
594    GNU \
595    INET \
596    INET6 \
597    IPX \
598    KERBEROS \
599    KVM \
600    NETGRAPH \
601    PAM \
602    WIRELESS
603.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
604.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
605.endif
606.if defined(MK_${var}_SUPPORT)
607.error MK_${var}_SUPPORT can't be set by a user.
608.endif
609.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
610MK_${var}_SUPPORT:= no
611.else
612MK_${var}_SUPPORT:= yes
613.endif
614.endfor
615
616#
617# MK_* options whose default value depends on another option.
618#
619.for vv in \
620    GSSAPI/KERBEROS \
621    MAN_UTILS/MAN
622.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
623.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
624.endif
625.if defined(MK_${vv:H})
626.error MK_${vv:H} can't be set by a user.
627.endif
628.if defined(WITH_${vv:H})
629MK_${vv:H}:=	yes
630.elif defined(WITHOUT_${vv:H})
631MK_${vv:H}:=	no
632.else
633MK_${vv:H}:=	${MK_${vv:T}}
634.endif
635.endfor
636
637.if ${MK_CTF} != "no"
638CTFCONVERT_CMD=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
639.elif ${MAKE_VERSION} >= 5201111300
640CTFCONVERT_CMD=
641.else
642CTFCONVERT_CMD=	@:
643.endif 
644
645.endif # !_WITHOUT_SRCCONF
646
647.endif	# !target(__<bsd.own.mk>__)
648