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