]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - share/mk/bsd.own.mk
MFC r321952:
[FreeBSD/stable/10.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 # LIBPRIVATEDIR Base path for private libraries. [/usr/lib/private]
32 #
33 # LIBDATADIR    Base path for misc. utility data files. [/usr/libdata]
34 #
35 # LIBEXECDIR    Base path for system daemons and utilities. [/usr/libexec]
36 #
37 # LINTLIBDIR    Base path for lint libraries. [/usr/libdata/lint]
38 #
39 # SHLIBDIR      Base path for shared libraries. [${LIBDIR}]
40 #
41 # LIBOWN        Library owner. [${BINOWN}]
42 #
43 # LIBGRP        Library group. [${BINGRP}]
44 #
45 # LIBMODE       Library mode. [${NOBINMODE}]
46 #
47 #
48 # DEBUGDIR      Base path for standalone debug files. [/usr/lib/debug]
49 #
50 # DEBUGMODE     Mode for debug files. [${NOBINMODE}]
51 #
52 #
53 # KMODDIR       Base path for loadable kernel modules
54 #               (see kld(4)). [/boot/kernel]
55 #
56 # KMODOWN       Kernel and KLD owner. [${BINOWN}]
57 #
58 # KMODGRP       Kernel and KLD group. [${BINGRP}]
59 #
60 # KMODMODE      KLD mode. [${BINMODE}]
61 #
62 #
63 # SHAREDIR      Base path for architecture-independent ascii
64 #               text files. [/usr/share]
65 #
66 # SHAREOWN      ASCII text file owner. [root]
67 #
68 # SHAREGRP      ASCII text file group. [wheel]
69 #
70 # SHAREMODE     ASCII text file mode. [${NOBINMODE}]
71 #
72 #
73 # CONFDIR       Base path for configuration files. [/etc]
74 #
75 # CONFOWN       Configuration file owner. [root]
76 #
77 # CONFGRP       Configuration file group. [wheel]
78 #
79 # CONFMODE      Configuration file mode. [644]
80 #
81 #
82 # DOCDIR        Base path for system documentation (e.g. PSD, USD,
83 #               handbook, FAQ etc.). [${SHAREDIR}/doc]
84 #
85 # DOCOWN        Documentation owner. [${SHAREOWN}]
86 #
87 # DOCGRP        Documentation group. [${SHAREGRP}]
88 #
89 # DOCMODE       Documentation mode. [${NOBINMODE}]
90 #
91 #
92 # INFODIR       Base path for GNU's hypertext system
93 #               called Info (see info(1)). [${SHAREDIR}/info]
94 #
95 # INFOOWN       Info owner. [${SHAREOWN}]
96 #
97 # INFOGRP       Info group. [${SHAREGRP}]
98 #
99 # INFOMODE      Info mode. [${NOBINMODE}]
100 #
101 #
102 # MANDIR        Base path for manual installation. [${SHAREDIR}/man/man]
103 #
104 # MANOWN        Manual owner. [${SHAREOWN}]
105 #
106 # MANGRP        Manual group. [${SHAREGRP}]
107 #
108 # MANMODE       Manual mode. [${NOBINMODE}]
109 #
110 #
111 # NLSDIR        Base path for National Language Support files
112 #               installation. [${SHAREDIR}/nls]
113 #
114 # NLSOWN        National Language Support files owner. [${SHAREOWN}]
115 #
116 # NLSGRP        National Language Support files group. [${SHAREGRP}]
117 #
118 # NLSMODE       National Language Support files mode. [${NOBINMODE}]
119 #
120 # INCLUDEDIR    Base path for standard C include files [/usr/include]
121
122 .if !target(__<bsd.own.mk>__)
123 __<bsd.own.mk>__:
124
125 .if !defined(_WITHOUT_SRCCONF)
126 SRCCONF?=       /etc/src.conf
127 .if exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf"
128 .include "${SRCCONF}"
129 .endif
130 .endif
131
132 # Binaries
133 BINOWN?=        root
134 BINGRP?=        wheel
135 BINMODE?=       555
136 NOBINMODE?=     444
137
138 .if defined(MODULES_WITH_WORLD)
139 KMODDIR?=       /boot/modules
140 .else
141 KMODDIR?=       /boot/kernel
142 .endif
143 KMODOWN?=       ${BINOWN}
144 KMODGRP?=       ${BINGRP}
145 KMODMODE?=      ${BINMODE}
146 DTBDIR?=        /boot/dtb
147 DTBOWN?=        root
148 DTBGRP?=        wheel
149 DTBMODE?=       444
150
151 LIBDIR?=        /usr/lib
152 LIBCOMPATDIR?=  /usr/lib/compat
153 LIBPRIVATEDIR?= /usr/lib/private
154 LIBDATADIR?=    /usr/libdata
155 LIBEXECDIR?=    /usr/libexec
156 LINTLIBDIR?=    /usr/libdata/lint
157 SHLIBDIR?=      ${LIBDIR}
158 LIBOWN?=        ${BINOWN}
159 LIBGRP?=        ${BINGRP}
160 LIBMODE?=       ${NOBINMODE}
161
162 DEBUGDIR?=      /usr/lib/debug
163 DEBUGMODE?=     ${NOBINMODE}
164
165
166 # Share files
167 SHAREDIR?=      /usr/share
168 SHAREOWN?=      root
169 SHAREGRP?=      wheel
170 SHAREMODE?=     ${NOBINMODE}
171
172 CONFDIR?=       /etc
173 CONFOWN?=       root
174 CONFGRP?=       wheel
175 CONFMODE?=      644
176
177 MANDIR?=        ${SHAREDIR}/man/man
178 MANOWN?=        ${SHAREOWN}
179 MANGRP?=        ${SHAREGRP}
180 MANMODE?=       ${NOBINMODE}
181
182 DOCDIR?=        ${SHAREDIR}/doc
183 DOCOWN?=        ${SHAREOWN}
184 DOCGRP?=        ${SHAREGRP}
185 DOCMODE?=       ${NOBINMODE}
186
187 INFODIR?=       ${SHAREDIR}/info
188 INFOOWN?=       ${SHAREOWN}
189 INFOGRP?=       ${SHAREGRP}
190 INFOMODE?=      ${NOBINMODE}
191
192 NLSDIR?=        ${SHAREDIR}/nls
193 NLSOWN?=        ${SHAREOWN}
194 NLSGRP?=        ${SHAREGRP}
195 NLSMODE?=       ${NOBINMODE}
196
197 INCLUDEDIR?=    /usr/include
198
199 #
200 # install(1) parameters.
201 #
202 HRDLINK?=       -l h
203 SYMLINK?=       -l s
204
205 INSTALL_LINK?=          ${INSTALL} ${HRDLINK}
206 INSTALL_SYMLINK?=       ${INSTALL} ${SYMLINK}
207
208 # Common variables
209 .if !defined(DEBUG_FLAGS)
210 STRIP?=         -s
211 .endif
212
213 COMPRESS_CMD?=  gzip -cn
214 COMPRESS_EXT?=  .gz
215
216 # Set XZ_THREADS to 1 to disable multi-threading.
217 XZ_THREADS?=    0
218
219 .if !empty(XZ_THREADS)
220 XZ_CMD?=        xz -T ${XZ_THREADS}
221 .else
222 XZ_CMD?=        xz
223 .endif
224
225 .if !defined(_WITHOUT_SRCCONF)
226 #
227 # Define MK_* variables (which are either "yes" or "no") for users
228 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
229 # make(1) environment.
230 # These should be tested with `== "no"' or `!= "no"' in makefiles.
231 # The NO_* variables should only be set by makefiles.
232 #
233
234 #
235 # Supported NO_* options (if defined, MK_* will be forced to "no",
236 # regardless of user's setting).
237 #
238 .for var in \
239     CTF \
240     DEBUG_FILES \
241     INSTALLLIB \
242     MAN \
243     PROFILE
244 .if defined(NO_${var})
245 .if defined(WITH_${var})
246 .undef WITH_${var}
247 .endif
248 WITHOUT_${var}=
249 .endif
250 .endfor
251
252 #
253 # Older-style variables that enabled behaviour when set.
254 #
255 .if defined(YES_HESIOD)
256 WITH_HESIOD=
257 .endif
258
259 __DEFAULT_YES_OPTIONS = \
260     ACCT \
261     ACPI \
262     AMD \
263     APM \
264     ARM_EABI \
265     ASSERT_DEBUG \
266     AT \
267     ATM \
268     AUDIT \
269     AUTHPF \
270     AUTOFS \
271     BHYVE \
272     BINUTILS \
273     BLUETOOTH \
274     BMAKE \
275     BOOT \
276     BOOTPARAMD \
277     BOOTPD \
278     BSD_CPIO \
279     BSDINSTALL \
280     BSNMP \
281     BZIP2 \
282     CALENDAR \
283     CAPSICUM \
284     CCD \
285     CDDL \
286     CPP \
287     CROSS_COMPILER \
288     CRYPT \
289     CTM \
290     CXX \
291     DIALOG \
292     DICT \
293     DYNAMICROOT \
294     ED_CRYPTO \
295     EE \
296     EXAMPLES \
297     FILE \
298     FINGER \
299     FLOPPY \
300     FMTREE \
301     FORMAT_EXTENSIONS \
302     FORTH \
303     FP_LIBC \
304     FREEBSD_UPDATE \
305     FTP \
306     GAMES \
307     GCOV \
308     GDB \
309     GNU \
310     GPIB \
311     GPIO \
312     GPL_DTC \
313     GROFF \
314     HAST \
315     HTML \
316     ICONV \
317     INET \
318     INET6 \
319     INETD \
320     INFO \
321     INSTALLLIB \
322     IPFILTER \
323     IPFW \
324     IPX \
325     ISCSI \
326     JAIL \
327     KDUMP \
328     KERBEROS \
329     KERNEL_SYMBOLS \
330     KVM \
331     LDNS \
332     LDNS_UTILS \
333     LEGACY_CONSOLE \
334     LIB32 \
335     LIBPTHREAD \
336     LIBTHR \
337     LOCALES \
338     LOCATE \
339     LPR \
340     LS_COLORS \
341     MAIL \
342     MAILWRAPPER \
343     MAKE \
344     MAN \
345     NCURSESW \
346     NDIS \
347     NETCAT \
348     NETGRAPH \
349     NIS \
350     NLS \
351     NLS_CATALOGS \
352     NMTREE \
353     NS_CACHING \
354     NTP \
355     OPENSSH \
356     OPENSSL \
357     PAM \
358     PC_SYSINSTALL \
359     PF \
360     PKGBOOTSTRAP \
361     PMC \
362     PORTSNAP \
363     PPP \
364     PROFILE \
365     QUOTAS \
366     RADIUS_SUPPORT \
367     RBOOTD \
368     RCMDS \
369     RCS \
370     RESCUE \
371     ROUTED \
372     SENDMAIL \
373     SETUID_LOGIN \
374     SHAREDOCS \
375     SOURCELESS \
376     SOURCELESS_HOST \
377     SOURCELESS_UCODE \
378     SSP \
379     SVNLITE \
380     SYMVER \
381     SYSCONS \
382     TALK \
383     TCSH \
384     TCP_WRAPPERS \
385     TELNET \
386     TEXTPROC \
387     TFTP \
388     TIMED \
389     TOOLCHAIN \
390     UNBOUND \
391     USB \
392     UTMPX \
393     VT \
394     WIRELESS \
395     WPA_SUPPLICANT_EAPOL \
396     ZFS \
397     ZONEINFO
398
399 __DEFAULT_NO_OPTIONS = \
400     BSD_GREP \
401     CLANG_EXTRAS \
402     CTF \
403     DEBUG_FILES \
404     HESIOD \
405     INSTALL_AS_USER \
406     LLDB \
407     NAND \
408     OFED \
409     PKGTOOLS \
410     RPCBIND_WARMSTART_SUPPORT \
411     SHARED_TOOLCHAIN \
412     SVN \
413     TESTS \
414     USB_GADGET_EXAMPLES \
415     ZONEINFO_LEAPSECONDS_SUPPORT \
416     ZONEINFO_OLD_TIMEZONES_SUPPORT \
417
418
419 #
420 # Default behaviour of some options depends on the architecture.  Unfortunately
421 # this means that we have to test TARGET_ARCH (the buildworld case) as well
422 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
423 # used at all in bsd.*.mk, but we have to make an exception here if we want
424 # to allow defaults for some things like clang and fdt to vary by target
425 # architecture.
426 #
427 .if defined(TARGET_ARCH)
428 __T=${TARGET_ARCH}
429 .else
430 __T=${MACHINE_ARCH}
431 .endif
432 .if defined(TARGET)
433 __TT=${TARGET}
434 .else
435 __TT=${MACHINE}
436 .endif
437 # Clang is only for x86, powerpc and little-endian arm right now, by default.
438 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
439 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
440 .elif ${__T} == "arm" || ${__T} == "armv6"
441 __DEFAULT_YES_OPTIONS+=CLANG
442 # GCC is unable to build the full clang on arm, disable it by default.
443 __DEFAULT_NO_OPTIONS+=CLANG_FULL
444 .else
445 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
446 .endif
447 # Clang the default system compiler only on little-endian arm and x86.
448 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
449     ${__T} == "i386"
450 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
451 # The pc98 bootloader requires gcc to build and so we must leave gcc enabled
452 # for pc98 for now.
453 .if ${__TT} == "pc98"
454 __DEFAULT_NO_OPTIONS+=GNUCXX
455 __DEFAULT_YES_OPTIONS+=GCC
456 .else
457 __DEFAULT_NO_OPTIONS+=GCC GNUCXX
458 .endif
459 .else
460 # If clang is not cc, then build gcc by default
461 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
462 __DEFAULT_YES_OPTIONS+=GCC
463 # And if g++ is c++, build the rest of the GNU C++ stack
464 .if defined(WITHOUT_CXX)
465 __DEFAULT_NO_OPTIONS+=GNUCXX
466 .else
467 __DEFAULT_YES_OPTIONS+=GNUCXX
468 .endif
469 .endif
470 .if ${__T} == "amd64" || ${__T} == "i386" || \
471     ${__T} == "powerpc64" || ${__T} == "sparc64"
472 __DEFAULT_YES_OPTIONS+=CXGBETOOL
473 .else
474 __DEFAULT_NO_OPTIONS+=CXGBETOOL
475 .endif
476 # FDT is needed only for arm, mips and powerpc
477 .if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
478 __DEFAULT_YES_OPTIONS+=FDT
479 .else
480 __DEFAULT_NO_OPTIONS+=FDT
481 .endif
482 # HyperV is only available for x86 and amd64.
483 .if ${__T} == "amd64" || ${__T} == "i386"
484 __DEFAULT_YES_OPTIONS+=HYPERV
485 .else
486 __DEFAULT_NO_OPTIONS+=HYPERV
487 .endif
488 .undef __T
489
490 #
491 # MK_* options which default to "yes".
492 #
493 .for var in ${__DEFAULT_YES_OPTIONS}
494 .if !defined(MK_${var})
495 .if defined(WITH_${var}) && defined(WITHOUT_${var})
496 .error WITH_${var} and WITHOUT_${var} can't both be set.
497 .endif
498 .if defined(WITHOUT_${var})
499 MK_${var}:=     no
500 .else
501 MK_${var}:=     yes
502 .endif
503 .endif  # !defined(MK_${var})
504 .endfor
505 .undef __DEFAULT_YES_OPTIONS
506
507 #
508 # MK_* options which default to "no".
509 #
510 .for var in ${__DEFAULT_NO_OPTIONS}
511 .if !defined(MK_${var})
512 .if defined(WITH_${var}) && defined(WITHOUT_${var})
513 .error WITH_${var} and WITHOUT_${var} can't both be set.
514 .endif
515 .if defined(WITH_${var})
516 MK_${var}:=     yes
517 .else
518 MK_${var}:=     no
519 .endif
520 .endif  # !defined(MK_${var})
521 .endfor
522 .undef __DEFAULT_NO_OPTIONS
523
524 #
525 # Force some options off if their dependencies are off.
526 # Order is somewhat important.
527 #
528 .if ${MK_LIBPTHREAD} == "no"
529 MK_LIBTHR:=     no
530 .endif
531
532 .if ${MK_LDNS} == "no"
533 MK_LDNS_UTILS:= no
534 MK_UNBOUND:= no
535 .endif
536
537 .if ${MK_SOURCELESS} == "no"
538 MK_SOURCELESS_HOST:=    no
539 MK_SOURCELESS_UCODE:= no
540 .endif
541
542 .if ${MK_CDDL} == "no"
543 MK_ZFS:=        no
544 MK_CTF:=        no
545 .endif
546
547 .if ${MK_CRYPT} == "no"
548 MK_OPENSSL:=    no
549 MK_OPENSSH:=    no
550 MK_KERBEROS:=   no
551 .endif
552
553 .if ${MK_CXX} == "no"
554 MK_CLANG:=      no
555 MK_GROFF:=      no
556 .endif
557
558 .if ${MK_DIALOG} == "no"
559 MK_BSDINSTALL:= no
560 .endif
561
562 .if ${MK_MAIL} == "no"
563 MK_MAILWRAPPER:= no
564 MK_SENDMAIL:=   no
565 .endif
566
567 .if ${MK_NETGRAPH} == "no"
568 MK_ATM:=        no
569 MK_BLUETOOTH:=  no
570 .endif
571
572 .if ${MK_NLS} == "no"
573 MK_NLS_CATALOGS:= no
574 .endif
575
576 .if ${MK_OPENSSL} == "no"
577 MK_OPENSSH:=    no
578 MK_KERBEROS:=   no
579 .endif
580
581 .if ${MK_PF} == "no"
582 MK_AUTHPF:=     no
583 .endif
584
585 .if ${MK_TEXTPROC} == "no"
586 MK_GROFF:=      no
587 .endif
588
589 .if ${MK_TOOLCHAIN} == "no"
590 MK_BINUTILS:=   no
591 MK_CLANG:=      no
592 MK_GCC:=        no
593 MK_GDB:=        no
594 .endif
595
596 .if ${MK_ZONEINFO} == "no"
597 MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
598 MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no
599 .endif
600
601 .if ${MK_CLANG} == "no"
602 MK_CLANG_EXTRAS:= no
603 MK_CLANG_FULL:= no
604 .endif
605
606 .if ${MK_CLANG_IS_CC} == "no"
607 MK_LLDB:= no
608 .endif
609
610 .if defined(NO_TESTS)
611 # This should be handled above along the handling of all other NO_*  options.
612 # However, the above is broken when WITH_*=yes are passed to make(1) as
613 # command line arguments.  See PR bin/183762.
614 #
615 # Because the TESTS option is new and it will default to yes, it's likely
616 # that people will pass WITHOUT_TESTS=yes to make(1) directly and get a broken
617 # build.  So, just in case, it's better to explicitly handle this case here.
618 #
619 # TODO(jmmv): Either fix make to allow us putting this override where it
620 # belongs above or fix this file to cope with the make bug.
621 MK_TESTS:= no
622 .endif
623
624 #
625 # Set defaults for the MK_*_SUPPORT variables.
626 #
627
628 #
629 # MK_* options whose default value depends on another option.
630 #
631 .for vv in \
632     GSSAPI/KERBEROS \
633     MAN_UTILS/MAN
634 .if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
635 .error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
636 .endif
637 .if defined(WITH_${vv:H})
638 MK_${vv:H}:=    yes
639 .elif defined(WITHOUT_${vv:H})
640 MK_${vv:H}:=    no
641 .else
642 MK_${vv:H}:=    ${MK_${vv:T}}
643 .endif
644 .endfor
645
646 #
647 # MK_*_SUPPORT options which default to "yes" unless their corresponding
648 # MK_* variable is set to "no".
649 #
650 .for var in \
651     BZIP2 \
652     GNU \
653     INET \
654     INET6 \
655     IPX \
656     KERBEROS \
657     KVM \
658     NETGRAPH \
659     PAM \
660     WIRELESS
661 .if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
662 .error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
663 .endif
664 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
665 MK_${var}_SUPPORT:= no
666 .else
667 MK_${var}_SUPPORT:= yes
668 .endif
669 .endfor
670
671 #
672 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
673 #
674 .include <bsd.compiler.mk>
675 .for var in \
676     LIBCPLUSPLUS
677 .if defined(WITH_${var}) && defined(WITHOUT_${var})
678 .error WITH_${var} and WITHOUT_${var} can't both be set.
679 .endif
680 .if ${COMPILER_FEATURES:Mc++11}
681 .if defined(WITHOUT_${var})
682 MK_${var}:=     no
683 .else
684 MK_${var}:=     yes
685 .endif
686 .else
687 .if defined(WITH_${var})
688 MK_${var}:=     yes
689 .else
690 MK_${var}:=     no
691 .endif
692 .endif
693 .endfor
694
695 .if ${MK_CTF} != "no"
696 CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
697 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
698 CTFCONVERT_CMD=
699 .else
700 CTFCONVERT_CMD= @:
701 .endif 
702
703 .if ${MK_INSTALL_AS_USER} != "no"
704 _uid!=  id -u
705 .if ${_uid} != 0
706 .if !defined(USER)
707 USER!=  id -un
708 .endif
709 _gid!=  id -gn
710 .for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
711 $xOWN=  ${USER}
712 $xGRP=  ${_gid}
713 .endfor
714 .endif
715 .endif
716
717 .endif # !_WITHOUT_SRCCONF
718
719 # Pointer to the top directory into which tests are installed.  Should not be
720 # overriden by Makefiles, but the user may choose to set this in src.conf(5).
721 TESTSBASE?= /usr/tests
722
723 .endif  # !target(__<bsd.own.mk>__)