]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.own.mk
Remove duplicate option entries
[FreeBSD/FreeBSD.git] / share / mk / bsd.own.mk
1 # $FreeBSD$
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)
119 SRCCONF?=       /etc/src.conf
120 .if exists(${SRCCONF})
121 .include "${SRCCONF}"
122 .endif
123 .endif
124
125 # Binaries
126 BINOWN?=        root
127 BINGRP?=        wheel
128 BINMODE?=       555
129 NOBINMODE?=     444
130
131 .if defined(MODULES_WITH_WORLD)
132 KMODDIR?=       /boot/modules
133 .else
134 KMODDIR?=       /boot/kernel
135 .endif
136 KMODOWN?=       ${BINOWN}
137 KMODGRP?=       ${BINGRP}
138 KMODMODE?=      ${BINMODE}
139
140 LIBDIR?=        /usr/lib
141 LIBCOMPATDIR?=  /usr/lib/compat
142 LIBDATADIR?=    /usr/libdata
143 LIBEXECDIR?=    /usr/libexec
144 LINTLIBDIR?=    /usr/libdata/lint
145 SHLIBDIR?=      ${LIBDIR}
146 LIBOWN?=        ${BINOWN}
147 LIBGRP?=        ${BINGRP}
148 LIBMODE?=       ${NOBINMODE}
149
150
151 # Share files
152 SHAREDIR?=      /usr/share
153 SHAREOWN?=      root
154 SHAREGRP?=      wheel
155 SHAREMODE?=     ${NOBINMODE}
156
157 CONFDIR?=       /etc
158 CONFOWN?=       root
159 CONFGRP?=       wheel
160 CONFMODE?=      644
161
162 MANDIR?=        ${SHAREDIR}/man/man
163 MANOWN?=        ${SHAREOWN}
164 MANGRP?=        ${SHAREGRP}
165 MANMODE?=       ${NOBINMODE}
166
167 DOCDIR?=        ${SHAREDIR}/doc
168 DOCOWN?=        ${SHAREOWN}
169 DOCGRP?=        ${SHAREGRP}
170 DOCMODE?=       ${NOBINMODE}
171
172 INFODIR?=       ${SHAREDIR}/info
173 INFOOWN?=       ${SHAREOWN}
174 INFOGRP?=       ${SHAREGRP}
175 INFOMODE?=      ${NOBINMODE}
176
177 NLSDIR?=        ${SHAREDIR}/nls
178 NLSOWN?=        ${SHAREOWN}
179 NLSGRP?=        ${SHAREGRP}
180 NLSMODE?=       ${NOBINMODE}
181
182 INCLUDEDIR?=    /usr/include
183
184 #
185 # install(1) parameters.
186 #
187 HRDLINK?=       -l h
188 SYMLINK?=       -l s
189
190 INSTALL_LINK?=          ${INSTALL} ${HRDLINK}
191 INSTALL_SYMLINK?=       ${INSTALL} ${SYMLINK}
192
193 # Common variables
194 .if !defined(DEBUG_FLAGS)
195 STRIP?=         -s
196 .endif
197
198 COMPRESS_CMD?=  gzip -cn
199 COMPRESS_EXT?=  .gz
200
201 .if !defined(_WITHOUT_SRCCONF)
202 #
203 # Define MK_* variables (which are either "yes" or "no") for users
204 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
205 # make(1) environment.
206 # These should be tested with `== "no"' or `!= "no"' in makefiles.
207 # The NO_* variables should only be set by makefiles.
208 #
209
210 #
211 # Supported NO_* options (if defined, MK_* will be forced to "no",
212 # regardless of user's setting).
213 #
214 .for var in \
215     CTF \
216     INSTALLLIB \
217     MAN \
218     PROFILE
219 .if defined(NO_${var})
220 .if defined(WITH_${var})
221 .undef WITH_${var}
222 .endif
223 WITHOUT_${var}=
224 .endif
225 .endfor
226
227 #
228 # Older-style variables that enabled behaviour when set.
229 #
230 .if defined(YES_HESIOD)
231 WITH_HESIOD=
232 .endif
233 .if defined(MAKE_IDEA)
234 WITH_IDEA=
235 .endif
236
237 __DEFAULT_YES_OPTIONS = \
238     ACCT \
239     ACPI \
240     AMD \
241     APM \
242     ASSERT_DEBUG \
243     AT \
244     ATF \
245     ATM \
246     AUDIT \
247     AUTHPF \
248     BIND \
249     BIND_DNSSEC \
250     BIND_ETC \
251     BIND_LIBS_LWRES \
252     BIND_MTREE \
253     BIND_NAMED \
254     BIND_UTILS \
255     BINUTILS \
256     BLUETOOTH \
257     BOOT \
258     BSD_CPIO \
259     BSNMP \
260     BZIP2 \
261     CALENDAR \
262     CAPSICUM \
263     CDDL \
264     CPP \
265     CRYPT \
266     CTM \
267     CVS \
268     CXX \
269     DICT \
270     DYNAMICROOT \
271     ED_CRYPTO \
272     EXAMPLES \
273     FLOPPY \
274     FORTH \
275     FP_LIBC \
276     FREEBSD_UPDATE \
277     GAMES \
278     GCC \
279     GCOV \
280     GDB \
281     GNU \
282     GPIB \
283     GPIO \
284     GROFF \
285     HTML \
286     INET \
287     INET6 \
288     INFO \
289     INSTALLLIB \
290     IPFILTER \
291     IPFW \
292     IPX \
293     JAIL \
294     KDUMP \
295     KERBEROS \
296     KERNEL_SYMBOLS \
297     KVM \
298     LEGACY_CONSOLE \
299     LIB32 \
300     LIBPTHREAD \
301     LIBTHR \
302     LOCALES \
303     LOCATE \
304     LPR \
305     LS_COLORS \
306     MAIL \
307     MAILWRAPPER \
308     MAKE \
309     MAN \
310     NDIS \
311     NETCAT \
312     NETGRAPH \
313     NIS \
314     NLS \
315     NLS_CATALOGS \
316     NS_CACHING \
317     NTP \
318     OPENSSH \
319     OPENSSL \
320     PAM \
321     PC_SYSINSTALL \
322     PF \
323     PKGBOOTSTRAP \
324     PKGTOOLS \
325     PMC \
326     PORTSNAP \
327     PPP \
328     PROFILE \
329     QUOTAS \
330     RCMDS \
331     RCS \
332     RESCUE \
333     ROUTED \
334     SENDMAIL \
335     SETUID_LOGIN \
336     SHAREDOCS \
337     SOURCELESS \
338     SOURCELESS_HOST \
339     SOURCELESS_UCODE \
340     SSP \
341     SYMVER \
342     SYSCONS \
343     SYSINSTALL \
344     TCSH \
345     TELNET \
346     TEXTPROC \
347     TOOLCHAIN \
348     USB \
349     UTMPX \
350     WIRELESS \
351     WPA_SUPPLICANT_EAPOL \
352     ZFS \
353     ZONEINFO
354
355 __DEFAULT_NO_OPTIONS = \
356     ARM_EABI \
357     AUTO_OBJ \
358     BIND_IDN \
359     BIND_LARGE_FILE \
360     BIND_LIBS \
361     BIND_SIGCHASE \
362     BIND_XML \
363     BMAKE \
364     BSDCONFIG \
365     BSD_GREP \
366     BSD_PATCH \
367     CLANG_EXTRAS \
368     CTF \
369     GPL_DTC \
370     HESIOD \
371     ICONV \
372     IDEA \
373     INSTALL_AS_USER \
374     META_MODE \
375     NAND \
376     NMTREE \
377     OFED \
378     OPENSSH_NONE_CIPHER \
379     SHARED_TOOLCHAIN \
380     STAGING \
381     STAGING_PROG
382
383 #
384 # Default behaviour of some options depends on the architecture.  Unfortunately
385 # this means that we have to test TARGET_ARCH (the buildworld case) as well
386 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
387 # used at all in bsd.*.mk, but we have to make an exception here if we want
388 # to allow defaults for some things like clang and fdt to vary by target
389 # architecture.
390 #
391 .if defined(TARGET_ARCH)
392 __T=${TARGET_ARCH}
393 .else
394 __T=${MACHINE_ARCH}
395 .endif
396 # Clang is only for x86, powerpc and little-endian arm right now, by default.
397 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
398 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
399 .elif ${__T} == "arm" || ${__T} == "armv6"
400 __DEFAULT_YES_OPTIONS+=CLANG
401 # GCC is unable to build the full clang on arm, disable it by default.
402 __DEFAULT_NO_OPTIONS+=CLANG_FULL
403 .else
404 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
405 .endif
406 # Clang the default system compiler only on x86.
407 .if ${__T} == "amd64" || ${__T} == "i386"
408 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
409 .else
410 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
411 .endif
412 # FDT is needed only for arm, mips and powerpc
413 .if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
414 __DEFAULT_YES_OPTIONS+=FDT
415 .else
416 __DEFAULT_NO_OPTIONS+=FDT
417 .endif
418 .undef __T
419
420 #
421 # MK_* options which default to "yes".
422 #
423 .for var in ${__DEFAULT_YES_OPTIONS}
424 .if defined(WITH_${var}) && defined(WITHOUT_${var})
425 .error WITH_${var} and WITHOUT_${var} can't both be set.
426 .endif
427 .if defined(MK_${var})
428 .error MK_${var} can't be set by a user.
429 .endif
430 .if defined(WITHOUT_${var})
431 MK_${var}:=     no
432 .else
433 MK_${var}:=     yes
434 .endif
435 .endfor
436 .undef __DEFAULT_YES_OPTIONS
437
438 #
439 # MK_* options which default to "no".
440 #
441 .for var in ${__DEFAULT_NO_OPTIONS}
442 .if defined(WITH_${var}) && defined(WITHOUT_${var})
443 .error WITH_${var} and WITHOUT_${var} can't both be set.
444 .endif
445 .if defined(MK_${var})
446 .error MK_${var} can't be set by a user.
447 .endif
448 .if defined(WITH_${var})
449 MK_${var}:=     yes
450 .else
451 MK_${var}:=     no
452 .endif
453 .endfor
454 .undef __DEFAULT_NO_OPTIONS
455
456 #
457 # Force some options off if their dependencies are off.
458 # Order is somewhat important.
459 #
460 .if ${MK_LIBPTHREAD} == "no"
461 MK_LIBTHR:=     no
462 .endif
463
464 .if ${MK_LIBTHR} == "no"
465 MK_BIND:=       no
466 .endif
467
468 .if ${MK_BIND} == "no"
469 MK_BIND_DNSSEC:= no
470 MK_BIND_ETC:=   no
471 MK_BIND_LIBS:=  no
472 MK_BIND_LIBS_LWRES:= no
473 MK_BIND_MTREE:= no
474 MK_BIND_NAMED:= no
475 MK_BIND_UTILS:= no
476 .endif
477
478 .if ${MK_BIND_MTREE} == "no"
479 MK_BIND_ETC:=   no
480 .endif
481
482 .if ${MK_SOURCELESS} == "no"
483 MK_SOURCELESS_HOST:=    no
484 MK_SOURCELESS_UCODE:= no
485 .endif
486
487 .if ${MK_CDDL} == "no"
488 MK_ZFS:=        no
489 MK_CTF:=        no
490 .endif
491
492 .if ${MK_CRYPT} == "no"
493 MK_OPENSSL:=    no
494 MK_OPENSSH:=    no
495 MK_KERBEROS:=   no
496 .endif
497
498 .if ${MK_CXX} == "no"
499 MK_CLANG:=      no
500 MK_GROFF:=      no
501 .endif
502
503 .if ${MK_MAIL} == "no"
504 MK_MAILWRAPPER:= no
505 MK_SENDMAIL:=   no
506 .endif
507
508 .if ${MK_NETGRAPH} == "no"
509 MK_ATM:=        no
510 MK_BLUETOOTH:=  no
511 .endif
512
513 .if ${MK_OPENSSL} == "no"
514 MK_OPENSSH:=    no
515 MK_KERBEROS:=   no
516 .endif
517
518 .if ${MK_PF} == "no"
519 MK_AUTHPF:=     no
520 .endif
521
522 .if ${MK_TEXTPROC} == "no"
523 MK_GROFF:=      no
524 .endif
525
526 .if ${MK_TOOLCHAIN} == "no"
527 MK_BINUTILS:=   no
528 MK_CLANG:=      no
529 MK_GCC:=        no
530 MK_GDB:=        no
531 .endif
532
533 .if ${MK_CLANG} == "no"
534 MK_CLANG_EXTRAS:= no
535 MK_CLANG_FULL:= no
536 MK_CLANG_IS_CC:= no
537 .endif
538
539 .if !defined(.PARSEDIR)
540 MK_AUTO_OBJ:=   no
541 MK_META_MODE:=  no
542 .endif
543
544 .if ${MK_META_MODE} == "no"
545 MK_STAGING:=    no
546 MK_STAGING_PROG:= no
547 .endif
548
549 #
550 # Set defaults for the MK_*_SUPPORT variables.
551 #
552
553 #
554 # MK_*_SUPPORT options which default to "yes" unless their corresponding
555 # MK_* variable is set to "no".
556 #
557 .for var in \
558     BZIP2 \
559     GNU \
560     INET \
561     INET6 \
562     IPX \
563     KERBEROS \
564     KVM \
565     NETGRAPH \
566     PAM \
567     WIRELESS
568 .if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
569 .error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
570 .endif
571 .if defined(MK_${var}_SUPPORT)
572 .error MK_${var}_SUPPORT can't be set by a user.
573 .endif
574 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
575 MK_${var}_SUPPORT:= no
576 .else
577 MK_${var}_SUPPORT:= yes
578 .endif
579 .endfor
580
581 #
582 # MK_* options whose default value depends on another option.
583 #
584 .for vv in \
585     GSSAPI/KERBEROS \
586     MAN_UTILS/MAN
587 .if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
588 .error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
589 .endif
590 .if defined(MK_${vv:H})
591 .error MK_${vv:H} can't be set by a user.
592 .endif
593 .if defined(WITH_${vv:H})
594 MK_${vv:H}:=    yes
595 .elif defined(WITHOUT_${vv:H})
596 MK_${vv:H}:=    no
597 .else
598 MK_${vv:H}:=    ${MK_${vv:T}}
599 .endif
600 .endfor
601
602 #
603 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
604 #
605 .include <bsd.compiler.mk>
606 .for var in \
607     LIBCPLUSPLUS
608 .if defined(WITH_${var}) && defined(WITHOUT_${var})
609 .error WITH_${var} and WITHOUT_${var} can't both be set.
610 .endif
611 .if defined(MK_${var})
612 .error MK_${var} can't be set by a user.
613 .endif
614 .if ${COMPILER_FEATURES:Mc++11}
615 .if defined(WITHOUT_${var})
616 MK_${var}:=     no
617 .else
618 MK_${var}:=     yes
619 .endif
620 .else
621 .if defined(WITH_${var})
622 MK_${var}:=     yes
623 .else
624 MK_${var}:=     no
625 .endif
626 .endif
627 .endfor
628
629 .if ${MK_CTF} != "no"
630 CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
631 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
632 CTFCONVERT_CMD=
633 .else
634 CTFCONVERT_CMD= @:
635 .endif 
636
637 .if ${MK_INSTALL_AS_USER} != "no"
638 _uid!=  id -u
639 .if ${_uid} != 0
640 .if !defined(USER)
641 USER!=  id -un
642 .endif
643 _gid!=  id -gn
644 .for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
645 $xOWN=  ${USER}
646 $xGRP=  ${_gid}
647 .endfor
648 .endif
649 .endif
650
651 .endif # !_WITHOUT_SRCCONF
652
653 .endif  # !target(__<bsd.own.mk>__)