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