]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.own.mk
Import libc++ trunk r165949. Among other improvements and bug fixes,
[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 # Common variables
185 .if !defined(DEBUG_FLAGS)
186 STRIP?=         -s
187 .endif
188
189 COMPRESS_CMD?=  gzip -cn
190 COMPRESS_EXT?=  .gz
191
192 .if !defined(_WITHOUT_SRCCONF)
193 #
194 # Define MK_* variables (which are either "yes" or "no") for users
195 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
196 # make(1) environment.
197 # These should be tested with `== "no"' or `!= "no"' in makefiles.
198 # The NO_* variables should only be set by makefiles.
199 #
200
201 #
202 # Supported NO_* options (if defined, MK_* will be forced to "no",
203 # regardless of user's setting).
204 #
205 .for var in \
206     CTF \
207     INSTALLLIB \
208     MAN \
209     PROFILE
210 .if defined(NO_${var})
211 .if defined(WITH_${var})
212 .undef WITH_${var}
213 .endif
214 WITHOUT_${var}=
215 .endif
216 .endfor
217
218 #
219 # Compat NO_* options (same as above, except their use is deprecated).
220 #
221 .if !defined(BURN_BRIDGES)
222 .for var in \
223     ACPI \
224     ATM \
225     AUDIT \
226     AUTHPF \
227     BIND \
228     BIND_DNSSEC \
229     BIND_ETC \
230     BIND_LIBS_LWRES \
231     BIND_MTREE \
232     BIND_NAMED \
233     BIND_UTILS \
234     BLUETOOTH \
235     BOOT \
236     CALENDAR \
237     CPP \
238     CRYPT \
239     CVS \
240     CXX \
241     DICT \
242     DYNAMICROOT \
243     EXAMPLES \
244     FORTH \
245     FP_LIBC \
246     GAMES \
247     GCOV \
248     GDB \
249     GNU \
250     GPIB \
251     GROFF \
252     HTML \
253     INET6 \
254     INFO \
255     IPFILTER \
256     IPX \
257     KDUMP \
258     KERBEROS \
259     LIB32 \
260     LIBPTHREAD \
261     LIBTHR \
262     LOCALES \
263     LPR \
264     MAILWRAPPER \
265     NETCAT \
266     NIS \
267     NLS \
268     NLS_CATALOGS \
269     NS_CACHING \
270     OPENSSH \
271     OPENSSL \
272     PAM \
273     PF \
274     RCMDS \
275     RCS \
276     RESCUE \
277     SENDMAIL \
278     SETUID_LOGIN \
279     SHAREDOCS \
280     SYSCONS \
281     TCSH \
282     TOOLCHAIN \
283     USB \
284     WPA_SUPPLICANT_EAPOL
285 .if defined(NO_${var})
286 #.warning NO_${var} is deprecated in favour of WITHOUT_${var}=
287 WITHOUT_${var}=
288 .endif
289 .endfor
290 .endif # !defined(BURN_BRIDGES)
291
292 #
293 # Older-style variables that enabled behaviour when set.
294 #
295 .if defined(YES_HESIOD)
296 WITH_HESIOD=
297 .endif
298 .if defined(MAKE_IDEA)
299 WITH_IDEA=
300 .endif
301
302 __DEFAULT_YES_OPTIONS = \
303     ACCT \
304     ACPI \
305     AMD \
306     APM \
307     ASSERT_DEBUG \
308     AT \
309     ATF \
310     ATM \
311     AUDIT \
312     AUTHPF \
313     BIND \
314     BIND_DNSSEC \
315     BIND_ETC \
316     BIND_LIBS_LWRES \
317     BIND_MTREE \
318     BIND_NAMED \
319     BIND_UTILS \
320     BINUTILS \
321     BLUETOOTH \
322     BOOT \
323     BSD_CPIO \
324     BSNMP \
325     SOURCELESS \
326     SOURCELESS_HOST \
327     SOURCELESS_UCODE \
328     BZIP2 \
329     CALENDAR \
330     CAPSICUM \
331     CDDL \
332     CPP \
333     CRYPT \
334     CTM \
335     CVS \
336     CXX \
337     DICT \
338     DYNAMICROOT \
339     ED_CRYPTO \
340     EXAMPLES \
341     FLOPPY \
342     FORTH \
343     FP_LIBC \
344     FREEBSD_UPDATE \
345     GAMES \
346     GCC \
347     GCOV \
348     GDB \
349     GNU \
350     GPIB \
351     GPIO \
352     GROFF \
353     HTML \
354     INET \
355     INET6 \
356     INFO \
357     INSTALLLIB \
358     IPFILTER \
359     IPFW \
360     IPX \
361     JAIL \
362     KDUMP \
363     KERBEROS \
364     KERNEL_SYMBOLS \
365     KVM \
366     LEGACY_CONSOLE \
367     LIB32 \
368     LIBPTHREAD \
369     LIBTHR \
370     LOCALES \
371     LOCATE \
372     LPR \
373     LS_COLORS \
374     MAIL \
375     MAILWRAPPER \
376     MAKE \
377     MAN \
378     NDIS \
379     NETCAT \
380     NETGRAPH \
381     NIS \
382     NLS \
383     NLS_CATALOGS \
384     NS_CACHING \
385     NTP \
386     OPENSSH \
387     OPENSSL \
388     PAM \
389     PF \
390     PKGBOOTSTRAP \
391     PKGTOOLS \
392     PMC \
393     PORTSNAP \
394     PPP \
395     PROFILE \
396     QUOTAS \
397     RCMDS \
398     RCS \
399     RESCUE \
400     ROUTED \
401     SENDMAIL \
402     SETUID_LOGIN \
403     SHAREDOCS \
404     SSP \
405     SYSINSTALL \
406     SYMVER \
407     SYSCONS \
408     TCSH \
409     TELNET \
410     TEXTPROC \
411     TOOLCHAIN \
412     USB \
413     UTMPX \
414     WIRELESS \
415     WPA_SUPPLICANT_EAPOL \
416     ZFS \
417     ZONEINFO
418
419 __DEFAULT_NO_OPTIONS = \
420     BMAKE \
421     BSD_GREP \
422     BIND_IDN \
423     BIND_LARGE_FILE \
424     BIND_LIBS \
425     BIND_SIGCHASE \
426     BIND_XML \
427     BSDCONFIG \
428     CLANG_EXTRAS \
429     CLANG_IS_CC \
430     CTF \
431     HESIOD \
432     ICONV \
433     IDEA \
434     INSTALL_AS_USER \
435     NAND \
436     OFED \
437     SHARED_TOOLCHAIN
438
439 #
440 # Default behaviour of some options depends on the architecture.  Unfortunately
441 # this means that we have to test TARGET_ARCH (the buildworld case) as well
442 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
443 # used at all in bsd.*.mk, but we have to make an exception here if we want
444 # to allow defaults for some things like clang and fdt to vary by target
445 # architecture.
446 #
447 .if defined(TARGET_ARCH)
448 __T=${TARGET_ARCH}
449 .else
450 __T=${MACHINE_ARCH}
451 .endif
452 # Clang is only for x86 and powerpc right now, by default.
453 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
454 __DEFAULT_YES_OPTIONS+=CLANG
455 .else
456 __DEFAULT_NO_OPTIONS+=CLANG
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 .undef __T
465
466 #
467 # MK_* options which default to "yes".
468 #
469 .for var in ${__DEFAULT_YES_OPTIONS}
470 .if defined(WITH_${var}) && defined(WITHOUT_${var})
471 .error WITH_${var} and WITHOUT_${var} can't both be set.
472 .endif
473 .if defined(MK_${var})
474 .error MK_${var} can't be set by a user.
475 .endif
476 .if defined(WITHOUT_${var})
477 MK_${var}:=     no
478 .else
479 MK_${var}:=     yes
480 .endif
481 .endfor
482 .undef __DEFAULT_YES_OPTIONS
483
484 #
485 # MK_* options which default to "no".
486 #
487 .for var in ${__DEFAULT_NO_OPTIONS}
488 .if defined(WITH_${var}) && defined(WITHOUT_${var})
489 .error WITH_${var} and WITHOUT_${var} can't both be set.
490 .endif
491 .if defined(MK_${var})
492 .error MK_${var} can't be set by a user.
493 .endif
494 .if defined(WITH_${var})
495 MK_${var}:=     yes
496 .else
497 MK_${var}:=     no
498 .endif
499 .endfor
500 .undef __DEFAULT_NO_OPTIONS
501
502 #
503 # Force some options off if their dependencies are off.
504 # Order is somewhat important.
505 #
506 .if ${MK_LIBPTHREAD} == "no"
507 MK_LIBTHR:=     no
508 .endif
509
510 .if ${MK_LIBTHR} == "no"
511 MK_BIND:=       no
512 .endif
513
514 .if ${MK_BIND} == "no"
515 MK_BIND_DNSSEC:= no
516 MK_BIND_ETC:=   no
517 MK_BIND_LIBS:=  no
518 MK_BIND_LIBS_LWRES:= no
519 MK_BIND_MTREE:= no
520 MK_BIND_NAMED:= no
521 MK_BIND_UTILS:= no
522 .endif
523
524 .if ${MK_BIND_MTREE} == "no"
525 MK_BIND_ETC:=   no
526 .endif
527
528 .if ${MK_SOURCELESS} == "no"
529 MK_SOURCELESS_HOST:=    no
530 MK_SOURCELESS_UCODE:= no
531 .endif
532
533 .if ${MK_CDDL} == "no"
534 MK_ZFS:=        no
535 MK_CTF:=        no
536 .endif
537
538 .if ${MK_CLANG} == "no"
539 MK_CLANG_EXTRAS:= no
540 .endif
541
542 .if ${MK_CRYPT} == "no"
543 MK_OPENSSL:=    no
544 MK_OPENSSH:=    no
545 MK_KERBEROS:=   no
546 .endif
547
548 .if ${MK_CXX} == "no"
549 MK_CLANG:=      no
550 MK_GROFF:=      no
551 .endif
552
553 .if ${MK_MAIL} == "no"
554 MK_MAILWRAPPER:= no
555 MK_SENDMAIL:=   no
556 .endif
557
558 .if ${MK_NETGRAPH} == "no"
559 MK_ATM:=        no
560 MK_BLUETOOTH:=  no
561 .endif
562
563 .if ${MK_OPENSSL} == "no"
564 MK_OPENSSH:=    no
565 MK_KERBEROS:=   no
566 .endif
567
568 .if ${MK_PF} == "no"
569 MK_AUTHPF:=     no
570 .endif
571
572 .if ${MK_TEXTPROC} == "no"
573 MK_GROFF:=      no
574 .endif
575
576 .if ${MK_TOOLCHAIN} == "no"
577 MK_BINUTILS:=   no
578 MK_CLANG:=      no
579 MK_GCC:=        no
580 MK_GDB:=        no
581 .endif
582
583 .if ${MK_CLANG} == "no"
584 MK_CLANG_IS_CC:= no
585 .endif
586
587 #
588 # Set defaults for the MK_*_SUPPORT variables.
589 #
590
591 #
592 # MK_*_SUPPORT options which default to "yes" unless their corresponding
593 # MK_* variable is set to "no".
594 #
595 .for var in \
596     BZIP2 \
597     GNU \
598     INET \
599     INET6 \
600     IPX \
601     KERBEROS \
602     KVM \
603     NETGRAPH \
604     PAM \
605     WIRELESS
606 .if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
607 .error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
608 .endif
609 .if defined(MK_${var}_SUPPORT)
610 .error MK_${var}_SUPPORT can't be set by a user.
611 .endif
612 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
613 MK_${var}_SUPPORT:= no
614 .else
615 MK_${var}_SUPPORT:= yes
616 .endif
617 .endfor
618
619 #
620 # MK_* options whose default value depends on another option.
621 #
622 .for vv in \
623     GSSAPI/KERBEROS \
624     MAN_UTILS/MAN
625 .if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
626 .error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
627 .endif
628 .if defined(MK_${vv:H})
629 .error MK_${vv:H} can't be set by a user.
630 .endif
631 .if defined(WITH_${vv:H})
632 MK_${vv:H}:=    yes
633 .elif defined(WITHOUT_${vv:H})
634 MK_${vv:H}:=    no
635 .else
636 MK_${vv:H}:=    ${MK_${vv:T}}
637 .endif
638 .endfor
639
640 #
641 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
642 #
643 .include <bsd.compiler.mk>
644 .for var in \
645     LIBCPLUSPLUS
646 .if defined(WITH_${var}) && defined(WITHOUT_${var})
647 .error WITH_${var} and WITHOUT_${var} can't both be set.
648 .endif
649 .if defined(MK_${var})
650 .error MK_${var} can't be set by a user.
651 .endif
652 .if ${COMPILER_FEATURES:Mc++11}
653 .if defined(WITHOUT_${var})
654 MK_${var}:=     no
655 .else
656 MK_${var}:=     yes
657 .endif
658 .else
659 .if defined(WITH_${var})
660 MK_${var}:=     yes
661 .else
662 MK_${var}:=     no
663 .endif
664 .endif
665 .endfor
666
667 .if ${MK_CTF} != "no"
668 CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
669 .elif defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300
670 CTFCONVERT_CMD=
671 .else
672 CTFCONVERT_CMD= @:
673 .endif 
674
675 .if ${MK_INSTALL_AS_USER} != "no"
676 _uid!=  id -un
677 .if ${_uid} != 0
678 _gid!=  id -gn
679 .for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
680 $xOWN=  ${_uid}
681 $xGRP=  ${_gid}
682 .endfor
683 .endif
684 .endif
685
686 .endif # !_WITHOUT_SRCCONF
687
688 .endif  # !target(__<bsd.own.mk>__)