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