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