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