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