bsd.own.mk revision 220359
1# $FreeBSD: head/share/mk/bsd.own.mk 220359 2011-04-05 08:49:47Z 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    OBJC \
252    OPENSSH \
253    OPENSSL \
254    PAM \
255    PF \
256    RCMDS \
257    RCS \
258    RESCUE \
259    SENDMAIL \
260    SETUID_LOGIN \
261    SHAREDOCS \
262    SYSCONS \
263    TCSH \
264    TOOLCHAIN \
265    USB \
266    WPA_SUPPLICANT_EAPOL
267.if defined(NO_${var})
268#.warning NO_${var} is deprecated in favour of WITHOUT_${var}=
269WITHOUT_${var}=
270.endif
271.endfor
272.endif # !defined(BURN_BRIDGES)
273
274#
275# Older-style variables that enabled behaviour when set.
276#
277.if defined(YES_HESIOD)
278WITH_HESIOD=
279.endif
280.if defined(MAKE_IDEA)
281WITH_IDEA=
282.endif
283
284__DEFAULT_YES_OPTIONS = \
285    ACCT \
286    ACPI \
287    AMD \
288    APM \
289    ASSERT_DEBUG \
290    AT \
291    ATM \
292    AUDIT \
293    AUTHPF \
294    BIND \
295    BIND_DNSSEC \
296    BIND_ETC \
297    BIND_LIBS_LWRES \
298    BIND_MTREE \
299    BIND_NAMED \
300    BIND_UTILS \
301    BINUTILS \
302    BLUETOOTH \
303    BOOT \
304    BSD_CPIO \
305    BSNMP \
306    BZIP2 \
307    CALENDAR \
308    CDDL \
309    CPP \
310    CRYPT \
311    CTM \
312    CVS \
313    CXX \
314    DICT \
315    DYNAMICROOT \
316    EXAMPLES \
317    FLOPPY \
318    FORTH \
319    FP_LIBC \
320    FREEBSD_UPDATE \
321    GAMES \
322    GCC \
323    GCOV \
324    GDB \
325    GNU \
326    GPIB \
327    GPIO \
328    GROFF \
329    HTML \
330    INET6 \
331    INFO \
332    INSTALLLIB \
333    IPFILTER \
334    IPFW \
335    IPX \
336    JAIL \
337    KERBEROS \
338    KVM \
339    LEGACY_CONSOLE \
340    LIB32 \
341    LIBPTHREAD \
342    LIBTHR \
343    LOCALES \
344    LOCATE \
345    LPR \
346    MAIL \
347    MAILWRAPPER \
348    MAKE \
349    MAN \
350    NCP \
351    NDIS \
352    NETCAT \
353    NETGRAPH \
354    NIS \
355    NLS \
356    NLS_CATALOGS \
357    NS_CACHING \
358    NTP \
359    OBJC \
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    GNU_CPIO \
399    HESIOD \
400    ICONV \
401    IDEA \
402    OFED
403
404#
405# Default behaviour of some options depends on the architecture.  Unfortunately
406# this means that we have to test TARGET_ARCH (the buildworld case) as well
407# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
408# used at all in bsd.*.mk, but we have to make an exception here if we want
409# to allow defaults for some things like clang and ftd to vary by target
410# architecture.
411#
412.if defined(TARGET_ARCH)
413__T=${TARGET_ARCH}
414.else
415__T=${MACHINE_ARCH}
416.endif
417# Clang is only for x86 and 32-bit powerpc right now, by default.
418.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc"
419__DEFAULT_YES_OPTIONS+=CLANG
420.else
421__DEFAULT_NO_OPTIONS+=CLANG
422.endif
423# FDT is needed only for arm and powerpc (and not powerpc64)
424.if ${__T} == "arm" || ${__T} == "armeb" || ${__T} == "powerpc"
425__DEFAULT_YES_OPTIONS+=FDT
426.else
427__DEFAULT_NO_OPTIONS+=FDT
428.endif
429.undef __T
430
431#
432# MK_* options which default to "yes".
433#
434.for var in ${__DEFAULT_YES_OPTIONS}
435.if defined(WITH_${var}) && defined(WITHOUT_${var})
436.error WITH_${var} and WITHOUT_${var} can't both be set.
437.endif
438.if defined(MK_${var})
439.error MK_${var} can't be set by a user.
440.endif
441.if defined(WITHOUT_${var})
442MK_${var}:=	no
443.else
444MK_${var}:=	yes
445.endif
446.endfor
447.undef __DEFAULT_YES_OPTIONS
448
449#
450# MK_* options which default to "no".
451#
452.for var in ${__DEFAULT_NO_OPTIONS}
453.if defined(WITH_${var}) && defined(WITHOUT_${var})
454.error WITH_${var} and WITHOUT_${var} can't both be set.
455.endif
456.if defined(MK_${var})
457.error MK_${var} can't be set by a user.
458.endif
459.if defined(WITH_${var})
460MK_${var}:=	yes
461.else
462MK_${var}:=	no
463.endif
464.endfor
465.undef __DEFAULT_NO_OPTIONS
466
467#
468# Force some options off if their dependencies are off.
469# Order is somewhat important.
470#
471.if ${MK_LIBPTHREAD} == "no"
472MK_LIBTHR:=	no
473.endif
474
475.if ${MK_LIBTHR} == "no"
476MK_BIND:=	no
477.endif
478
479.if ${MK_BIND} == "no"
480MK_BIND_DNSSEC:= no
481MK_BIND_ETC:=	no
482MK_BIND_LIBS:=	no
483MK_BIND_LIBS_LWRES:= no
484MK_BIND_MTREE:=	no
485MK_BIND_NAMED:=	no
486MK_BIND_UTILS:=	no
487.endif
488
489.if ${MK_BIND_MTREE} == "no"
490MK_BIND_ETC:=	no
491.endif
492
493.if ${MK_CDDL} == "no"
494MK_ZFS:=	no
495.endif
496
497.if ${MK_CRYPT} == "no"
498MK_OPENSSL:=	no
499MK_OPENSSH:=	no
500MK_KERBEROS:=	no
501.endif
502
503.if ${MK_IPX} == "no"
504MK_NCP:=	no
505.endif
506
507.if ${MK_MAIL} == "no"
508MK_MAILWRAPPER:= no
509MK_SENDMAIL:=	no
510.endif
511
512.if ${MK_NETGRAPH} == "no"
513MK_ATM:=	no
514MK_BLUETOOTH:=	no
515.endif
516
517.if ${MK_OPENSSL} == "no"
518MK_OPENSSH:=	no
519MK_KERBEROS:=	no
520.endif
521
522.if ${MK_PF} == "no"
523MK_AUTHPF:=	no
524.endif
525
526.if ${MK_TEXTPROC} == "no"
527MK_GROFF:=	no
528.endif
529
530.if ${MK_TOOLCHAIN} == "no"
531MK_CLANG:=	no
532MK_GDB:=	no
533.endif
534
535#
536# Set defaults for the MK_*_SUPPORT variables.
537#
538
539#
540# MK_*_SUPPORT options which default to "yes" unless their corresponding
541# MK_* variable is set to "no".
542#
543.for var in \
544    BZIP2 \
545    GNU \
546    INET6 \
547    IPX \
548    KERBEROS \
549    KVM \
550    NETGRAPH \
551    PAM \
552    WIRELESS
553.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
554.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
555.endif
556.if defined(MK_${var}_SUPPORT)
557.error MK_${var}_SUPPORT can't be set by a user.
558.endif
559.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
560MK_${var}_SUPPORT:= no
561.else
562MK_${var}_SUPPORT:= yes
563.endif
564.endfor
565
566#
567# MK_* options whose default value depends on another option.
568#
569.for vv in \
570    GSSAPI/KERBEROS \
571    MAN_UTILS/MAN
572.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
573.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
574.endif
575.if defined(MK_${vv:H})
576.error MK_${vv:H} can't be set by a user.
577.endif
578.if defined(WITH_${vv:H})
579MK_${vv:H}:=	yes
580.elif defined(WITHOUT_${vv:H})
581MK_${vv:H}:=	no
582.else
583MK_${vv:H}:=	${MK_${vv:T}}
584.endif
585.endfor
586
587.endif # !_WITHOUT_SRCCONF
588
589.endif	# !target(__<bsd.own.mk>__)
590