]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - share/mk/bsd.own.mk
MFC r315762:
[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     DICT \
292     DYNAMICROOT \
293     ED_CRYPTO \
294     EE \
295     EXAMPLES \
296     FILE \
297     FINGER \
298     FLOPPY \
299     FMTREE \
300     FORMAT_EXTENSIONS \
301     FORTH \
302     FP_LIBC \
303     FREEBSD_UPDATE \
304     FTP \
305     GAMES \
306     GCOV \
307     GDB \
308     GNU \
309     GPIB \
310     GPIO \
311     GPL_DTC \
312     GROFF \
313     HAST \
314     HTML \
315     ICONV \
316     INET \
317     INET6 \
318     INETD \
319     INFO \
320     INSTALLLIB \
321     IPFILTER \
322     IPFW \
323     IPX \
324     ISCSI \
325     JAIL \
326     KDUMP \
327     KERBEROS \
328     KERNEL_SYMBOLS \
329     KVM \
330     LDNS \
331     LDNS_UTILS \
332     LEGACY_CONSOLE \
333     LIB32 \
334     LIBPTHREAD \
335     LIBTHR \
336     LOCALES \
337     LOCATE \
338     LPR \
339     LS_COLORS \
340     MAIL \
341     MAILWRAPPER \
342     MAKE \
343     MAN \
344     NCURSESW \
345     NDIS \
346     NETCAT \
347     NETGRAPH \
348     NIS \
349     NLS \
350     NLS_CATALOGS \
351     NMTREE \
352     NS_CACHING \
353     NTP \
354     OPENSSH \
355     OPENSSL \
356     PAM \
357     PC_SYSINSTALL \
358     PF \
359     PKGBOOTSTRAP \
360     PMC \
361     PORTSNAP \
362     PPP \
363     PROFILE \
364     QUOTAS \
365     RADIUS_SUPPORT \
366     RBOOTD \
367     RCMDS \
368     RCS \
369     RESCUE \
370     ROUTED \
371     SENDMAIL \
372     SETUID_LOGIN \
373     SHAREDOCS \
374     SOURCELESS \
375     SOURCELESS_HOST \
376     SOURCELESS_UCODE \
377     SSP \
378     SVNLITE \
379     SYMVER \
380     SYSCONS \
381     TALK \
382     TCSH \
383     TCP_WRAPPERS \
384     TELNET \
385     TEXTPROC \
386     TFTP \
387     TIMED \
388     TOOLCHAIN \
389     UNBOUND \
390     USB \
391     UTMPX \
392     VT \
393     WIRELESS \
394     WPA_SUPPLICANT_EAPOL \
395     ZFS \
396     ZONEINFO
397
398 __DEFAULT_NO_OPTIONS = \
399     BSD_GREP \
400     CLANG_EXTRAS \
401     CTF \
402     DEBUG_FILES \
403     HESIOD \
404     INSTALL_AS_USER \
405     LLDB \
406     NAND \
407     OFED \
408     PKGTOOLS \
409     SHARED_TOOLCHAIN \
410     SVN \
411     TESTS \
412     USB_GADGET_EXAMPLES
413
414 #
415 # Default behaviour of some options depends on the architecture.  Unfortunately
416 # this means that we have to test TARGET_ARCH (the buildworld case) as well
417 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
418 # used at all in bsd.*.mk, but we have to make an exception here if we want
419 # to allow defaults for some things like clang and fdt to vary by target
420 # architecture.
421 #
422 .if defined(TARGET_ARCH)
423 __T=${TARGET_ARCH}
424 .else
425 __T=${MACHINE_ARCH}
426 .endif
427 .if defined(TARGET)
428 __TT=${TARGET}
429 .else
430 __TT=${MACHINE}
431 .endif
432 # Clang is only for x86, powerpc and little-endian arm right now, by default.
433 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
434 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
435 .elif ${__T} == "arm" || ${__T} == "armv6"
436 __DEFAULT_YES_OPTIONS+=CLANG
437 # GCC is unable to build the full clang on arm, disable it by default.
438 __DEFAULT_NO_OPTIONS+=CLANG_FULL
439 .else
440 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
441 .endif
442 # Clang the default system compiler only on little-endian arm and x86.
443 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
444     ${__T} == "i386"
445 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
446 # The pc98 bootloader requires gcc to build and so we must leave gcc enabled
447 # for pc98 for now.
448 .if ${__TT} == "pc98"
449 __DEFAULT_NO_OPTIONS+=GNUCXX
450 __DEFAULT_YES_OPTIONS+=GCC
451 .else
452 __DEFAULT_NO_OPTIONS+=GCC GNUCXX
453 .endif
454 .else
455 # If clang is not cc, then build gcc by default
456 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
457 __DEFAULT_YES_OPTIONS+=GCC
458 # And if g++ is c++, build the rest of the GNU C++ stack
459 .if defined(WITHOUT_CXX)
460 __DEFAULT_NO_OPTIONS+=GNUCXX
461 .else
462 __DEFAULT_YES_OPTIONS+=GNUCXX
463 .endif
464 .endif
465 # FDT is needed only for arm, mips and powerpc
466 .if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
467 __DEFAULT_YES_OPTIONS+=FDT
468 .else
469 __DEFAULT_NO_OPTIONS+=FDT
470 .endif
471 # HyperV is only available for x86 and amd64.
472 .if ${__T} == "amd64" || ${__T} == "i386"
473 __DEFAULT_YES_OPTIONS+=HYPERV
474 .else
475 __DEFAULT_NO_OPTIONS+=HYPERV
476 .endif
477 .undef __T
478
479 #
480 # MK_* options which default to "yes".
481 #
482 .for var in ${__DEFAULT_YES_OPTIONS}
483 .if !defined(MK_${var})
484 .if defined(WITH_${var}) && defined(WITHOUT_${var})
485 .error WITH_${var} and WITHOUT_${var} can't both be set.
486 .endif
487 .if defined(WITHOUT_${var})
488 MK_${var}:=     no
489 .else
490 MK_${var}:=     yes
491 .endif
492 .endif  # !defined(MK_${var})
493 .endfor
494 .undef __DEFAULT_YES_OPTIONS
495
496 #
497 # MK_* options which default to "no".
498 #
499 .for var in ${__DEFAULT_NO_OPTIONS}
500 .if !defined(MK_${var})
501 .if defined(WITH_${var}) && defined(WITHOUT_${var})
502 .error WITH_${var} and WITHOUT_${var} can't both be set.
503 .endif
504 .if defined(WITH_${var})
505 MK_${var}:=     yes
506 .else
507 MK_${var}:=     no
508 .endif
509 .endif  # !defined(MK_${var})
510 .endfor
511 .undef __DEFAULT_NO_OPTIONS
512
513 #
514 # Force some options off if their dependencies are off.
515 # Order is somewhat important.
516 #
517 .if ${MK_LIBPTHREAD} == "no"
518 MK_LIBTHR:=     no
519 .endif
520
521 .if ${MK_LDNS} == "no"
522 MK_LDNS_UTILS:= no
523 MK_UNBOUND:= no
524 .endif
525
526 .if ${MK_SOURCELESS} == "no"
527 MK_SOURCELESS_HOST:=    no
528 MK_SOURCELESS_UCODE:= no
529 .endif
530
531 .if ${MK_CDDL} == "no"
532 MK_ZFS:=        no
533 MK_CTF:=        no
534 .endif
535
536 .if ${MK_CRYPT} == "no"
537 MK_OPENSSL:=    no
538 MK_OPENSSH:=    no
539 MK_KERBEROS:=   no
540 .endif
541
542 .if ${MK_CXX} == "no"
543 MK_CLANG:=      no
544 MK_GROFF:=      no
545 .endif
546
547 .if ${MK_MAIL} == "no"
548 MK_MAILWRAPPER:= no
549 MK_SENDMAIL:=   no
550 .endif
551
552 .if ${MK_NETGRAPH} == "no"
553 MK_ATM:=        no
554 MK_BLUETOOTH:=  no
555 .endif
556
557 .if ${MK_OPENSSL} == "no"
558 MK_OPENSSH:=    no
559 MK_KERBEROS:=   no
560 .endif
561
562 .if ${MK_PF} == "no"
563 MK_AUTHPF:=     no
564 .endif
565
566 .if ${MK_TEXTPROC} == "no"
567 MK_GROFF:=      no
568 .endif
569
570 .if ${MK_TOOLCHAIN} == "no"
571 MK_BINUTILS:=   no
572 MK_CLANG:=      no
573 MK_GCC:=        no
574 MK_GDB:=        no
575 .endif
576
577 .if ${MK_CLANG} == "no"
578 MK_CLANG_EXTRAS:= no
579 MK_CLANG_FULL:= no
580 .endif
581
582 .if ${MK_CLANG_IS_CC} == "no"
583 MK_LLDB:= no
584 .endif
585
586 .if defined(NO_TESTS)
587 # This should be handled above along the handling of all other NO_*  options.
588 # However, the above is broken when WITH_*=yes are passed to make(1) as
589 # command line arguments.  See PR bin/183762.
590 #
591 # Because the TESTS option is new and it will default to yes, it's likely
592 # that people will pass WITHOUT_TESTS=yes to make(1) directly and get a broken
593 # build.  So, just in case, it's better to explicitly handle this case here.
594 #
595 # TODO(jmmv): Either fix make to allow us putting this override where it
596 # belongs above or fix this file to cope with the make bug.
597 MK_TESTS:= no
598 .endif
599
600 #
601 # Set defaults for the MK_*_SUPPORT variables.
602 #
603
604 #
605 # MK_* options whose default value depends on another option.
606 #
607 .for vv in \
608     GSSAPI/KERBEROS \
609     MAN_UTILS/MAN
610 .if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
611 .error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
612 .endif
613 .if defined(WITH_${vv:H})
614 MK_${vv:H}:=    yes
615 .elif defined(WITHOUT_${vv:H})
616 MK_${vv:H}:=    no
617 .else
618 MK_${vv:H}:=    ${MK_${vv:T}}
619 .endif
620 .endfor
621
622 #
623 # MK_*_SUPPORT options which default to "yes" unless their corresponding
624 # MK_* variable is set to "no".
625 #
626 .for var in \
627     BZIP2 \
628     GNU \
629     INET \
630     INET6 \
631     IPX \
632     KERBEROS \
633     KVM \
634     NETGRAPH \
635     PAM \
636     WIRELESS
637 .if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
638 .error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
639 .endif
640 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
641 MK_${var}_SUPPORT:= no
642 .else
643 MK_${var}_SUPPORT:= yes
644 .endif
645 .endfor
646
647 #
648 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
649 #
650 .include <bsd.compiler.mk>
651 .for var in \
652     LIBCPLUSPLUS
653 .if defined(WITH_${var}) && defined(WITHOUT_${var})
654 .error WITH_${var} and WITHOUT_${var} can't both be set.
655 .endif
656 .if ${COMPILER_FEATURES:Mc++11}
657 .if defined(WITHOUT_${var})
658 MK_${var}:=     no
659 .else
660 MK_${var}:=     yes
661 .endif
662 .else
663 .if defined(WITH_${var})
664 MK_${var}:=     yes
665 .else
666 MK_${var}:=     no
667 .endif
668 .endif
669 .endfor
670
671 .if ${MK_CTF} != "no"
672 CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
673 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
674 CTFCONVERT_CMD=
675 .else
676 CTFCONVERT_CMD= @:
677 .endif 
678
679 .if ${MK_INSTALL_AS_USER} != "no"
680 _uid!=  id -u
681 .if ${_uid} != 0
682 .if !defined(USER)
683 USER!=  id -un
684 .endif
685 _gid!=  id -gn
686 .for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
687 $xOWN=  ${USER}
688 $xGRP=  ${_gid}
689 .endfor
690 .endif
691 .endif
692
693 .endif # !_WITHOUT_SRCCONF
694
695 # Pointer to the top directory into which tests are installed.  Should not be
696 # overriden by Makefiles, but the user may choose to set this in src.conf(5).
697 TESTSBASE?= /usr/tests
698
699 .endif  # !target(__<bsd.own.mk>__)