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