bsd.README revision 1.99
11.99Sitojun#	$NetBSD: bsd.README,v 1.99 2002/06/09 04:04:32 itojun Exp $
21.24Smikel#	@(#)bsd.README	8.2 (Berkeley) 4/2/94
31.1Scgd
41.1ScgdThis is the README file for the new make "include" files for the BSD
51.1Scgdsource tree.  The files are installed in /usr/share/mk, and are, by
61.11Sjtcconvention, named with the suffix ".mk".
71.1Scgd
81.1ScgdNote, this file is not intended to replace reading through the .mk
91.1Scgdfiles for anything tricky.
101.1Scgd
111.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
121.1Scgd
131.1ScgdRANDOM THINGS WORTH KNOWING:
141.1Scgd
151.1ScgdThe files are simply C-style #include files, and pretty much behave like
161.1Scgdyou'd expect.  The syntax is slightly different in that a single '.' is
171.1Scgdused instead of the hash mark, i.e. ".include <bsd.prog.mk>".
181.1Scgd
191.1ScgdOne difference that will save you lots of debugging time is that inclusion
201.1Scgdof the file is normally done at the *end* of the Makefile.  The reason for
211.1Scgdthis is because .mk files often modify variables and behavior based on the
221.1Scgdvalues of variables set in the Makefile.  To make this work, remember that
231.1Scgdthe FIRST target found is the target that is used, i.e. if the Makefile has:
241.1Scgd
251.1Scgd	a:
261.1Scgd		echo a
271.1Scgd	a:
281.1Scgd		echo a number two
291.1Scgd
301.1Scgdthe command "make a" will echo "a".  To make things confusing, the SECOND
311.1Scgdvariable assignment is the overriding one, i.e. if the Makefile has:
321.1Scgd
331.1Scgd	a=	foo
341.1Scgd	a=	bar
351.1Scgd
361.1Scgd	b:
371.1Scgd		echo ${a}
381.1Scgd
391.1Scgdthe command "make b" will echo "bar".  This is for compatibility with the
401.1Scgdway the V7 make behaved.
411.1Scgd
421.1ScgdIt's fairly difficult to make the BSD .mk files work when you're building
431.75Sagcmultiple programs in a single directory.  It's a lot easier to split up the
441.1Scgdprograms than to deal with the problem.  Most of the agony comes from making
451.36Srossthe "obj" directory stuff work right, not because we switched to a new version
461.1Scgdof make.  So, don't get mad at us, figure out a better way to handle multiple
471.1Scgdarchitectures so we can quit using the symbolic link stuff.  (Imake doesn't
481.1Scgdcount.)
491.1Scgd
501.1ScgdThe file .depend in the source directory is expected to contain dependencies
511.1Scgdfor the source files.  This file is read automatically by make after reading
521.1Scgdthe Makefile.
531.1Scgd
541.1ScgdThe variable DESTDIR works as before.  It's not set anywhere but will change
551.1Scgdthe tree where the file gets installed.
561.1Scgd
571.1ScgdThe profiled libraries are no longer built in a different directory than
581.1Scgdthe regular libraries.  A new suffix, ".po", is used to denote a profiled
591.21Schristosobject, and ".so" denotes a shared (position-independent) object.
601.97Sitojun
611.97SitojunThere are various make variables used during the build.  Basic rule for
621.97Sitojunthe variable naming scheme is as follows:
631.97Sitojun
641.97SitojunMKxxx		Can be set to `no' by a user to disable functionality.
651.97Sitojun		Defaults to `yes' (or usually does)
661.97Sitojun
671.97SitojunNOxxx		If defined, disables a feature.  Not intended for users,
681.97Sitojun		it's to allow Makefiles to disable functionality that
691.97Sitojun		they don't support (such as missing man pages).
701.21Schristos
711.45SlukemThe following variables that control how things are made/installed that
721.47Stvare not set by default. These should not be set by Makefiles; they're for
731.47Stvthe user to define in MAKECONF (see bsd.own.mk, below) or on the make(1)
741.47Stvcommand line:
751.21Schristos
761.45SlukemBUILD 		If defined, 'make install' checks that the targets in the
771.45Slukem		source directories are up-to-date and remakes them if they
781.21Schristos                are out of date, instead of blindly trying to install
791.79Swiz                out of date or non-existent targets.
801.21Schristos
811.45SlukemUPDATE 		If defined, 'make install' only installs targets that are
821.45Slukem		more recently modified in the source directories that their
831.45Slukem		installed counterparts.
841.52Ssimonb
851.83SperryUNPRIVED	If defined, don't set the owner/group/mode when installing
861.83Sperry		files or directories, and keep a metadata log of what
871.83Sperry		the owner/group/mode should be.  This allows a
881.83Sperry		non-root "make install".
891.45Slukem
901.86SthorpejMKBFD		If "no", don't build libbfd, libiberty, or any of
911.86Sthorpej		the things that depend on them (binutils/gas/ld,
921.86Sthorpej		gdb, dbsym, mdsetimage).  Only meaningful if
931.86Sthorpej		USE_NEW_TOOLCHAIN is set.
941.86Sthorpej
951.45SlukemMKCATPAGES	If "no", don't build or install the catman pages.
961.45Slukem
971.45SlukemMKDOC		If "no", don't build or install the documentation.
981.86Sthorpej
991.86SthorpejMKGDB		If "no", don't build gdb.  Only meaningful if
1001.86Sthorpej		USE_NEW_TOOLCHAIN is set.
1011.86Sthorpej
1021.86SthorpejMKGCC		If "no", don't build gcc or any of the gcc-related
1031.86Sthorpej		libraries (libg2c, libgcc, libobjc, libstdc++).
1041.86Sthorpej		Only meaningful if USE_NEW_TOOLCHAIN is set.
1051.92Sross
1061.92SrossMKIEEEFP	If "no", don't add code for IEEE754/IEC60559 conformance.
1071.92Sross		Has no effect on most platforms.
1081.45Slukem
1091.47StvMKINFO		If "no", don't build or install Info documentation from
1101.47Stv		Texinfo source files.
1111.45Slukem
1121.45SlukemMKLINT		If "no", don't build or install the lint libraries.
1131.45Slukem
1141.45SlukemMKMAN		If "no", don't build or install the man or catman pages.
1151.46Slukem		Also acts as "MKCATPAGES=no"
1161.45Slukem
1171.74SitojunMKNLS		If "no", don't build or install the NLS files and locale
1181.74Sitojun		definition files.
1191.45Slukem
1201.55SsommerfeMKOBJ		If "no", don't enable the rule which creates objdirs.
1211.55Ssommerfe		"yes" by default.
1221.55Ssommerfe
1231.55SsommerfeMKOBJDIRS	If "no", don't create objdirs during a "make build".
1241.55Ssommerfe		"no" by default.
1251.45Slukem
1261.45SlukemMKPIC		If "no", don't build or install shared libraries.
1271.45Slukem
1281.45SlukemMKPICINSTALL	If "no", don't install the *_pic.a libraries.
1291.45Slukem
1301.45SlukemMKPROFILE	If "no", don't build or install the profiling libraries.
1311.45Slukem
1321.48SlukemMKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no
1331.48Slukem		MKNLS=no".  I.e, don't build catman pages, documentation,
1341.48Slukem		Info documentation, man pages, NLS files, ...
1351.1Scgd
1361.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1371.1Scgd
1381.1ScgdThe include file <sys.mk> has the default rules for all makes, in the BSD
1391.1Scgdenvironment or otherwise.  You probably don't want to touch this file.
1401.71SitojunIf you intend to run a cross build, you will need to supply the following
1411.71Sitojunhost tools, and configure the following variables properly:
1421.71Sitojun
1431.71SitojunOBJCOPY		objcopy - copy and translate object files
1441.71Sitojun
1451.71SitojunSTRIP		strip - Discard symbols from object files
1461.71Sitojun
1471.71SitojunCONFIG		config - build kernel compilation directories
1481.71Sitojun
1491.71SitojunRPCGEN		rpcgen - Remote Procedure Call (RPC) protocol compiler
1501.71Sitojun
1511.71SitojunMKLOCALE	mklocale - make LC_CTYPE locale files
1521.80Sjmc
1531.80SjmcMTREE		mtree - build directory tree from a spec file
1541.1Scgd
1551.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1561.1Scgd
1571.1ScgdThe include file <bsd.man.mk> handles installing manual pages and their
1581.1Scgdlinks.
1591.1Scgd
1601.21SchristosIt has a two targets:
1611.1Scgd
1621.1Scgd	maninstall:
1631.21Schristos		Install the manual page sources and their links.
1641.21Schristos	catinstall:
1651.21Schristos		Install the preformatted manual pages and their links.
1661.1Scgd
1671.1ScgdIt sets/uses the following variables:
1681.1Scgd
1691.1ScgdMANDIR		Base path for manual installation.
1701.1Scgd
1711.1ScgdMANGRP		Manual group.
1721.1Scgd
1731.1ScgdMANOWN		Manual owner.
1741.1Scgd
1751.1ScgdMANMODE		Manual mode.
1761.1Scgd
1771.1ScgdMANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
1781.1Scgd		or "/tahoe" for machine specific manual pages.
1791.1Scgd
1801.15ScgdMAN		The manual pages to be installed (use a .1 - .9 suffix).
1811.1Scgd
1821.15ScgdMLINKS		List of manual page links (using a .1 - .9 suffix).  The
1831.1Scgd		linked-to file must come first, the linked file second,
1841.1Scgd		and there may be multiple pairs.  The files are soft-linked.
1851.1Scgd
1861.1ScgdThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1871.1Scgdit exists.
1881.1Scgd
1891.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1901.1Scgd
1911.17SthorpejThe include file <bsd.own.mk> contains source tree configuration parameters,
1921.17Sthorpejsuch as the owners, groups, etc. for both manual pages and binaries, and
1931.17Sthorpeja few global "feature configuration" parameters.
1941.1Scgd
1951.1ScgdIt has no targets.
1961.1Scgd
1971.29ScjsTo get system-specific configuration parameters, bsd.own.mk will try to
1981.29Scjsinclude the file specified by the "MAKECONF" variable.  If MAKECONF is not
1991.29Scjsset, or no such file exists, the system make configuration file, /etc/mk.conf
2001.29Scjsis included.  These files may define any of the variables described below.
2011.17Sthorpej
2021.17Sthorpejbsd.own.mk sets the following variables, if they are not already defined
2031.17Sthorpej(defaults are in brackets):
2041.15Scgd
2051.98SlukemNETBSDSRCDIR	Top of the NetBSD source tree.
2061.98Slukem		If _SRC_TOP_ != "", that will be used as the default,
2071.98Slukem		otherwise BSDSRCDIR will be used as the default.
2081.98Slukem		Various makefiles within the NetBSD source tree will
2091.98Slukem		use this to reference the top level of the source tree.
2101.98Slukem
2111.95Slukem_SRC_TOP_	Top of the system source tree, as determined by <bsd.own.mk>
2121.98Slukem		based on the presence of tools/ and build.sh.  This variable
2131.98Slukem		is "internal" to <bsd.own.mk>, although its value is only
2141.98Slukem		determined once and then propagated to all sub-makes.
2151.95Slukem
2161.15ScgdBSDSRCDIR	The real path to the system sources, so that 'make obj'
2171.15Scgd		will work correctly. [/usr/src]
2181.15Scgd
2191.15ScgdBSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
2201.15Scgd		will work correctly. [/usr/obj]
2211.15Scgd
2221.34SlukemBINGRP		Binary group. [wheel]
2231.15Scgd
2241.34SlukemBINOWN		Binary owner. [root]
2251.15Scgd
2261.15ScgdBINMODE		Binary mode. [555]
2271.15Scgd
2281.15ScgdNONBINMODE	Mode for non-executable files. [444]
2291.15Scgd
2301.15ScgdMANDIR		Base path for manual installation. [/usr/share/man/cat]
2311.15Scgd
2321.34SlukemMANGRP		Manual group. [wheel]
2331.15Scgd
2341.34SlukemMANOWN		Manual owner. [root]
2351.15Scgd
2361.15ScgdMANMODE		Manual mode. [${NONBINMODE}]
2371.15Scgd
2381.21SchristosMANINSTALL	Manual installation type: maninstall, catinstall, or both
2391.76Sfair
2401.76SfairLDSTATIC	Control program linking; if set blank, link everything
2411.76Sfair		dynamically. If set to "-static", link everything statically.
2421.76Sfair		If not set, programs link according to their makefile.
2431.21Schristos
2441.15ScgdLIBDIR		Base path for library installation. [/usr/lib]
2451.15Scgd
2461.85SlukemSHLIBDIR	If ${USE_SHLIBDIR} is "yes", use ${SHLIBDIR} instead of
2471.85Slukem		${LIBDIR} as the base path for shared library installation.
2481.85Slukem		[/usr/lib]
2491.85Slukem
2501.85Slukem_LIBSODIR	Set to ${SHLIBDIR} if ${USE_SHLIBDIR} is "yes",
2511.85Slukem		otherwise set to ${LIBDIR}
2521.85Slukem
2531.85SlukemSHLINKDIR	Base path for shared linker. [/usr/libexec]
2541.85Slukem
2551.15ScgdLINTLIBDIR	Base path for lint(1) library installation. [/usr/libdata/lint]
2561.15Scgd
2571.15ScgdLIBGRP		Library group. [${BINGRP}]
2581.15Scgd
2591.15ScgdLIBOWN		Library owner. [${BINOWN}]
2601.15Scgd
2611.15ScgdLIBMODE		Library mode. [${NONBINMODE}]
2621.15Scgd
2631.15ScgdDOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
2641.15Scgd	        installation. [/usr/share/doc]
2651.62Ssimonb
2661.62SsimonbHTMLDOCDIR	Base path for html system documentation installation.
2671.62Ssimonb		[/usr/share/doc/html]
2681.15Scgd
2691.34SlukemDOCGRP		Documentation group. [wheel]
2701.15Scgd
2711.34SlukemDOCOWN		Documentation owner. [root]
2721.15Scgd
2731.15ScgdDOCMODE		Documentation mode. [${NONBINMODE}]
2741.15Scgd
2751.84SkleinkNLSDIR		Base path for Native Language Support files installation.
2761.15Scgd		[/usr/share/nls]
2771.1Scgd
2781.84SkleinkNLSGRP		Native Language Support files group. [wheel]
2791.1Scgd
2801.84SkleinkNLSOWN		Native Language Support files owner. [root]
2811.1Scgd
2821.84SkleinkNLSMODE		Native Language Support files mode. [${NONBINMODE}]
2831.1Scgd
2841.32SmikelSTRIPFLAG	The flag passed to the install program to cause the binary
2851.1Scgd		to be stripped.  This is to be used when building your
2861.1Scgd		own install script so that the entire system can be made
2871.15Scgd		stripped/not-stripped using a single knob. [-s]
2881.1Scgd
2891.2ScgdCOPY		The flag passed to the install program to cause the binary
2901.2Scgd		to be copied rather than moved.  This is to be used when
2911.2Scgd		building our own install script so that the entire system
2921.2Scgd		can either be installed with copies, or with moves using
2931.15Scgd		a single knob. [-c]
2941.15Scgd
2951.17SthorpejAdditionally, the following variables may be set by bsd.own.mk or in a
2961.17Sthorpejmake configuration file to modify the behaviour of the system build
2971.17Sthorpejprocess (default values are in brackets along with comments, if set by
2981.17Sthorpejbsd.own.mk):
2991.15Scgd
3001.64SthorpejMKCRYPTO	If set to "no", no cryptography support will be built
3011.64Sthorpej		into the system.  Defaults to "yes".
3021.64Sthorpej
3031.66SitojunMKCRYPTO_IDEA	If set to "yes", IDEA support will be built into
3041.66Sitojun		libcrypto_idea.a.  Defaults to "no".
3051.64Sthorpej
3061.66SitojunMKCRYPTO_RC5	If set to "yes", RC5 support will be built into
3071.66Sitojun		libcrypto_rc5.a.  Defaults to "no".
3081.64Sthorpej
3091.94SthorpejMKHESIOD	If set to "no", disables building of Hesiod infrastructure
3101.94Sthorpej		(libraries and support programs).
3111.64Sthorpej
3121.94SthorpejMKKERBEROS	If set to "no", disables building of Kerberos (v4 or v5)
3131.94Sthorpej		infrastructure (libraries and support programs).
3141.2Scgd
3151.94SthorpejMKSKEY		If set to "no", disables building of S/key authentication
3161.94Sthorpej		infrastructure (libraries and support programs).
3171.94Sthorpej
3181.94SthorpejMKYP		If set to "no", disables building of YP (NIS)
3191.94Sthorpej		infrastructure (libraries and support programs).
3201.94Sthorpej
3211.94SthorpejUSE_HESIOD	If set to "no", disables building Hesiod support into
3221.94Sthorpej		various system utilities/libraries that support it.
3231.94Sthorpej		If MKHESIOD is set to "no", USE_HESIOD will also be
3241.94Sthorpej		forced to "no".
3251.94Sthorpej
3261.94SthorpejUSE_KERBEROS	If set to "no", disables building Kerberos (v4 or v5)
3271.94Sthorpej		support into various system utilities/libraries that
3281.94Sthorpej		support it.  If MKKERBEROS is set to "no", USE_KERBEROS
3291.94Sthorpej		will also be forced to "no".
3301.94Sthorpej
3311.94SthorpejUSE_SKEY	If set to "no", disables building S/key authentication
3321.94Sthorpej		support into various system utilities/libraries that
3331.94Sthorpej		support it.  If MKSKEY is set to "no", USE_SKEY will
3341.94Sthorpej		also be forced to "no".
3351.94Sthorpej
3361.94SthorpejUSE_YP		If set to "no", disables building YP (NIS) support into
3371.94Sthorpej		various system utilities/libraries that support it.  If
3381.94Sthorpej		MKYP is set to "no", USE_YP will also be forced to "no".
3391.15Scgd
3401.15ScgdMANZ		Compress manual pages at installation time.
3411.15Scgd
3421.15ScgdSYS_INCLUDE	Copy or symlink kernel include files into /usr/include.
3431.15Scgd		Possible values are "symlinks" or "copies" (which is
3441.15Scgd		the same as the variable being unset).
3451.1Scgd
3461.15ScgdNOPROFILE	Do not build profiled versions of system libraries
3471.1Scgd
3481.15ScgdNOPIC		Do not build PIC versions of system libraries, and
3491.15Scgd		do not build shared libraries.  [set if ${MACHINE_ARCH}
3501.65Sjlam		is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.]
3511.1Scgd
3521.40SperryNOLINT		Do not build lint libraries.
3531.33Sjonathan
3541.50SthorpejOBJECT_FMT	Object file format. [set to "ELF" on architectures that
3551.50Sthorpej		use ELF -- currently if ${MACHINE_ARCH} is "alpha",
3561.50Sthorpej		"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
3571.77Ssimonb		"i386" and some m68k machines, or set to "a.out" on
3581.77Ssimonb		other architectures].
3591.33Sjonathan
3601.78SsimonbMKSOFTFLOAT	If "yes", build with options to enable the compiler to
3611.78Ssimonb		generate output containing library calls for floating
3621.78Ssimonb		point and possibly soft-float library support.  Defaults
3631.78Ssimonb		to "no".
3641.1Scgd
3651.17Sthorpejbsd.own.mk is generally useful when building your own Makefiles so that
3661.1Scgdthey use the same default owners etc. as the rest of the tree.
3671.1Scgd
3681.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3691.1Scgd
3701.1ScgdThe include file <bsd.prog.mk> handles building programs from one or
3711.1Scgdmore source files, along with their manual pages.  It has a limited number
3721.1Scgdof suffixes, consistent with the current needs of the BSD tree.
3731.1Scgd
3741.16SjtcIt has eight targets:
3751.1Scgd
3761.1Scgd	all:
3771.1Scgd		build the program and its manual page
3781.1Scgd	clean:
3791.1Scgd		remove the program, any object files and the files a.out,
3801.24Smikel		Errs, errs, mklog, and ${PROG}.core.
3811.1Scgd	cleandir:
3821.1Scgd		remove all of the files removed by the target clean, as
3831.1Scgd		well as .depend, tags, and any manual pages.
3841.42Slukem		`distclean' is a synonym for `cleandir'.
3851.1Scgd	depend:
3861.1Scgd		make the dependencies for the source files, and store
3871.1Scgd		them in the file .depend.
3881.16Sjtc	includes:
3891.16Sjtc		install any header files.
3901.1Scgd	install:
3911.1Scgd		install the program and its manual pages; if the Makefile
3921.1Scgd		does not itself define the target install, the targets
3931.1Scgd		beforeinstall and afterinstall may also be used to cause
3941.1Scgd		actions immediately before and after the install target
3951.1Scgd		is executed.
3961.1Scgd	lint:
3971.1Scgd		run lint on the source files
3981.1Scgd	tags:
3991.1Scgd		create a tags file for the source files.
4001.1Scgd
4011.1ScgdIt sets/uses the following variables:
4021.1Scgd
4031.1ScgdBINGRP		Binary group.
4041.1Scgd
4051.1ScgdBINOWN		Binary owner.
4061.1Scgd
4071.1ScgdBINMODE		Binary mode.
4081.1Scgd
4091.1ScgdCLEANFILES	Additional files to remove for the clean and cleandir targets.
4101.1Scgd
4111.1ScgdCOPTS		Additional flags to the compiler when creating C objects.
4121.35Slukem
4131.35SlukemCPPFLAGS	Additional flags to the C pre-processor
4141.1Scgd
4151.1ScgdLDADD		Additional loader objects.  Usually used for libraries.
4161.1Scgd		For example, to load with the compatibility and utility
4171.1Scgd		libraries, use:
4181.1Scgd
4191.5Sjtc			LDADD+=-lutil -lcompat
4201.1Scgd
4211.1ScgdLDFLAGS		Additional loader flags.
4221.1Scgd
4231.1ScgdLINKS		The list of binary links; should be full pathnames, the
4241.1Scgd		linked-to file coming first, followed by the linked
4251.1Scgd		file.  The files are hard-linked.  For example, to link
4261.1Scgd		/bin/test and /bin/[, use:
4271.1Scgd
4281.1Scgd			LINKS=	${DESTDIR}/bin/test ${DESTDIR}/bin/[
4291.19Sperry
4301.19SperrySYMLINKS	The list of symbolic links; should be full pathnames.
4311.20Sperry                Syntax is identical to LINKS. Note that DESTDIR is not
4321.20Sperry		automatically included in the link.
4331.1Scgd
4341.15ScgdMAN		Manual pages (should end in .1 - .9).  If no MAN variable is
4351.8Scgd		defined, "MAN=${PROG}.1" is assumed.
4361.1Scgd
4371.1ScgdPROG		The name of the program to build.  If not supplied, nothing
4381.1Scgd		is built.
4391.1Scgd
4401.88SthorpejPROG_CXX	If defined, the name of the program to build.  Also
4411.88Sthorpej		causes <bsd.prog.mk> to link the program with the C++
4421.88Sthorpej		compiler rather than the C compiler.  PROG_CXX overrides
4431.88Sthorpej		the value of PROG if PROG is also set.
4441.87Sthorpej
4451.21SchristosPROGNAME	The name that the above program will be installed as, if
4461.21Schristos		different from ${PROG}.
4471.21Schristos
4481.37StvSRCS		List of source files to build the program.  If SRCS is not
4491.1Scgd		defined, it's assumed to be ${PROG}.c.
4501.1Scgd
4511.1ScgdDPADD		Additional dependencies for the program.  Usually used for
4521.1Scgd		libraries.  For example, to depend on the compatibility and
4531.1Scgd		utility libraries use:
4541.1Scgd
4551.5Sjtc			DPADD+=${LIBCOMPAT} ${LIBUTIL}
4561.1Scgd
4571.1Scgd		The following libraries are predefined for DPADD:
4581.1Scgd
4591.21Schristos		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
4601.99Sitojun		LIBBZ2?=	${DESTDIR}/usr/lib/libbz2.a
4611.21Schristos		LIBC?=		${DESTDIR}/usr/lib/libc.a
4621.21Schristos		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
4631.99Sitojun		LIBCDK?=	${DESTDIR}/usr/lib/libcdk.a
4641.99Sitojun		LIBCOM_ERR?=	${DESTDIR}/usr/lib/libcom_err.a
4651.21Schristos		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
4661.21Schristos		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
4671.99Sitojun		LIBCRYPTO?=	${DESTDIR}/usr/lib/libcrypto.a
4681.99Sitojun		LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a
4691.99Sitojun		LIBCRYPTO_RC5?=	${DESTDIR}/usr/lib/libcrypto_rc5.a
4701.21Schristos		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
4711.21Schristos		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
4721.21Schristos		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
4731.21Schristos		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
4741.73Sblymn		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
4751.21Schristos		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
4761.21Schristos		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
4771.99Sitojun		LIBGSSAPI?=	${DESTDIR}/usr/lib/libgssapi.a
4781.99Sitojun		LIBHDB?=	${DESTDIR}/usr/lib/libhdb.a
4791.70Sitojun		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
4801.49Sitojun		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
4811.99Sitojun		LIBKADM?=	${DESTDIR}/usr/lib/libkadm.a
4821.99Sitojun		LIBKADM5CLNT?=	${DESTDIR}/usr/lib/libkadm5clnt.a
4831.99Sitojun		LIBKADM5SRV?=	${DESTDIR}/usr/lib/libkadm5srv.a
4841.99Sitojun		LIBKAFS?=	${DESTDIR}/usr/lib/libkafs.a
4851.21Schristos		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
4861.21Schristos		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
4871.99Sitojun		LIBKRB5?=	${DESTDIR}/usr/lib/libkrb5.a
4881.99Sitojun		LIBKSTREAM?=	${DESTDIR}/usr/lib/libkstream.a
4891.21Schristos		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
4901.21Schristos		LIBL?=		${DESTDIR}/usr/lib/libl.a
4911.21Schristos		LIBM?=		${DESTDIR}/usr/lib/libm.a
4921.53Sblymn		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
4931.21Schristos		LIBMP?=		${DESTDIR}/usr/lib/libmp.a
4941.25Schristos		LIBNTP?=	${DESTDIR}/usr/lib/libntp.a
4951.99Sitojun		LIBOBJC?=	${DESTDIR}/usr/lib/libobjc.a
4961.99Sitojun		LIBOSSAUDIO?=	${DESTDIR}/usr/lib/libossaudio.a
4971.21Schristos		LIBPC?=		${DESTDIR}/usr/lib/libpc.a
4981.21Schristos		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
4991.99Sitojun		LIBPCI?=	${DESTDIR}/usr/lib/libpci.a
5001.21Schristos		LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a
5011.26Skleink		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
5021.21Schristos		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
5031.99Sitojun		LIBRMT?=	${DESTDIR}/usr/lib/librmt.a
5041.99Sitojun		LIBROKEN?=	${DESTDIR}/usr/lib/libroken.a
5051.21Schristos		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
5061.21Schristos		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
5071.99Sitojun		LIBSS?=		${DESTDIR}/usr/lib/libss.a
5081.99Sitojun		LIBSSL?=	${DESTDIR}/usr/lib/libssl.a
5091.99Sitojun		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
5101.99Sitojun		LIBSL?=		${DESTDIR}/usr/lib/libsl.a
5111.21Schristos		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
5121.21Schristos		LIBTELNET?=	${DESTDIR}/usr/lib/libtelnet.a
5131.99Sitojun		LIBUSBHID?=	${DESTDIR}/usr/lib/libusbhid.a
5141.21Schristos		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
5151.21Schristos		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
5161.21Schristos		LIBY?=		${DESTDIR}/usr/lib/liby.a
5171.21Schristos		LIBZ?=		${DESTDIR}/usr/lib/libz.a
5181.1Scgd
5191.1ScgdSHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
5201.12Schristos		strings, using xstr(1). Note that this will not work with
5211.12Schristos		parallel makes.
5221.1Scgd
5231.59SjlamSTRIPFLAG	The flag passed to the install program to cause the binary
5241.1Scgd		to be stripped.
5251.1Scgd
5261.1ScgdSUBDIR		A list of subdirectories that should be built as well.
5271.1Scgd		Each of the targets will execute the same target in the
5281.1Scgd		subdirectories.
5291.1Scgd
5301.21SchristosSCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
5311.21Schristos		These are installed exactly like programs.
5321.21Schristos
5331.21SchristosSCRIPTSNAME	The name that the above program will be installed as, if
5341.21Schristos		different from ${SCRIPTS}. These can be further specialized
5351.21Schristos		by setting SCRIPTSNAME_<script>.
5361.21Schristos
5371.21SchristosFILES		A list of files to install. The installation is controlled
5381.21Schristos		by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
5391.21Schristos		variables that can be further specialized by FILES<VAR>_<file>
5401.21Schristos
5411.85SlukemSHLINKDIR	Target directory for shared linker.
5421.85Slukem
5431.1ScgdThe include file <bsd.prog.mk> includes the file named "../Makefile.inc"
5441.1Scgdif it exists, as well as the include file <bsd.man.mk>.
5451.1Scgd
5461.1ScgdSome simple examples:
5471.1Scgd
5481.1ScgdTo build foo from foo.c with a manual page foo.1, use:
5491.1Scgd
5501.1Scgd	PROG=	foo
5511.1Scgd
5521.1Scgd	.include <bsd.prog.mk>
5531.1Scgd
5541.1ScgdTo build foo from foo.c with a manual page foo.2, add the line:
5551.1Scgd
5561.9Scgd	MAN=	foo.2
5571.1Scgd
5581.1ScgdIf foo does not have a manual page at all, add the line:
5591.1Scgd
5601.75Sagc	MKMAN=	no
5611.1Scgd
5621.1ScgdIf foo has multiple source files, add the line:
5631.1Scgd
5641.1Scgd	SRCS=	a.c b.c c.c d.c
5651.1Scgd
5661.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5671.1Scgd
5681.1ScgdThe include file <bsd.subdir.mk> contains the default targets for building
5691.16Sjtcsubdirectories.  It has the same eight targets as <bsd.prog.mk>: all, 
5701.16Sjtcclean, cleandir, depend, includes, install, lint, and tags.  For all of
5711.72Ssommerfethe directories listed in the variable SUBDIR, the specified directory 
5721.16Sjtcwill be visited and the target made.  There is also a default target which
5731.16Sjtcallows the command "make subdir" where subdir is any directory listed in
5741.72Ssommerfethe variable SUBDIR.
5751.72Ssommerfe
5761.72SsommerfeAs a special case, the use of a token .WAIT as an entry in SUBDIR acts
5771.72Ssommerfeas a synchronization barrier when multiple make jobs are run; subdirs
5781.72Ssommerfebefore the .WAIT must complete before any subdirs after .WAIT are
5791.75Sagcstarted.  See make(1) for some caveats on use of .WAIT and other
5801.75Sagcspecial sources.
5811.21Schristos
5821.21Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5831.21Schristos
5841.23SchristosThe include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
5851.23Schristosand is included from from bsd.lib.mk and bsd.prog.mk.
5861.23Schristos
5871.23Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5881.23Schristos
5891.23SchristosThe include file <bsd.files.mk> handles the FILES variables and is included
5901.23Schristosfrom bsd.lib.mk and bsd.prog.mk.
5911.21Schristos
5921.21Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5931.21Schristos
5941.29ScjsThe include file <bsd.inc.mk> defines the includes target and uses two
5951.29Scjsvariables:
5961.21Schristos
5971.81SwizINCS		The list of include files
5981.21Schristos
5991.81SwizINCSDIR		The location to install the include files.
6001.81Swiz
6011.81SwizINCSNAME	Target name of the include file, if only one; same as
6021.81Swiz		FILESNAME, but for include files.
6031.81Swiz
6041.81SwizINCSNAME_<file>	The name file <file> should be installed as, if not <file>,
6051.81Swiz		same as FILESNAME_<file>, but for include files.
6061.39Scgd
6071.39Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6081.39Scgd
6091.39ScgdThe include file <bsd.kinc.mk> defines the many targets (includes,
6101.39Scgdsubdirectories, etc.), and is used by kernel makefiles to handle
6111.39Scgdinclude file installation.  It is intended to be included alone, by
6121.39Scgdkernel Makefiles.  Please see bsd.kinc.mk for more details, and keep
6131.39Scgdthe documentation in that file up to date.
6141.13Schristos
6151.13Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6161.13Schristos
6171.47StvThe include file <bsd.info.mk> is used to generate and install GNU Info
6181.47Stvdocumentation from respective Texinfo source files.  It defines three
6191.47Stvimplicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
6201.47Stvfollowing variables:
6211.47Stv
6221.47StvTEXINFO		List of Texinfo source files.  Info documentation will
6231.47Stv		consist of single files with the extension replaced by
6241.47Stv		.info.
6251.47Stv
6261.47StvINFOFLAGS	Flags to pass to makeinfo.  []
6271.47Stv
6281.47StvINSTALL_INFO	Name of install-info program.  [install-info]
6291.47Stv
6301.47StvMAKEINFO	Name of makeinfo program.  [makeinfo]
6311.47Stv
6321.47Stv=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6331.47Stv
6341.13SchristosThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and
6351.14Scgd<bsd.lib.mk>.  It contains overrides that are used when building
6361.14Scgdthe NetBSD source tree.  For instance, if "PARALLEL" is defined by
6371.14Scgdthe program/library Makefile, it includes a set of rules for lex and
6381.14Scgdyacc that allow multiple lex and yacc targets to be built in parallel.
6391.69Ssommerfe
6401.69SsommerfeOther variables of note (incomplete list):
6411.69Ssommerfe
6421.82SlukemWARNS		Crank up gcc warning options; the distinct levels are:
6431.82Slukem			WARNS=1
6441.82Slukem			WARNS=2
6451.82Slukem			WARNS=3
6461.69Ssommerfe
6471.69SsommerfeFORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
6481.69SsommerfeWFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
6491.75Sagc		WFORMAT belongs in individual makefiles and/or
6501.75Sagc		Makefile.inc files.  (set WFORMAT=1 in individual
6511.75Sagc		makefiles if a program is not security critical and is
6521.75Sagc		doing bizarre things with format strings which would
6531.75Sagc		be even uglier if rewritten) FORMAT_AUDIT should go in
6541.75Sagc		mk.conf if you're doing format-string auditing. 
6551.69Ssommerfe		FORMAT_AUDIT may go away in time.
6561.1Scgd
6571.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6581.1Scgd
6591.1ScgdThe include file <bsd.lib.mk> has support for building libraries.  It has
6601.16Sjtcthe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
6611.44Serhincludes, install, lint, and tags.  Additionally, it has a checkver target
6621.44Serhwhich checks for installed shared object libraries whose version is greater
6631.44Serhthat the version of the source. It has a limited number of suffixes,
6641.16Sjtcconsistent with the current needs of the BSD tree.
6651.1Scgd
6661.1ScgdIt sets/uses the following variables:
6671.10Scgd
6681.10ScgdLIB		The name of the library to build.
6691.1Scgd
6701.1ScgdLIBDIR		Target directory for libraries.
6711.85Slukem
6721.85SlukemSHLIBDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
6731.85Slukem		is "yes".
6741.85Slukem
6751.85SlukemUSE_SHLIBDIR	If "yes", use ${SHLIBDIR} instead of ${LIBDIR}
6761.85Slukem		as the path to install shared libraries to.
6771.1Scgd
6781.1ScgdLINTLIBDIR	Target directory for lint libraries.
6791.1Scgd
6801.1ScgdLIBGRP		Library group.
6811.1Scgd
6821.1ScgdLIBOWN		Library owner.
6831.1Scgd
6841.1ScgdLIBMODE		Library mode.
6851.1Scgd
6861.1ScgdLDADD		Additional loader objects.
6871.1Scgd
6881.15ScgdMAN		The manual pages to be installed (use a .1 - .9 suffix).
6891.47Stv
6901.47StvMKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
6911.47Stv		Also:
6921.47Stv			- don't install the .a libraries
6931.47Stv			- don't install _pic.a libraries on PIC systems
6941.47Stv			- don't build .a libraries on PIC systems
6951.47Stv			- don't install the .so symlink on ELF systems
6961.47Stv		I.e, only install the shared library (and the .so.major
6971.47Stv		symlink on ELF).
6981.54Ssimonb
6991.54SsimonbMKPICLIB	If "no", don't build _pic.a libraries, and build the
7001.54Ssimonb		shared object libraries from the .a libraries.  A
7011.54Ssimonb		symlink is installed in ${DESTDIR}/usr/lib for the
7021.54Ssimonb		_pic.a library pointing to the .a library.
7031.44Serh
7041.44SerhNOCHECKVER_<library>
7051.44SerhNOCHECKVER	If set, disables checking for installed shared object
7061.44Serh		libraries with versions greater than the source.  A
7071.44Serh		particular library name, without the "lib" prefix, may
7081.44Serh		be appended to the variable name to disable the check for
7091.44Serh		only that library.
7101.1Scgd
7111.1ScgdSRCS		List of source files to build the library.  Suffix types
7121.1Scgd		.s, .c, and .f are supported.  Note, .s files are preferred
7131.1Scgd		to .c files of the same name.  (This is not the default for
7141.1Scgd		versions of make.)
7151.1Scgd
7161.1ScgdThe include file <bsd.lib.mk> includes the file named "../Makefile.inc"
7171.1Scgdif it exists, as well as the include file <bsd.man.mk>.
7181.1Scgd
7191.1ScgdIt has rules for building profiled objects; profiled libraries are
7201.1Scgdbuilt by default.
7211.1Scgd
7221.4ScgdLibraries are ranlib'd when made.
7231.56Ssommerfe
7241.56Ssommerfe=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7251.56Ssommerfe
7261.56SsommerfeThe include file <bsd.obj.mk> defines targets related to the creation
7271.56Ssommerfeand use of separated object and source directories.
7281.56Ssommerfe
7291.63SsjgIf an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
7301.63Ssjg${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
7311.75Sagcit exists.  Otherwise make(1) looks for the existence of a
7321.63Ssjgsubdirectory (or a symlink to a directory) of the source directory
7331.63Ssjginto which built targets should be placed.  If an environment variable
7341.63Ssjgnamed MAKEOBJDIR is set, make(1) uses its value as the name of the
7351.63Ssjgobject directory; failing that, make first looks for a subdirectory
7361.63Ssjgnamed "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
7371.56Ssommerfe
7381.56SsommerfeObject directories are not created automatically by make(1) if they
7391.56Ssommerfedon't exist; you need to run a separate "make obj".  (This will happen
7401.56Ssommerfeduring a top-level build if "MKOBJDIRS" is set to a value other than
7411.58Ssommerfe"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
7421.58Ssommerfeand this is determined by a simple string prefix comparison -- object
7431.58Ssommerfedirectories are created in a separate object directory tree, and a
7441.58Ssommerfesymlink to the object directory in that tree is created in the source
7451.58Ssommerfedirectory; otherwise, "make obj" assumes that you're not in the main
7461.58Ssommerfesource tree and that it's not safe to use a separate object tree.
7471.56Ssommerfe
7481.56SsommerfeSeveral variables used by <bsd.obj.mk> control exactly what
7491.56Ssommerfedirectories and links get created during a "make obj":
7501.56Ssommerfe
7511.56SsommerfeMAKEOBJDIR	If set, this is the component name of the object
7521.56Ssommerfe		directory.
7531.56Ssommerfe
7541.56SsommerfeOBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
7551.56Ssommerfe		object directories or links named "obj.${MACHINE}";
7561.56Ssommerfe		otherwise, just creates ones named "obj".
7571.56Ssommerfe
7581.56SsommerfeUSR_OBJMACHINE  If set, and the current directory is a subdirectory of
7591.56Ssommerfe		${BSDSRCDIR}, create object directory in the
7601.56Ssommerfe		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
7611.56Ssommerfe		otherwise, create it in the corresponding subdirectory
7621.56Ssommerfe		of ${BSDOBJDIR}
7631.93Sthorpej
7641.93SthorpejBUILDID		If set, the contents of this variable are appended
7651.93Sthorpej		to the object directory name.  If OBJMACHINE is also
7661.93Sthorpej		set, ".${BUILDID}" is added after ".${MACHINE}".
7671.63Ssjg
7681.63Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7691.63Ssjg
7701.63SsjgThe include file <bsd.kernobj.mk> defines variables related to the
7711.63Ssjglocation of kernel sources and object directories.
7721.63Ssjg
7731.63SsjgKERNSRCDIR	Is the location of the top of the kernel src.
7741.95Slukem		It defaults to ${_SRC_TOP_}/sys
7751.63Ssjg
7761.63SsjgKERNARCHDIR	Is the location of the machine dependent kernel
7771.63Ssjg		sources.  It defaults to arch/${MACHINE}
7781.63Ssjg		
7791.63SsjgKERNCONFDIR	Is where the configuration files for kernels are
7801.63Ssjg		found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
7811.63Ssjg
7821.63SsjgKERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
7831.63Ssjg		instance will be compiled in ${KERNOBJDIR}/GENERIC.
7841.63Ssjg		The default value is
7851.63Ssjg		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
7861.63Ssjg		if it exists or the target 'obj' is being made.
7871.63Ssjg		Otherwise the default is
7881.63Ssjg		${KERNSRCDIR}/${KERNARCHDIR}/compile.
7891.63Ssjg
7901.63SsjgIt is important that Makefiles (such as those under src/distrib) that
7911.63Ssjgwish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
7921.63Ssjgrather than make assumptions about the location of the compiled kernel.
7931.30Sagc
7941.30Sagc=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
795