bsd.README revision 1.92
11.92Sross#	$NetBSD: bsd.README,v 1.92 2002/01/27 23:33:51 ross 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.21Schristos
611.45SlukemThe following variables that control how things are made/installed that
621.47Stvare not set by default. These should not be set by Makefiles; they're for
631.47Stvthe user to define in MAKECONF (see bsd.own.mk, below) or on the make(1)
641.47Stvcommand line:
651.21Schristos
661.45SlukemBUILD 		If defined, 'make install' checks that the targets in the
671.45Slukem		source directories are up-to-date and remakes them if they
681.21Schristos                are out of date, instead of blindly trying to install
691.79Swiz                out of date or non-existent targets.
701.21Schristos
711.45SlukemUPDATE 		If defined, 'make install' only installs targets that are
721.45Slukem		more recently modified in the source directories that their
731.45Slukem		installed counterparts.
741.52Ssimonb
751.83SperryUNPRIVED	If defined, don't set the owner/group/mode when installing
761.83Sperry		files or directories, and keep a metadata log of what
771.83Sperry		the owner/group/mode should be.  This allows a
781.83Sperry		non-root "make install".
791.45Slukem
801.86SthorpejMKBFD		If "no", don't build libbfd, libiberty, or any of
811.86Sthorpej		the things that depend on them (binutils/gas/ld,
821.86Sthorpej		gdb, dbsym, mdsetimage).  Only meaningful if
831.86Sthorpej		USE_NEW_TOOLCHAIN is set.
841.86Sthorpej
851.45SlukemMKCATPAGES	If "no", don't build or install the catman pages.
861.45Slukem
871.45SlukemMKDOC		If "no", don't build or install the documentation.
881.86Sthorpej
891.86SthorpejMKGDB		If "no", don't build gdb.  Only meaningful if
901.86Sthorpej		USE_NEW_TOOLCHAIN is set.
911.86Sthorpej
921.86SthorpejMKGCC		If "no", don't build gcc or any of the gcc-related
931.86Sthorpej		libraries (libg2c, libgcc, libobjc, libstdc++).
941.86Sthorpej		Only meaningful if USE_NEW_TOOLCHAIN is set.
951.92Sross
961.92SrossMKIEEEFP	If "no", don't add code for IEEE754/IEC60559 conformance.
971.92Sross		Has no effect on most platforms.
981.45Slukem
991.47StvMKINFO		If "no", don't build or install Info documentation from
1001.47Stv		Texinfo source files.
1011.45Slukem
1021.45SlukemMKLINT		If "no", don't build or install the lint libraries.
1031.45Slukem
1041.45SlukemMKMAN		If "no", don't build or install the man or catman pages.
1051.46Slukem		Also acts as "MKCATPAGES=no"
1061.45Slukem
1071.74SitojunMKNLS		If "no", don't build or install the NLS files and locale
1081.74Sitojun		definition files.
1091.45Slukem
1101.55SsommerfeMKOBJ		If "no", don't enable the rule which creates objdirs.
1111.55Ssommerfe		"yes" by default.
1121.55Ssommerfe
1131.55SsommerfeMKOBJDIRS	If "no", don't create objdirs during a "make build".
1141.55Ssommerfe		"no" by default.
1151.45Slukem
1161.45SlukemMKPIC		If "no", don't build or install shared libraries.
1171.45Slukem
1181.45SlukemMKPICINSTALL	If "no", don't install the *_pic.a libraries.
1191.45Slukem
1201.45SlukemMKPROFILE	If "no", don't build or install the profiling libraries.
1211.45Slukem
1221.48SlukemMKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no
1231.48Slukem		MKNLS=no".  I.e, don't build catman pages, documentation,
1241.48Slukem		Info documentation, man pages, NLS files, ...
1251.1Scgd
1261.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1271.1Scgd
1281.1ScgdThe include file <sys.mk> has the default rules for all makes, in the BSD
1291.1Scgdenvironment or otherwise.  You probably don't want to touch this file.
1301.71SitojunIf you intend to run a cross build, you will need to supply the following
1311.71Sitojunhost tools, and configure the following variables properly:
1321.71Sitojun
1331.71SitojunOBJCOPY		objcopy - copy and translate object files
1341.71Sitojun
1351.71SitojunSTRIP		strip - Discard symbols from object files
1361.71Sitojun
1371.71SitojunCONFIG		config - build kernel compilation directories
1381.71Sitojun
1391.71SitojunRPCGEN		rpcgen - Remote Procedure Call (RPC) protocol compiler
1401.71Sitojun
1411.71SitojunMKLOCALE	mklocale - make LC_CTYPE locale files
1421.80Sjmc
1431.80SjmcMTREE		mtree - build directory tree from a spec file
1441.1Scgd
1451.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1461.1Scgd
1471.1ScgdThe include file <bsd.man.mk> handles installing manual pages and their
1481.1Scgdlinks.
1491.1Scgd
1501.21SchristosIt has a two targets:
1511.1Scgd
1521.1Scgd	maninstall:
1531.21Schristos		Install the manual page sources and their links.
1541.21Schristos	catinstall:
1551.21Schristos		Install the preformatted manual pages and their links.
1561.1Scgd
1571.1ScgdIt sets/uses the following variables:
1581.1Scgd
1591.1ScgdMANDIR		Base path for manual installation.
1601.1Scgd
1611.1ScgdMANGRP		Manual group.
1621.1Scgd
1631.1ScgdMANOWN		Manual owner.
1641.1Scgd
1651.1ScgdMANMODE		Manual mode.
1661.1Scgd
1671.1ScgdMANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
1681.1Scgd		or "/tahoe" for machine specific manual pages.
1691.1Scgd
1701.15ScgdMAN		The manual pages to be installed (use a .1 - .9 suffix).
1711.1Scgd
1721.15ScgdMLINKS		List of manual page links (using a .1 - .9 suffix).  The
1731.1Scgd		linked-to file must come first, the linked file second,
1741.1Scgd		and there may be multiple pairs.  The files are soft-linked.
1751.1Scgd
1761.1ScgdThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1771.1Scgdit exists.
1781.1Scgd
1791.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1801.1Scgd
1811.17SthorpejThe include file <bsd.own.mk> contains source tree configuration parameters,
1821.17Sthorpejsuch as the owners, groups, etc. for both manual pages and binaries, and
1831.17Sthorpeja few global "feature configuration" parameters.
1841.1Scgd
1851.1ScgdIt has no targets.
1861.1Scgd
1871.29ScjsTo get system-specific configuration parameters, bsd.own.mk will try to
1881.29Scjsinclude the file specified by the "MAKECONF" variable.  If MAKECONF is not
1891.29Scjsset, or no such file exists, the system make configuration file, /etc/mk.conf
1901.29Scjsis included.  These files may define any of the variables described below.
1911.17Sthorpej
1921.17Sthorpejbsd.own.mk sets the following variables, if they are not already defined
1931.17Sthorpej(defaults are in brackets):
1941.15Scgd
1951.15ScgdBSDSRCDIR	The real path to the system sources, so that 'make obj'
1961.15Scgd		will work correctly. [/usr/src]
1971.15Scgd
1981.15ScgdBSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
1991.15Scgd		will work correctly. [/usr/obj]
2001.15Scgd
2011.34SlukemBINGRP		Binary group. [wheel]
2021.15Scgd
2031.34SlukemBINOWN		Binary owner. [root]
2041.15Scgd
2051.15ScgdBINMODE		Binary mode. [555]
2061.15Scgd
2071.15ScgdNONBINMODE	Mode for non-executable files. [444]
2081.15Scgd
2091.15ScgdMANDIR		Base path for manual installation. [/usr/share/man/cat]
2101.15Scgd
2111.34SlukemMANGRP		Manual group. [wheel]
2121.15Scgd
2131.34SlukemMANOWN		Manual owner. [root]
2141.15Scgd
2151.15ScgdMANMODE		Manual mode. [${NONBINMODE}]
2161.15Scgd
2171.21SchristosMANINSTALL	Manual installation type: maninstall, catinstall, or both
2181.76Sfair
2191.76SfairLDSTATIC	Control program linking; if set blank, link everything
2201.76Sfair		dynamically. If set to "-static", link everything statically.
2211.76Sfair		If not set, programs link according to their makefile.
2221.21Schristos
2231.15ScgdLIBDIR		Base path for library installation. [/usr/lib]
2241.15Scgd
2251.85SlukemSHLIBDIR	If ${USE_SHLIBDIR} is "yes", use ${SHLIBDIR} instead of
2261.85Slukem		${LIBDIR} as the base path for shared library installation.
2271.85Slukem		[/usr/lib]
2281.85Slukem
2291.85Slukem_LIBSODIR	Set to ${SHLIBDIR} if ${USE_SHLIBDIR} is "yes",
2301.85Slukem		otherwise set to ${LIBDIR}
2311.85Slukem
2321.85SlukemSHLINKDIR	Base path for shared linker. [/usr/libexec]
2331.85Slukem
2341.15ScgdLINTLIBDIR	Base path for lint(1) library installation. [/usr/libdata/lint]
2351.15Scgd
2361.15ScgdLIBGRP		Library group. [${BINGRP}]
2371.15Scgd
2381.15ScgdLIBOWN		Library owner. [${BINOWN}]
2391.15Scgd
2401.15ScgdLIBMODE		Library mode. [${NONBINMODE}]
2411.15Scgd
2421.15ScgdDOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
2431.15Scgd	        installation. [/usr/share/doc]
2441.62Ssimonb
2451.62SsimonbHTMLDOCDIR	Base path for html system documentation installation.
2461.62Ssimonb		[/usr/share/doc/html]
2471.15Scgd
2481.34SlukemDOCGRP		Documentation group. [wheel]
2491.15Scgd
2501.34SlukemDOCOWN		Documentation owner. [root]
2511.15Scgd
2521.15ScgdDOCMODE		Documentation mode. [${NONBINMODE}]
2531.15Scgd
2541.84SkleinkNLSDIR		Base path for Native Language Support files installation.
2551.15Scgd		[/usr/share/nls]
2561.1Scgd
2571.84SkleinkNLSGRP		Native Language Support files group. [wheel]
2581.1Scgd
2591.84SkleinkNLSOWN		Native Language Support files owner. [root]
2601.1Scgd
2611.84SkleinkNLSMODE		Native Language Support files mode. [${NONBINMODE}]
2621.1Scgd
2631.32SmikelSTRIPFLAG	The flag passed to the install program to cause the binary
2641.1Scgd		to be stripped.  This is to be used when building your
2651.1Scgd		own install script so that the entire system can be made
2661.15Scgd		stripped/not-stripped using a single knob. [-s]
2671.1Scgd
2681.2ScgdCOPY		The flag passed to the install program to cause the binary
2691.2Scgd		to be copied rather than moved.  This is to be used when
2701.2Scgd		building our own install script so that the entire system
2711.2Scgd		can either be installed with copies, or with moves using
2721.15Scgd		a single knob. [-c]
2731.15Scgd
2741.17SthorpejAdditionally, the following variables may be set by bsd.own.mk or in a
2751.17Sthorpejmake configuration file to modify the behaviour of the system build
2761.17Sthorpejprocess (default values are in brackets along with comments, if set by
2771.17Sthorpejbsd.own.mk):
2781.15Scgd
2791.64SthorpejMKCRYPTO	If set to "no", no cryptography support will be built
2801.64Sthorpej		into the system.  Defaults to "yes".
2811.64Sthorpej
2821.64SthorpejNOCRYPTO	If set, it is equivalent to setting MKCRYPTO to "no".
2831.64Sthorpej
2841.66SitojunMKCRYPTO_IDEA	If set to "yes", IDEA support will be built into
2851.66Sitojun		libcrypto_idea.a.  Defaults to "no".
2861.64Sthorpej
2871.66SitojunMKCRYPTO_RC5	If set to "yes", RC5 support will be built into
2881.66Sitojun		libcrypto_rc5.a.  Defaults to "no".
2891.64Sthorpej
2901.64SthorpejMKKERBEROS	If set to "no", disables building Kerberos (v4 or v5)
2911.64Sthorpej		support into various system utilities that support it.
2921.64Sthorpej		Defaults to "yes".  NOTE: This does not affect the
2931.64Sthorpej		building of the Kerberos libraries or infrastructure
2941.64Sthorpej		programs themselves.  To completely disable Kerberos,
2951.64Sthorpej		set MKCRYPTO to "no".
2961.64Sthorpej
2971.64SthorpejNOKERBEROS	If set, it is equivalent to setting MKKERBEROS to "no".
2981.2Scgd
2991.15ScgdSKEY		Compile in support for S/key authentication. [yes, set
3001.15Scgd		unconditionally]
3011.15Scgd
3021.15ScgdMANZ		Compress manual pages at installation time.
3031.15Scgd
3041.15ScgdSYS_INCLUDE	Copy or symlink kernel include files into /usr/include.
3051.15Scgd		Possible values are "symlinks" or "copies" (which is
3061.15Scgd		the same as the variable being unset).
3071.1Scgd
3081.15ScgdNOPROFILE	Do not build profiled versions of system libraries
3091.1Scgd
3101.15ScgdNOPIC		Do not build PIC versions of system libraries, and
3111.15Scgd		do not build shared libraries.  [set if ${MACHINE_ARCH}
3121.65Sjlam		is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.]
3131.1Scgd
3141.40SperryNOLINT		Do not build lint libraries.
3151.33Sjonathan
3161.50SthorpejOBJECT_FMT	Object file format. [set to "ELF" on architectures that
3171.50Sthorpej		use ELF -- currently if ${MACHINE_ARCH} is "alpha",
3181.50Sthorpej		"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
3191.77Ssimonb		"i386" and some m68k machines, or set to "a.out" on
3201.77Ssimonb		other architectures].
3211.33Sjonathan
3221.78SsimonbMKSOFTFLOAT	If "yes", build with options to enable the compiler to
3231.78Ssimonb		generate output containing library calls for floating
3241.78Ssimonb		point and possibly soft-float library support.  Defaults
3251.78Ssimonb		to "no".
3261.1Scgd
3271.17Sthorpejbsd.own.mk is generally useful when building your own Makefiles so that
3281.1Scgdthey use the same default owners etc. as the rest of the tree.
3291.1Scgd
3301.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3311.1Scgd
3321.1ScgdThe include file <bsd.prog.mk> handles building programs from one or
3331.1Scgdmore source files, along with their manual pages.  It has a limited number
3341.1Scgdof suffixes, consistent with the current needs of the BSD tree.
3351.1Scgd
3361.16SjtcIt has eight targets:
3371.1Scgd
3381.1Scgd	all:
3391.1Scgd		build the program and its manual page
3401.1Scgd	clean:
3411.1Scgd		remove the program, any object files and the files a.out,
3421.24Smikel		Errs, errs, mklog, and ${PROG}.core.
3431.1Scgd	cleandir:
3441.1Scgd		remove all of the files removed by the target clean, as
3451.1Scgd		well as .depend, tags, and any manual pages.
3461.42Slukem		`distclean' is a synonym for `cleandir'.
3471.1Scgd	depend:
3481.1Scgd		make the dependencies for the source files, and store
3491.1Scgd		them in the file .depend.
3501.16Sjtc	includes:
3511.16Sjtc		install any header files.
3521.1Scgd	install:
3531.1Scgd		install the program and its manual pages; if the Makefile
3541.1Scgd		does not itself define the target install, the targets
3551.1Scgd		beforeinstall and afterinstall may also be used to cause
3561.1Scgd		actions immediately before and after the install target
3571.1Scgd		is executed.
3581.1Scgd	lint:
3591.1Scgd		run lint on the source files
3601.1Scgd	tags:
3611.1Scgd		create a tags file for the source files.
3621.1Scgd
3631.1ScgdIt sets/uses the following variables:
3641.1Scgd
3651.1ScgdBINGRP		Binary group.
3661.1Scgd
3671.1ScgdBINOWN		Binary owner.
3681.1Scgd
3691.1ScgdBINMODE		Binary mode.
3701.1Scgd
3711.1ScgdCLEANFILES	Additional files to remove for the clean and cleandir targets.
3721.1Scgd
3731.1ScgdCOPTS		Additional flags to the compiler when creating C objects.
3741.35Slukem
3751.35SlukemCPPFLAGS	Additional flags to the C pre-processor
3761.1Scgd
3771.1ScgdLDADD		Additional loader objects.  Usually used for libraries.
3781.1Scgd		For example, to load with the compatibility and utility
3791.1Scgd		libraries, use:
3801.1Scgd
3811.5Sjtc			LDADD+=-lutil -lcompat
3821.1Scgd
3831.1ScgdLDFLAGS		Additional loader flags.
3841.1Scgd
3851.1ScgdLINKS		The list of binary links; should be full pathnames, the
3861.1Scgd		linked-to file coming first, followed by the linked
3871.1Scgd		file.  The files are hard-linked.  For example, to link
3881.1Scgd		/bin/test and /bin/[, use:
3891.1Scgd
3901.1Scgd			LINKS=	${DESTDIR}/bin/test ${DESTDIR}/bin/[
3911.19Sperry
3921.19SperrySYMLINKS	The list of symbolic links; should be full pathnames.
3931.20Sperry                Syntax is identical to LINKS. Note that DESTDIR is not
3941.20Sperry		automatically included in the link.
3951.1Scgd
3961.15ScgdMAN		Manual pages (should end in .1 - .9).  If no MAN variable is
3971.8Scgd		defined, "MAN=${PROG}.1" is assumed.
3981.1Scgd
3991.1ScgdPROG		The name of the program to build.  If not supplied, nothing
4001.1Scgd		is built.
4011.1Scgd
4021.88SthorpejPROG_CXX	If defined, the name of the program to build.  Also
4031.88Sthorpej		causes <bsd.prog.mk> to link the program with the C++
4041.88Sthorpej		compiler rather than the C compiler.  PROG_CXX overrides
4051.88Sthorpej		the value of PROG if PROG is also set.
4061.87Sthorpej
4071.21SchristosPROGNAME	The name that the above program will be installed as, if
4081.21Schristos		different from ${PROG}.
4091.21Schristos
4101.37StvSRCS		List of source files to build the program.  If SRCS is not
4111.1Scgd		defined, it's assumed to be ${PROG}.c.
4121.1Scgd
4131.1ScgdDPADD		Additional dependencies for the program.  Usually used for
4141.1Scgd		libraries.  For example, to depend on the compatibility and
4151.1Scgd		utility libraries use:
4161.1Scgd
4171.5Sjtc			DPADD+=${LIBCOMPAT} ${LIBUTIL}
4181.1Scgd
4191.1Scgd		The following libraries are predefined for DPADD:
4201.1Scgd
4211.21Schristos		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
4221.21Schristos		LIBC?=		${DESTDIR}/usr/lib/libc.a
4231.21Schristos		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
4241.21Schristos		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
4251.21Schristos		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
4261.21Schristos		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
4271.21Schristos		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
4281.21Schristos		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
4291.21Schristos		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
4301.73Sblymn		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
4311.21Schristos		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
4321.21Schristos		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
4331.70Sitojun		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
4341.49Sitojun		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
4351.21Schristos		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
4361.21Schristos		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
4371.21Schristos		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
4381.21Schristos		LIBL?=		${DESTDIR}/usr/lib/libl.a
4391.21Schristos		LIBM?=		${DESTDIR}/usr/lib/libm.a
4401.53Sblymn		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
4411.21Schristos		LIBMP?=		${DESTDIR}/usr/lib/libmp.a
4421.25Schristos		LIBNTP?=	${DESTDIR}/usr/lib/libntp.a
4431.21Schristos		LIBPC?=		${DESTDIR}/usr/lib/libpc.a
4441.21Schristos		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
4451.21Schristos		LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a
4461.26Skleink		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
4471.21Schristos		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
4481.21Schristos		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
4491.21Schristos		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
4501.21Schristos		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
4511.21Schristos		LIBTELNET?=	${DESTDIR}/usr/lib/libtelnet.a
4521.21Schristos		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
4531.21Schristos		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
4541.21Schristos		LIBY?=		${DESTDIR}/usr/lib/liby.a
4551.21Schristos		LIBZ?=		${DESTDIR}/usr/lib/libz.a
4561.1Scgd
4571.1ScgdSHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
4581.12Schristos		strings, using xstr(1). Note that this will not work with
4591.12Schristos		parallel makes.
4601.1Scgd
4611.59SjlamSTRIPFLAG	The flag passed to the install program to cause the binary
4621.1Scgd		to be stripped.
4631.1Scgd
4641.1ScgdSUBDIR		A list of subdirectories that should be built as well.
4651.1Scgd		Each of the targets will execute the same target in the
4661.1Scgd		subdirectories.
4671.1Scgd
4681.21SchristosSCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
4691.21Schristos		These are installed exactly like programs.
4701.21Schristos
4711.21SchristosSCRIPTSNAME	The name that the above program will be installed as, if
4721.21Schristos		different from ${SCRIPTS}. These can be further specialized
4731.21Schristos		by setting SCRIPTSNAME_<script>.
4741.21Schristos
4751.21SchristosFILES		A list of files to install. The installation is controlled
4761.21Schristos		by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
4771.21Schristos		variables that can be further specialized by FILES<VAR>_<file>
4781.21Schristos
4791.85SlukemSHLINKDIR	Target directory for shared linker.
4801.85Slukem
4811.1ScgdThe include file <bsd.prog.mk> includes the file named "../Makefile.inc"
4821.1Scgdif it exists, as well as the include file <bsd.man.mk>.
4831.1Scgd
4841.1ScgdSome simple examples:
4851.1Scgd
4861.1ScgdTo build foo from foo.c with a manual page foo.1, use:
4871.1Scgd
4881.1Scgd	PROG=	foo
4891.1Scgd
4901.1Scgd	.include <bsd.prog.mk>
4911.1Scgd
4921.1ScgdTo build foo from foo.c with a manual page foo.2, add the line:
4931.1Scgd
4941.9Scgd	MAN=	foo.2
4951.1Scgd
4961.1ScgdIf foo does not have a manual page at all, add the line:
4971.1Scgd
4981.75Sagc	MKMAN=	no
4991.1Scgd
5001.1ScgdIf foo has multiple source files, add the line:
5011.1Scgd
5021.1Scgd	SRCS=	a.c b.c c.c d.c
5031.1Scgd
5041.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5051.1Scgd
5061.1ScgdThe include file <bsd.subdir.mk> contains the default targets for building
5071.16Sjtcsubdirectories.  It has the same eight targets as <bsd.prog.mk>: all, 
5081.16Sjtcclean, cleandir, depend, includes, install, lint, and tags.  For all of
5091.72Ssommerfethe directories listed in the variable SUBDIR, the specified directory 
5101.16Sjtcwill be visited and the target made.  There is also a default target which
5111.16Sjtcallows the command "make subdir" where subdir is any directory listed in
5121.72Ssommerfethe variable SUBDIR.
5131.72Ssommerfe
5141.72SsommerfeAs a special case, the use of a token .WAIT as an entry in SUBDIR acts
5151.72Ssommerfeas a synchronization barrier when multiple make jobs are run; subdirs
5161.72Ssommerfebefore the .WAIT must complete before any subdirs after .WAIT are
5171.75Sagcstarted.  See make(1) for some caveats on use of .WAIT and other
5181.75Sagcspecial sources.
5191.21Schristos
5201.21Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5211.21Schristos
5221.23SchristosThe include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
5231.23Schristosand is included from from bsd.lib.mk and bsd.prog.mk.
5241.23Schristos
5251.23Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5261.23Schristos
5271.23SchristosThe include file <bsd.files.mk> handles the FILES variables and is included
5281.23Schristosfrom bsd.lib.mk and bsd.prog.mk.
5291.21Schristos
5301.21Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5311.21Schristos
5321.29ScjsThe include file <bsd.inc.mk> defines the includes target and uses two
5331.29Scjsvariables:
5341.21Schristos
5351.81SwizINCS		The list of include files
5361.21Schristos
5371.81SwizINCSDIR		The location to install the include files.
5381.81Swiz
5391.81SwizINCSNAME	Target name of the include file, if only one; same as
5401.81Swiz		FILESNAME, but for include files.
5411.81Swiz
5421.81SwizINCSNAME_<file>	The name file <file> should be installed as, if not <file>,
5431.81Swiz		same as FILESNAME_<file>, but for include files.
5441.39Scgd
5451.39Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5461.39Scgd
5471.39ScgdThe include file <bsd.kinc.mk> defines the many targets (includes,
5481.39Scgdsubdirectories, etc.), and is used by kernel makefiles to handle
5491.39Scgdinclude file installation.  It is intended to be included alone, by
5501.39Scgdkernel Makefiles.  Please see bsd.kinc.mk for more details, and keep
5511.39Scgdthe documentation in that file up to date.
5521.13Schristos
5531.13Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5541.13Schristos
5551.47StvThe include file <bsd.info.mk> is used to generate and install GNU Info
5561.47Stvdocumentation from respective Texinfo source files.  It defines three
5571.47Stvimplicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
5581.47Stvfollowing variables:
5591.47Stv
5601.47StvTEXINFO		List of Texinfo source files.  Info documentation will
5611.47Stv		consist of single files with the extension replaced by
5621.47Stv		.info.
5631.47Stv
5641.47StvINFOFLAGS	Flags to pass to makeinfo.  []
5651.47Stv
5661.47StvINSTALL_INFO	Name of install-info program.  [install-info]
5671.47Stv
5681.47StvMAKEINFO	Name of makeinfo program.  [makeinfo]
5691.47Stv
5701.47Stv=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5711.47Stv
5721.13SchristosThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and
5731.14Scgd<bsd.lib.mk>.  It contains overrides that are used when building
5741.14Scgdthe NetBSD source tree.  For instance, if "PARALLEL" is defined by
5751.14Scgdthe program/library Makefile, it includes a set of rules for lex and
5761.14Scgdyacc that allow multiple lex and yacc targets to be built in parallel.
5771.69Ssommerfe
5781.69SsommerfeOther variables of note (incomplete list):
5791.69Ssommerfe
5801.82SlukemWARNS		Crank up gcc warning options; the distinct levels are:
5811.82Slukem			WARNS=1
5821.82Slukem			WARNS=2
5831.82Slukem			WARNS=3
5841.69Ssommerfe
5851.69SsommerfeFORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
5861.69SsommerfeWFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
5871.75Sagc		WFORMAT belongs in individual makefiles and/or
5881.75Sagc		Makefile.inc files.  (set WFORMAT=1 in individual
5891.75Sagc		makefiles if a program is not security critical and is
5901.75Sagc		doing bizarre things with format strings which would
5911.75Sagc		be even uglier if rewritten) FORMAT_AUDIT should go in
5921.75Sagc		mk.conf if you're doing format-string auditing. 
5931.69Ssommerfe		FORMAT_AUDIT may go away in time.
5941.1Scgd
5951.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5961.1Scgd
5971.1ScgdThe include file <bsd.lib.mk> has support for building libraries.  It has
5981.16Sjtcthe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
5991.44Serhincludes, install, lint, and tags.  Additionally, it has a checkver target
6001.44Serhwhich checks for installed shared object libraries whose version is greater
6011.44Serhthat the version of the source. It has a limited number of suffixes,
6021.16Sjtcconsistent with the current needs of the BSD tree.
6031.1Scgd
6041.1ScgdIt sets/uses the following variables:
6051.10Scgd
6061.10ScgdLIB		The name of the library to build.
6071.1Scgd
6081.1ScgdLIBDIR		Target directory for libraries.
6091.85Slukem
6101.85SlukemSHLIBDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
6111.85Slukem		is "yes".
6121.85Slukem
6131.85SlukemUSE_SHLIBDIR	If "yes", use ${SHLIBDIR} instead of ${LIBDIR}
6141.85Slukem		as the path to install shared libraries to.
6151.1Scgd
6161.1ScgdLINTLIBDIR	Target directory for lint libraries.
6171.1Scgd
6181.1ScgdLIBGRP		Library group.
6191.1Scgd
6201.1ScgdLIBOWN		Library owner.
6211.1Scgd
6221.1ScgdLIBMODE		Library mode.
6231.1Scgd
6241.1ScgdLDADD		Additional loader objects.
6251.1Scgd
6261.15ScgdMAN		The manual pages to be installed (use a .1 - .9 suffix).
6271.47Stv
6281.47StvMKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
6291.47Stv		Also:
6301.47Stv			- don't install the .a libraries
6311.47Stv			- don't install _pic.a libraries on PIC systems
6321.47Stv			- don't build .a libraries on PIC systems
6331.47Stv			- don't install the .so symlink on ELF systems
6341.47Stv		I.e, only install the shared library (and the .so.major
6351.47Stv		symlink on ELF).
6361.54Ssimonb
6371.54SsimonbMKPICLIB	If "no", don't build _pic.a libraries, and build the
6381.54Ssimonb		shared object libraries from the .a libraries.  A
6391.54Ssimonb		symlink is installed in ${DESTDIR}/usr/lib for the
6401.54Ssimonb		_pic.a library pointing to the .a library.
6411.44Serh
6421.44SerhNOCHECKVER_<library>
6431.44SerhNOCHECKVER	If set, disables checking for installed shared object
6441.44Serh		libraries with versions greater than the source.  A
6451.44Serh		particular library name, without the "lib" prefix, may
6461.44Serh		be appended to the variable name to disable the check for
6471.44Serh		only that library.
6481.1Scgd
6491.1ScgdSRCS		List of source files to build the library.  Suffix types
6501.1Scgd		.s, .c, and .f are supported.  Note, .s files are preferred
6511.1Scgd		to .c files of the same name.  (This is not the default for
6521.1Scgd		versions of make.)
6531.1Scgd
6541.1ScgdThe include file <bsd.lib.mk> includes the file named "../Makefile.inc"
6551.1Scgdif it exists, as well as the include file <bsd.man.mk>.
6561.1Scgd
6571.1ScgdIt has rules for building profiled objects; profiled libraries are
6581.1Scgdbuilt by default.
6591.1Scgd
6601.4ScgdLibraries are ranlib'd when made.
6611.56Ssommerfe
6621.56Ssommerfe=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6631.56Ssommerfe
6641.56SsommerfeThe include file <bsd.obj.mk> defines targets related to the creation
6651.56Ssommerfeand use of separated object and source directories.
6661.56Ssommerfe
6671.63SsjgIf an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
6681.63Ssjg${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
6691.75Sagcit exists.  Otherwise make(1) looks for the existence of a
6701.63Ssjgsubdirectory (or a symlink to a directory) of the source directory
6711.63Ssjginto which built targets should be placed.  If an environment variable
6721.63Ssjgnamed MAKEOBJDIR is set, make(1) uses its value as the name of the
6731.63Ssjgobject directory; failing that, make first looks for a subdirectory
6741.63Ssjgnamed "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
6751.56Ssommerfe
6761.56SsommerfeObject directories are not created automatically by make(1) if they
6771.56Ssommerfedon't exist; you need to run a separate "make obj".  (This will happen
6781.56Ssommerfeduring a top-level build if "MKOBJDIRS" is set to a value other than
6791.58Ssommerfe"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
6801.58Ssommerfeand this is determined by a simple string prefix comparison -- object
6811.58Ssommerfedirectories are created in a separate object directory tree, and a
6821.58Ssommerfesymlink to the object directory in that tree is created in the source
6831.58Ssommerfedirectory; otherwise, "make obj" assumes that you're not in the main
6841.58Ssommerfesource tree and that it's not safe to use a separate object tree.
6851.56Ssommerfe
6861.56SsommerfeSeveral variables used by <bsd.obj.mk> control exactly what
6871.56Ssommerfedirectories and links get created during a "make obj":
6881.56Ssommerfe
6891.56SsommerfeMAKEOBJDIR	If set, this is the component name of the object
6901.56Ssommerfe		directory.
6911.56Ssommerfe
6921.56SsommerfeOBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
6931.56Ssommerfe		object directories or links named "obj.${MACHINE}";
6941.56Ssommerfe		otherwise, just creates ones named "obj".
6951.56Ssommerfe
6961.56SsommerfeUSR_OBJMACHINE  If set, and the current directory is a subdirectory of
6971.56Ssommerfe		${BSDSRCDIR}, create object directory in the
6981.56Ssommerfe		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
6991.56Ssommerfe		otherwise, create it in the corresponding subdirectory
7001.56Ssommerfe		of ${BSDOBJDIR}
7011.63Ssjg
7021.63Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7031.63Ssjg
7041.63SsjgThe include file <bsd.kernobj.mk> defines variables related to the
7051.63Ssjglocation of kernel sources and object directories.
7061.63Ssjg
7071.63SsjgKERNSRCDIR	Is the location of the top of the kernel src.
7081.63Ssjg		It defaults to ${BSDSRCDIR}/sys, but the top-level
7091.63Ssjg		Makefile.inc sets it to ${ABSTOP}/sys (ABSTOP is the
7101.63Ssjg		absolute path to the directory where the top-level
7111.63Ssjg		Makefile.inc was found.
7121.63Ssjg
7131.63SsjgKERNARCHDIR	Is the location of the machine dependent kernel
7141.63Ssjg		sources.  It defaults to arch/${MACHINE}
7151.63Ssjg		
7161.63SsjgKERNCONFDIR	Is where the configuration files for kernels are
7171.63Ssjg		found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
7181.63Ssjg
7191.63SsjgKERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
7201.63Ssjg		instance will be compiled in ${KERNOBJDIR}/GENERIC.
7211.63Ssjg		The default value is
7221.63Ssjg		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
7231.63Ssjg		if it exists or the target 'obj' is being made.
7241.63Ssjg		Otherwise the default is
7251.63Ssjg		${KERNSRCDIR}/${KERNARCHDIR}/compile.
7261.63Ssjg
7271.63SsjgIt is important that Makefiles (such as those under src/distrib) that
7281.63Ssjgwish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
7291.63Ssjgrather than make assumptions about the location of the compiled kernel.
7301.30Sagc
7311.30Sagc=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
732