]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.own.mk
sync from head
[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}) || ${SRCCONF} != "/etc/src.conf"
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     LDNS \
299     LEGACY_CONSOLE \
300     LIB32 \
301     LIBPTHREAD \
302     LIBTHR \
303     LOCALES \
304     LOCATE \
305     LPR \
306     LS_COLORS \
307     MAIL \
308     MAILWRAPPER \
309     MAKE \
310     MAN \
311     NDIS \
312     NETCAT \
313     NETGRAPH \
314     NIS \
315     NLS \
316     NLS_CATALOGS \
317     NS_CACHING \
318     NTP \
319     OPENSSH \
320     OPENSSL \
321     PAM \
322     PC_SYSINSTALL \
323     PF \
324     PKGBOOTSTRAP \
325     PKGTOOLS \
326     PMC \
327     PORTSNAP \
328     PPP \
329     PROFILE \
330     QUOTAS \
331     RCMDS \
332     RCS \
333     RESCUE \
334     ROUTED \
335     SENDMAIL \
336     SETUID_LOGIN \
337     SHAREDOCS \
338     SOURCELESS \
339     SOURCELESS_HOST \
340     SOURCELESS_UCODE \
341     SSP \
342     SYMVER \
343     SYSCONS \
344     SYSINSTALL \
345     TCSH \
346     TELNET \
347     TEXTPROC \
348     TOOLCHAIN \
349     USB \
350     UTMPX \
351     WIRELESS \
352     WPA_SUPPLICANT_EAPOL \
353     ZFS \
354     ZONEINFO
355
356 __DEFAULT_NO_OPTIONS = \
357     ARM_EABI \
358     AUTO_OBJ \
359     BIND_IDN \
360     BIND_LARGE_FILE \
361     BIND_LIBS \
362     BIND_SIGCHASE \
363     BIND_XML \
364     BMAKE \
365     BSDCONFIG \
366     BSD_GREP \
367     BSD_PATCH \
368     CLANG_EXTRAS \
369     CTF \
370     GPL_DTC \
371     HESIOD \
372     ICONV \
373     IDEA \
374     INSTALL_AS_USER \
375     LDNS_UTILS \
376     META_MODE \
377     NAND \
378     NMTREE \
379     OFED \
380     OPENSSH_NONE_CIPHER \
381     SHARED_TOOLCHAIN \
382     STAGING \
383     STAGING_PROG
384
385 #
386 # Default behaviour of some options depends on the architecture.  Unfortunately
387 # this means that we have to test TARGET_ARCH (the buildworld case) as well
388 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
389 # used at all in bsd.*.mk, but we have to make an exception here if we want
390 # to allow defaults for some things like clang and fdt to vary by target
391 # architecture.
392 #
393 .if defined(TARGET_ARCH)
394 __T=${TARGET_ARCH}
395 .else
396 __T=${MACHINE_ARCH}
397 .endif
398 # Clang is only for x86, powerpc and little-endian arm right now, by default.
399 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
400 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
401 .elif ${__T} == "arm" || ${__T} == "armv6"
402 __DEFAULT_YES_OPTIONS+=CLANG
403 # GCC is unable to build the full clang on arm, disable it by default.
404 __DEFAULT_NO_OPTIONS+=CLANG_FULL
405 .else
406 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
407 .endif
408 # Clang the default system compiler only on little-endian arm and x86.
409 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
410     ${__T} == "i386"
411 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
412 .else
413 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
414 .endif
415 # FDT is needed only for arm, mips and powerpc
416 .if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
417 __DEFAULT_YES_OPTIONS+=FDT
418 .else
419 __DEFAULT_NO_OPTIONS+=FDT
420 .endif
421 .undef __T
422
423 #
424 # MK_* options which default to "yes".
425 #
426 .for var in ${__DEFAULT_YES_OPTIONS}
427 .if defined(WITH_${var}) && defined(WITHOUT_${var})
428 .error WITH_${var} and WITHOUT_${var} can't both be set.
429 .endif
430 .if defined(MK_${var})
431 .error MK_${var} can't be set by a user.
432 .endif
433 .if defined(WITHOUT_${var})
434 MK_${var}:=     no
435 .else
436 MK_${var}:=     yes
437 .endif
438 .endfor
439 .undef __DEFAULT_YES_OPTIONS
440
441 #
442 # MK_* options which default to "no".
443 #
444 .for var in ${__DEFAULT_NO_OPTIONS}
445 .if defined(WITH_${var}) && defined(WITHOUT_${var})
446 .error WITH_${var} and WITHOUT_${var} can't both be set.
447 .endif
448 .if defined(MK_${var})
449 .error MK_${var} can't be set by a user.
450 .endif
451 .if defined(WITH_${var})
452 MK_${var}:=     yes
453 .else
454 MK_${var}:=     no
455 .endif
456 .endfor
457 .undef __DEFAULT_NO_OPTIONS
458
459 #
460 # Force some options off if their dependencies are off.
461 # Order is somewhat important.
462 #
463 .if ${MK_LIBPTHREAD} == "no"
464 MK_LIBTHR:=     no
465 .endif
466
467 .if ${MK_LIBTHR} == "no"
468 MK_BIND:=       no
469 .endif
470
471 .if ${MK_BIND} == "no"
472 MK_BIND_DNSSEC:= no
473 MK_BIND_ETC:=   no
474 MK_BIND_LIBS:=  no
475 MK_BIND_LIBS_LWRES:= no
476 MK_BIND_MTREE:= no
477 MK_BIND_NAMED:= no
478 MK_BIND_UTILS:= no
479 .endif
480
481 .if ${MK_LDNS} == "no"
482 MK_LDNS_UTILS:= no
483 .endif
484
485 .if ${MK_LDNS_UTILS} != "no"
486 MK_BIND_UTILS:= no
487 .endif
488
489 .if ${MK_BIND_MTREE} == "no"
490 MK_BIND_ETC:=   no
491 .endif
492
493 .if ${MK_SOURCELESS} == "no"
494 MK_SOURCELESS_HOST:=    no
495 MK_SOURCELESS_UCODE:= no
496 .endif
497
498 .if ${MK_CDDL} == "no"
499 MK_ZFS:=        no
500 MK_CTF:=        no
501 .endif
502
503 .if ${MK_CRYPT} == "no"
504 MK_OPENSSL:=    no
505 MK_OPENSSH:=    no
506 MK_KERBEROS:=   no
507 .endif
508
509 .if ${MK_CXX} == "no"
510 MK_CLANG:=      no
511 MK_GROFF:=      no
512 .endif
513
514 .if ${MK_MAIL} == "no"
515 MK_MAILWRAPPER:= no
516 MK_SENDMAIL:=   no
517 .endif
518
519 .if ${MK_NETGRAPH} == "no"
520 MK_ATM:=        no
521 MK_BLUETOOTH:=  no
522 .endif
523
524 .if ${MK_OPENSSL} == "no"
525 MK_OPENSSH:=    no
526 MK_KERBEROS:=   no
527 .endif
528
529 .if ${MK_PF} == "no"
530 MK_AUTHPF:=     no
531 .endif
532
533 .if ${MK_TEXTPROC} == "no"
534 MK_GROFF:=      no
535 .endif
536
537 .if ${MK_TOOLCHAIN} == "no"
538 MK_BINUTILS:=   no
539 MK_CLANG:=      no
540 MK_GCC:=        no
541 MK_GDB:=        no
542 .endif
543
544 .if ${MK_CLANG} == "no"
545 MK_CLANG_EXTRAS:= no
546 MK_CLANG_FULL:= no
547 MK_CLANG_IS_CC:= no
548 .endif
549
550 .if !defined(.PARSEDIR)
551 MK_AUTO_OBJ:=   no
552 MK_META_MODE:=  no
553 .endif
554
555 .if ${MK_META_MODE} == "no"
556 MK_STAGING:=    no
557 MK_STAGING_PROG:= no
558 .endif
559
560 #
561 # Set defaults for the MK_*_SUPPORT variables.
562 #
563
564 #
565 # MK_*_SUPPORT options which default to "yes" unless their corresponding
566 # MK_* variable is set to "no".
567 #
568 .for var in \
569     BZIP2 \
570     GNU \
571     INET \
572     INET6 \
573     IPX \
574     KERBEROS \
575     KVM \
576     NETGRAPH \
577     PAM \
578     WIRELESS
579 .if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT)
580 .error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set.
581 .endif
582 .if defined(MK_${var}_SUPPORT)
583 .error MK_${var}_SUPPORT can't be set by a user.
584 .endif
585 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
586 MK_${var}_SUPPORT:= no
587 .else
588 MK_${var}_SUPPORT:= yes
589 .endif
590 .endfor
591
592 #
593 # MK_* options whose default value depends on another option.
594 #
595 .for vv in \
596     GSSAPI/KERBEROS \
597     MAN_UTILS/MAN
598 .if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
599 .error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set.
600 .endif
601 .if defined(MK_${vv:H})
602 .error MK_${vv:H} can't be set by a user.
603 .endif
604 .if defined(WITH_${vv:H})
605 MK_${vv:H}:=    yes
606 .elif defined(WITHOUT_${vv:H})
607 MK_${vv:H}:=    no
608 .else
609 MK_${vv:H}:=    ${MK_${vv:T}}
610 .endif
611 .endfor
612
613 #
614 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
615 #
616 .include <bsd.compiler.mk>
617 .for var in \
618     LIBCPLUSPLUS
619 .if defined(WITH_${var}) && defined(WITHOUT_${var})
620 .error WITH_${var} and WITHOUT_${var} can't both be set.
621 .endif
622 .if defined(MK_${var})
623 .error MK_${var} can't be set by a user.
624 .endif
625 .if ${COMPILER_FEATURES:Mc++11}
626 .if defined(WITHOUT_${var})
627 MK_${var}:=     no
628 .else
629 MK_${var}:=     yes
630 .endif
631 .else
632 .if defined(WITH_${var})
633 MK_${var}:=     yes
634 .else
635 MK_${var}:=     no
636 .endif
637 .endif
638 .endfor
639
640 .if ${MK_CTF} != "no"
641 CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
642 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
643 CTFCONVERT_CMD=
644 .else
645 CTFCONVERT_CMD= @:
646 .endif 
647
648 .if ${MK_INSTALL_AS_USER} != "no"
649 _uid!=  id -u
650 .if ${_uid} != 0
651 .if !defined(USER)
652 USER!=  id -un
653 .endif
654 _gid!=  id -gn
655 .for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
656 $xOWN=  ${USER}
657 $xGRP=  ${_gid}
658 .endfor
659 .endif
660 .endif
661
662 .endif # !_WITHOUT_SRCCONF
663
664 .endif  # !target(__<bsd.own.mk>__)