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