bsd.README revision 1.75
11.75Sagc#	$NetBSD: bsd.README,v 1.75 2001/02/01 20:27:06 agc 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.21Schristos                out of date or non-existant 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.52SsimonbUNPRIVILEGED	If defined, don't set the owner/group/mode when installing
761.52Ssimonb		files or directories.  This allows a non-root "make install".
771.45Slukem
781.45SlukemMKCATPAGES	If "no", don't build or install the catman pages.
791.45Slukem
801.45SlukemMKDOC		If "no", don't build or install the documentation.
811.45Slukem
821.47StvMKINFO		If "no", don't build or install Info documentation from
831.47Stv		Texinfo source files.
841.45Slukem
851.45SlukemMKLINT		If "no", don't build or install the lint libraries.
861.45Slukem
871.45SlukemMKMAN		If "no", don't build or install the man or catman pages.
881.46Slukem		Also acts as "MKCATPAGES=no"
891.45Slukem
901.74SitojunMKNLS		If "no", don't build or install the NLS files and locale
911.74Sitojun		definition files.
921.45Slukem
931.55SsommerfeMKOBJ		If "no", don't enable the rule which creates objdirs.
941.55Ssommerfe		"yes" by default.
951.55Ssommerfe
961.55SsommerfeMKOBJDIRS	If "no", don't create objdirs during a "make build".
971.55Ssommerfe		"no" by default.
981.45Slukem
991.45SlukemMKPIC		If "no", don't build or install shared libraries.
1001.45Slukem
1011.45SlukemMKPICINSTALL	If "no", don't install the *_pic.a libraries.
1021.45Slukem
1031.45SlukemMKPROFILE	If "no", don't build or install the profiling libraries.
1041.45Slukem
1051.48SlukemMKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no
1061.48Slukem		MKNLS=no".  I.e, don't build catman pages, documentation,
1071.48Slukem		Info documentation, man pages, NLS files, ...
1081.1Scgd
1091.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1101.1Scgd
1111.1ScgdThe include file <sys.mk> has the default rules for all makes, in the BSD
1121.1Scgdenvironment or otherwise.  You probably don't want to touch this file.
1131.71SitojunIf you intend to run a cross build, you will need to supply the following
1141.71Sitojunhost tools, and configure the following variables properly:
1151.71Sitojun
1161.71SitojunOBJCOPY		objcopy - copy and translate object files
1171.71Sitojun
1181.71SitojunSTRIP		strip - Discard symbols from object files
1191.71Sitojun
1201.71SitojunCONFIG		config - build kernel compilation directories
1211.71Sitojun
1221.71SitojunRPCGEN		rpcgen - Remote Procedure Call (RPC) protocol compiler
1231.71Sitojun
1241.71SitojunMKLOCALE	mklocale - make LC_CTYPE locale files
1251.1Scgd
1261.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1271.1Scgd
1281.1ScgdThe include file <bsd.man.mk> handles installing manual pages and their
1291.1Scgdlinks.
1301.1Scgd
1311.21SchristosIt has a two targets:
1321.1Scgd
1331.1Scgd	maninstall:
1341.21Schristos		Install the manual page sources and their links.
1351.21Schristos	catinstall:
1361.21Schristos		Install the preformatted manual pages and their links.
1371.1Scgd
1381.1ScgdIt sets/uses the following variables:
1391.1Scgd
1401.1ScgdMANDIR		Base path for manual installation.
1411.1Scgd
1421.1ScgdMANGRP		Manual group.
1431.1Scgd
1441.1ScgdMANOWN		Manual owner.
1451.1Scgd
1461.1ScgdMANMODE		Manual mode.
1471.1Scgd
1481.1ScgdMANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
1491.1Scgd		or "/tahoe" for machine specific manual pages.
1501.1Scgd
1511.15ScgdMAN		The manual pages to be installed (use a .1 - .9 suffix).
1521.1Scgd
1531.15ScgdMLINKS		List of manual page links (using a .1 - .9 suffix).  The
1541.1Scgd		linked-to file must come first, the linked file second,
1551.1Scgd		and there may be multiple pairs.  The files are soft-linked.
1561.1Scgd
1571.1ScgdThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1581.1Scgdit exists.
1591.1Scgd
1601.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1611.1Scgd
1621.17SthorpejThe include file <bsd.own.mk> contains source tree configuration parameters,
1631.17Sthorpejsuch as the owners, groups, etc. for both manual pages and binaries, and
1641.17Sthorpeja few global "feature configuration" parameters.
1651.1Scgd
1661.1ScgdIt has no targets.
1671.1Scgd
1681.29ScjsTo get system-specific configuration parameters, bsd.own.mk will try to
1691.29Scjsinclude the file specified by the "MAKECONF" variable.  If MAKECONF is not
1701.29Scjsset, or no such file exists, the system make configuration file, /etc/mk.conf
1711.29Scjsis included.  These files may define any of the variables described below.
1721.17Sthorpej
1731.17Sthorpejbsd.own.mk sets the following variables, if they are not already defined
1741.17Sthorpej(defaults are in brackets):
1751.15Scgd
1761.15ScgdBSDSRCDIR	The real path to the system sources, so that 'make obj'
1771.15Scgd		will work correctly. [/usr/src]
1781.15Scgd
1791.15ScgdBSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
1801.15Scgd		will work correctly. [/usr/obj]
1811.15Scgd
1821.34SlukemBINGRP		Binary group. [wheel]
1831.15Scgd
1841.34SlukemBINOWN		Binary owner. [root]
1851.15Scgd
1861.15ScgdBINMODE		Binary mode. [555]
1871.15Scgd
1881.15ScgdNONBINMODE	Mode for non-executable files. [444]
1891.15Scgd
1901.15ScgdMANDIR		Base path for manual installation. [/usr/share/man/cat]
1911.15Scgd
1921.34SlukemMANGRP		Manual group. [wheel]
1931.15Scgd
1941.34SlukemMANOWN		Manual owner. [root]
1951.15Scgd
1961.15ScgdMANMODE		Manual mode. [${NONBINMODE}]
1971.15Scgd
1981.21SchristosMANINSTALL	Manual installation type: maninstall, catinstall, or both
1991.21Schristos
2001.15ScgdLIBDIR		Base path for library installation. [/usr/lib]
2011.15Scgd
2021.15ScgdLINTLIBDIR	Base path for lint(1) library installation. [/usr/libdata/lint]
2031.15Scgd
2041.15ScgdLIBGRP		Library group. [${BINGRP}]
2051.15Scgd
2061.15ScgdLIBOWN		Library owner. [${BINOWN}]
2071.15Scgd
2081.15ScgdLIBMODE		Library mode. [${NONBINMODE}]
2091.15Scgd
2101.15ScgdDOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
2111.15Scgd	        installation. [/usr/share/doc]
2121.62Ssimonb
2131.62SsimonbHTMLDOCDIR	Base path for html system documentation installation.
2141.62Ssimonb		[/usr/share/doc/html]
2151.15Scgd
2161.34SlukemDOCGRP		Documentation group. [wheel]
2171.15Scgd
2181.34SlukemDOCOWN		Documentation owner. [root]
2191.15Scgd
2201.15ScgdDOCMODE		Documentation mode. [${NONBINMODE}]
2211.15Scgd
2221.15ScgdNLSDIR		Base path for National Language Support files installation.
2231.15Scgd		[/usr/share/nls]
2241.1Scgd
2251.34SlukemNLSGRP		National Language Support files group. [wheel]
2261.1Scgd
2271.34SlukemNLSOWN		National Language Support files owner. [root]
2281.1Scgd
2291.15ScgdNLSMODE		National Language Support files mode. [${NONBINMODE}]
2301.1Scgd
2311.32SmikelSTRIPFLAG	The flag passed to the install program to cause the binary
2321.1Scgd		to be stripped.  This is to be used when building your
2331.1Scgd		own install script so that the entire system can be made
2341.15Scgd		stripped/not-stripped using a single knob. [-s]
2351.1Scgd
2361.2ScgdCOPY		The flag passed to the install program to cause the binary
2371.2Scgd		to be copied rather than moved.  This is to be used when
2381.2Scgd		building our own install script so that the entire system
2391.2Scgd		can either be installed with copies, or with moves using
2401.15Scgd		a single knob. [-c]
2411.15Scgd
2421.17SthorpejAdditionally, the following variables may be set by bsd.own.mk or in a
2431.17Sthorpejmake configuration file to modify the behaviour of the system build
2441.17Sthorpejprocess (default values are in brackets along with comments, if set by
2451.17Sthorpejbsd.own.mk):
2461.15Scgd
2471.64SthorpejMKCRYPTO	If set to "no", no cryptography support will be built
2481.64Sthorpej		into the system.  Defaults to "yes".
2491.64Sthorpej
2501.64SthorpejNOCRYPTO	If set, it is equivalent to setting MKCRYPTO to "no".
2511.64Sthorpej
2521.66SitojunMKCRYPTO_IDEA	If set to "yes", IDEA support will be built into
2531.66Sitojun		libcrypto_idea.a.  Defaults to "no".
2541.64Sthorpej
2551.66SitojunMKCRYPTO_RC5	If set to "yes", RC5 support will be built into
2561.66Sitojun		libcrypto_rc5.a.  Defaults to "no".
2571.64Sthorpej
2581.64SthorpejMKKERBEROS	If set to "no", disables building Kerberos (v4 or v5)
2591.64Sthorpej		support into various system utilities that support it.
2601.64Sthorpej		Defaults to "yes".  NOTE: This does not affect the
2611.64Sthorpej		building of the Kerberos libraries or infrastructure
2621.64Sthorpej		programs themselves.  To completely disable Kerberos,
2631.64Sthorpej		set MKCRYPTO to "no".
2641.64Sthorpej
2651.64SthorpejNOKERBEROS	If set, it is equivalent to setting MKKERBEROS to "no".
2661.2Scgd
2671.15ScgdSKEY		Compile in support for S/key authentication. [yes, set
2681.15Scgd		unconditionally]
2691.15Scgd
2701.15ScgdMANZ		Compress manual pages at installation time.
2711.15Scgd
2721.15ScgdSYS_INCLUDE	Copy or symlink kernel include files into /usr/include.
2731.15Scgd		Possible values are "symlinks" or "copies" (which is
2741.15Scgd		the same as the variable being unset).
2751.1Scgd
2761.15ScgdNOPROFILE	Do not build profiled versions of system libraries
2771.1Scgd
2781.15ScgdNOPIC		Do not build PIC versions of system libraries, and
2791.15Scgd		do not build shared libraries.  [set if ${MACHINE_ARCH}
2801.65Sjlam		is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.]
2811.1Scgd
2821.40SperryNOLINT		Do not build lint libraries.
2831.33Sjonathan
2841.50SthorpejOBJECT_FMT	Object file format. [set to "ELF" on architectures that
2851.50Sthorpej		use ELF -- currently if ${MACHINE_ARCH} is "alpha",
2861.50Sthorpej		"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
2871.50Sthorpej		and "i386", or set to "a.out" on other architectures].
2881.33Sjonathan
2891.1Scgd
2901.17Sthorpejbsd.own.mk is generally useful when building your own Makefiles so that
2911.1Scgdthey use the same default owners etc. as the rest of the tree.
2921.1Scgd
2931.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2941.1Scgd
2951.1ScgdThe include file <bsd.prog.mk> handles building programs from one or
2961.1Scgdmore source files, along with their manual pages.  It has a limited number
2971.1Scgdof suffixes, consistent with the current needs of the BSD tree.
2981.1Scgd
2991.16SjtcIt has eight targets:
3001.1Scgd
3011.1Scgd	all:
3021.1Scgd		build the program and its manual page
3031.1Scgd	clean:
3041.1Scgd		remove the program, any object files and the files a.out,
3051.24Smikel		Errs, errs, mklog, and ${PROG}.core.
3061.1Scgd	cleandir:
3071.1Scgd		remove all of the files removed by the target clean, as
3081.1Scgd		well as .depend, tags, and any manual pages.
3091.42Slukem		`distclean' is a synonym for `cleandir'.
3101.1Scgd	depend:
3111.1Scgd		make the dependencies for the source files, and store
3121.1Scgd		them in the file .depend.
3131.16Sjtc	includes:
3141.16Sjtc		install any header files.
3151.1Scgd	install:
3161.1Scgd		install the program and its manual pages; if the Makefile
3171.1Scgd		does not itself define the target install, the targets
3181.1Scgd		beforeinstall and afterinstall may also be used to cause
3191.1Scgd		actions immediately before and after the install target
3201.1Scgd		is executed.
3211.1Scgd	lint:
3221.1Scgd		run lint on the source files
3231.1Scgd	tags:
3241.1Scgd		create a tags file for the source files.
3251.1Scgd
3261.1ScgdIt sets/uses the following variables:
3271.1Scgd
3281.1ScgdBINGRP		Binary group.
3291.1Scgd
3301.1ScgdBINOWN		Binary owner.
3311.1Scgd
3321.1ScgdBINMODE		Binary mode.
3331.1Scgd
3341.1ScgdCLEANFILES	Additional files to remove for the clean and cleandir targets.
3351.1Scgd
3361.1ScgdCOPTS		Additional flags to the compiler when creating C objects.
3371.35Slukem
3381.35SlukemCPPFLAGS	Additional flags to the C pre-processor
3391.1Scgd
3401.1ScgdLDADD		Additional loader objects.  Usually used for libraries.
3411.1Scgd		For example, to load with the compatibility and utility
3421.1Scgd		libraries, use:
3431.1Scgd
3441.5Sjtc			LDADD+=-lutil -lcompat
3451.1Scgd
3461.1ScgdLDFLAGS		Additional loader flags.
3471.1Scgd
3481.1ScgdLINKS		The list of binary links; should be full pathnames, the
3491.1Scgd		linked-to file coming first, followed by the linked
3501.1Scgd		file.  The files are hard-linked.  For example, to link
3511.1Scgd		/bin/test and /bin/[, use:
3521.1Scgd
3531.1Scgd			LINKS=	${DESTDIR}/bin/test ${DESTDIR}/bin/[
3541.19Sperry
3551.19SperrySYMLINKS	The list of symbolic links; should be full pathnames.
3561.20Sperry                Syntax is identical to LINKS. Note that DESTDIR is not
3571.20Sperry		automatically included in the link.
3581.1Scgd
3591.15ScgdMAN		Manual pages (should end in .1 - .9).  If no MAN variable is
3601.8Scgd		defined, "MAN=${PROG}.1" is assumed.
3611.1Scgd
3621.1ScgdPROG		The name of the program to build.  If not supplied, nothing
3631.1Scgd		is built.
3641.1Scgd
3651.21SchristosPROGNAME	The name that the above program will be installed as, if
3661.21Schristos		different from ${PROG}.
3671.21Schristos
3681.37StvSRCS		List of source files to build the program.  If SRCS is not
3691.1Scgd		defined, it's assumed to be ${PROG}.c.
3701.1Scgd
3711.1ScgdDPADD		Additional dependencies for the program.  Usually used for
3721.1Scgd		libraries.  For example, to depend on the compatibility and
3731.1Scgd		utility libraries use:
3741.1Scgd
3751.5Sjtc			DPADD+=${LIBCOMPAT} ${LIBUTIL}
3761.1Scgd
3771.1Scgd		The following libraries are predefined for DPADD:
3781.1Scgd
3791.21Schristos		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
3801.21Schristos		LIBC?=		${DESTDIR}/usr/lib/libc.a
3811.21Schristos		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
3821.21Schristos		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
3831.21Schristos		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
3841.21Schristos		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
3851.21Schristos		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
3861.21Schristos		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
3871.21Schristos		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
3881.73Sblymn		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
3891.21Schristos		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
3901.21Schristos		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
3911.70Sitojun		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
3921.49Sitojun		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
3931.21Schristos		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
3941.21Schristos		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
3951.21Schristos		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
3961.21Schristos		LIBL?=		${DESTDIR}/usr/lib/libl.a
3971.21Schristos		LIBM?=		${DESTDIR}/usr/lib/libm.a
3981.53Sblymn		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
3991.21Schristos		LIBMP?=		${DESTDIR}/usr/lib/libmp.a
4001.25Schristos		LIBNTP?=	${DESTDIR}/usr/lib/libntp.a
4011.21Schristos		LIBPC?=		${DESTDIR}/usr/lib/libpc.a
4021.21Schristos		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
4031.21Schristos		LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a
4041.26Skleink		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
4051.21Schristos		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
4061.21Schristos		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
4071.21Schristos		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
4081.21Schristos		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
4091.21Schristos		LIBTELNET?=	${DESTDIR}/usr/lib/libtelnet.a
4101.21Schristos		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
4111.21Schristos		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
4121.21Schristos		LIBY?=		${DESTDIR}/usr/lib/liby.a
4131.21Schristos		LIBZ?=		${DESTDIR}/usr/lib/libz.a
4141.21Schristos
4151.1Scgd
4161.1ScgdSHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
4171.12Schristos		strings, using xstr(1). Note that this will not work with
4181.12Schristos		parallel makes.
4191.1Scgd
4201.59SjlamSTRIPFLAG	The flag passed to the install program to cause the binary
4211.1Scgd		to be stripped.
4221.1Scgd
4231.1ScgdSUBDIR		A list of subdirectories that should be built as well.
4241.1Scgd		Each of the targets will execute the same target in the
4251.1Scgd		subdirectories.
4261.1Scgd
4271.21SchristosSCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
4281.21Schristos		These are installed exactly like programs.
4291.21Schristos
4301.21SchristosSCRIPTSNAME	The name that the above program will be installed as, if
4311.21Schristos		different from ${SCRIPTS}. These can be further specialized
4321.21Schristos		by setting SCRIPTSNAME_<script>.
4331.21Schristos
4341.21SchristosFILES		A list of files to install. The installation is controlled
4351.21Schristos		by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
4361.21Schristos		variables that can be further specialized by FILES<VAR>_<file>
4371.21Schristos
4381.1ScgdThe include file <bsd.prog.mk> includes the file named "../Makefile.inc"
4391.1Scgdif it exists, as well as the include file <bsd.man.mk>.
4401.1Scgd
4411.1ScgdSome simple examples:
4421.1Scgd
4431.1ScgdTo build foo from foo.c with a manual page foo.1, use:
4441.1Scgd
4451.1Scgd	PROG=	foo
4461.1Scgd
4471.1Scgd	.include <bsd.prog.mk>
4481.1Scgd
4491.1ScgdTo build foo from foo.c with a manual page foo.2, add the line:
4501.1Scgd
4511.9Scgd	MAN=	foo.2
4521.1Scgd
4531.1ScgdIf foo does not have a manual page at all, add the line:
4541.1Scgd
4551.75Sagc	MKMAN=	no
4561.1Scgd
4571.1ScgdIf foo has multiple source files, add the line:
4581.1Scgd
4591.1Scgd	SRCS=	a.c b.c c.c d.c
4601.1Scgd
4611.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4621.1Scgd
4631.1ScgdThe include file <bsd.subdir.mk> contains the default targets for building
4641.16Sjtcsubdirectories.  It has the same eight targets as <bsd.prog.mk>: all, 
4651.16Sjtcclean, cleandir, depend, includes, install, lint, and tags.  For all of
4661.72Ssommerfethe directories listed in the variable SUBDIR, the specified directory 
4671.16Sjtcwill be visited and the target made.  There is also a default target which
4681.16Sjtcallows the command "make subdir" where subdir is any directory listed in
4691.72Ssommerfethe variable SUBDIR.
4701.72Ssommerfe
4711.72SsommerfeAs a special case, the use of a token .WAIT as an entry in SUBDIR acts
4721.72Ssommerfeas a synchronization barrier when multiple make jobs are run; subdirs
4731.72Ssommerfebefore the .WAIT must complete before any subdirs after .WAIT are
4741.75Sagcstarted.  See make(1) for some caveats on use of .WAIT and other
4751.75Sagcspecial sources.
4761.21Schristos
4771.21Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4781.21Schristos
4791.23SchristosThe include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
4801.23Schristosand is included from from bsd.lib.mk and bsd.prog.mk.
4811.23Schristos
4821.23Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4831.23Schristos
4841.23SchristosThe include file <bsd.files.mk> handles the FILES variables and is included
4851.23Schristosfrom bsd.lib.mk and bsd.prog.mk.
4861.21Schristos
4871.21Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4881.21Schristos
4891.29ScjsThe include file <bsd.inc.mk> defines the includes target and uses two
4901.29Scjsvariables:
4911.21Schristos
4921.29ScjsINCS	The list of include files
4931.21Schristos
4941.29ScjsINCSDIR	The location to install the include files.
4951.39Scgd
4961.39Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4971.39Scgd
4981.39ScgdThe include file <bsd.kinc.mk> defines the many targets (includes,
4991.39Scgdsubdirectories, etc.), and is used by kernel makefiles to handle
5001.39Scgdinclude file installation.  It is intended to be included alone, by
5011.39Scgdkernel Makefiles.  Please see bsd.kinc.mk for more details, and keep
5021.39Scgdthe documentation in that file up to date.
5031.13Schristos
5041.13Schristos=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5051.13Schristos
5061.47StvThe include file <bsd.info.mk> is used to generate and install GNU Info
5071.47Stvdocumentation from respective Texinfo source files.  It defines three
5081.47Stvimplicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
5091.47Stvfollowing variables:
5101.47Stv
5111.47StvTEXINFO		List of Texinfo source files.  Info documentation will
5121.47Stv		consist of single files with the extension replaced by
5131.47Stv		.info.
5141.47Stv
5151.47StvINFOFLAGS	Flags to pass to makeinfo.  []
5161.47Stv
5171.47StvINSTALL_INFO	Name of install-info program.  [install-info]
5181.47Stv
5191.47StvMAKEINFO	Name of makeinfo program.  [makeinfo]
5201.47Stv
5211.47Stv=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5221.47Stv
5231.13SchristosThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and
5241.14Scgd<bsd.lib.mk>.  It contains overrides that are used when building
5251.14Scgdthe NetBSD source tree.  For instance, if "PARALLEL" is defined by
5261.14Scgdthe program/library Makefile, it includes a set of rules for lex and
5271.14Scgdyacc that allow multiple lex and yacc targets to be built in parallel.
5281.69Ssommerfe
5291.69SsommerfeOther variables of note (incomplete list):
5301.69Ssommerfe
5311.69SsommerfeWARNS		Crank up gcc warning options; WARNS=1 and WARNS=2 are the two
5321.69Ssommerfe		distinct levels.
5331.69Ssommerfe
5341.69SsommerfeFORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
5351.69SsommerfeWFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
5361.75Sagc		WFORMAT belongs in individual makefiles and/or
5371.75Sagc		Makefile.inc files.  (set WFORMAT=1 in individual
5381.75Sagc		makefiles if a program is not security critical and is
5391.75Sagc		doing bizarre things with format strings which would
5401.75Sagc		be even uglier if rewritten) FORMAT_AUDIT should go in
5411.75Sagc		mk.conf if you're doing format-string auditing. 
5421.69Ssommerfe		FORMAT_AUDIT may go away in time.
5431.1Scgd
5441.1Scgd=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5451.1Scgd
5461.1ScgdThe include file <bsd.lib.mk> has support for building libraries.  It has
5471.16Sjtcthe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
5481.44Serhincludes, install, lint, and tags.  Additionally, it has a checkver target
5491.44Serhwhich checks for installed shared object libraries whose version is greater
5501.44Serhthat the version of the source. It has a limited number of suffixes,
5511.16Sjtcconsistent with the current needs of the BSD tree.
5521.1Scgd
5531.1ScgdIt sets/uses the following variables:
5541.10Scgd
5551.10ScgdLIB		The name of the library to build.
5561.1Scgd
5571.1ScgdLIBDIR		Target directory for libraries.
5581.1Scgd
5591.1ScgdLINTLIBDIR	Target directory for lint libraries.
5601.1Scgd
5611.1ScgdLIBGRP		Library group.
5621.1Scgd
5631.1ScgdLIBOWN		Library owner.
5641.1Scgd
5651.1ScgdLIBMODE		Library mode.
5661.1Scgd
5671.1ScgdLDADD		Additional loader objects.
5681.1Scgd
5691.15ScgdMAN		The manual pages to be installed (use a .1 - .9 suffix).
5701.47Stv
5711.47StvMKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
5721.47Stv		Also:
5731.47Stv			- don't install the .a libraries
5741.47Stv			- don't install _pic.a libraries on PIC systems
5751.47Stv			- don't build .a libraries on PIC systems
5761.47Stv			- don't install the .so symlink on ELF systems
5771.47Stv		I.e, only install the shared library (and the .so.major
5781.47Stv		symlink on ELF).
5791.54Ssimonb
5801.54SsimonbMKPICLIB	If "no", don't build _pic.a libraries, and build the
5811.54Ssimonb		shared object libraries from the .a libraries.  A
5821.54Ssimonb		symlink is installed in ${DESTDIR}/usr/lib for the
5831.54Ssimonb		_pic.a library pointing to the .a library.
5841.44Serh
5851.44SerhNOCHECKVER_<library>
5861.44SerhNOCHECKVER	If set, disables checking for installed shared object
5871.44Serh		libraries with versions greater than the source.  A
5881.44Serh		particular library name, without the "lib" prefix, may
5891.44Serh		be appended to the variable name to disable the check for
5901.44Serh		only that library.
5911.1Scgd
5921.1ScgdSRCS		List of source files to build the library.  Suffix types
5931.1Scgd		.s, .c, and .f are supported.  Note, .s files are preferred
5941.1Scgd		to .c files of the same name.  (This is not the default for
5951.1Scgd		versions of make.)
5961.1Scgd
5971.1ScgdThe include file <bsd.lib.mk> includes the file named "../Makefile.inc"
5981.1Scgdif it exists, as well as the include file <bsd.man.mk>.
5991.1Scgd
6001.1ScgdIt has rules for building profiled objects; profiled libraries are
6011.1Scgdbuilt by default.
6021.1Scgd
6031.4ScgdLibraries are ranlib'd when made.
6041.56Ssommerfe
6051.56Ssommerfe=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6061.56Ssommerfe
6071.56SsommerfeThe include file <bsd.obj.mk> defines targets related to the creation
6081.56Ssommerfeand use of separated object and source directories.
6091.56Ssommerfe
6101.63SsjgIf an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
6111.63Ssjg${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
6121.75Sagcit exists.  Otherwise make(1) looks for the existence of a
6131.63Ssjgsubdirectory (or a symlink to a directory) of the source directory
6141.63Ssjginto which built targets should be placed.  If an environment variable
6151.63Ssjgnamed MAKEOBJDIR is set, make(1) uses its value as the name of the
6161.63Ssjgobject directory; failing that, make first looks for a subdirectory
6171.63Ssjgnamed "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
6181.56Ssommerfe
6191.56SsommerfeObject directories are not created automatically by make(1) if they
6201.56Ssommerfedon't exist; you need to run a separate "make obj".  (This will happen
6211.56Ssommerfeduring a top-level build if "MKOBJDIRS" is set to a value other than
6221.58Ssommerfe"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
6231.58Ssommerfeand this is determined by a simple string prefix comparison -- object
6241.58Ssommerfedirectories are created in a separate object directory tree, and a
6251.58Ssommerfesymlink to the object directory in that tree is created in the source
6261.58Ssommerfedirectory; otherwise, "make obj" assumes that you're not in the main
6271.58Ssommerfesource tree and that it's not safe to use a separate object tree.
6281.56Ssommerfe
6291.56SsommerfeSeveral variables used by <bsd.obj.mk> control exactly what
6301.56Ssommerfedirectories and links get created during a "make obj":
6311.56Ssommerfe
6321.56SsommerfeMAKEOBJDIR	If set, this is the component name of the object
6331.56Ssommerfe		directory.
6341.56Ssommerfe
6351.56SsommerfeOBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
6361.56Ssommerfe		object directories or links named "obj.${MACHINE}";
6371.56Ssommerfe		otherwise, just creates ones named "obj".
6381.56Ssommerfe
6391.56SsommerfeUSR_OBJMACHINE  If set, and the current directory is a subdirectory of
6401.56Ssommerfe		${BSDSRCDIR}, create object directory in the
6411.56Ssommerfe		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
6421.56Ssommerfe		otherwise, create it in the corresponding subdirectory
6431.56Ssommerfe		of ${BSDOBJDIR}
6441.63Ssjg
6451.63Ssjg=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6461.63Ssjg
6471.63SsjgThe include file <bsd.kernobj.mk> defines variables related to the
6481.63Ssjglocation of kernel sources and object directories.
6491.63Ssjg
6501.63SsjgKERNSRCDIR	Is the location of the top of the kernel src.
6511.63Ssjg		It defaults to ${BSDSRCDIR}/sys, but the top-level
6521.63Ssjg		Makefile.inc sets it to ${ABSTOP}/sys (ABSTOP is the
6531.63Ssjg		absolute path to the directory where the top-level
6541.63Ssjg		Makefile.inc was found.
6551.63Ssjg
6561.63SsjgKERNARCHDIR	Is the location of the machine dependent kernel
6571.63Ssjg		sources.  It defaults to arch/${MACHINE}
6581.63Ssjg		
6591.63SsjgKERNCONFDIR	Is where the configuration files for kernels are
6601.63Ssjg		found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
6611.63Ssjg
6621.63SsjgKERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
6631.63Ssjg		instance will be compiled in ${KERNOBJDIR}/GENERIC.
6641.63Ssjg		The default value is
6651.63Ssjg		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
6661.63Ssjg		if it exists or the target 'obj' is being made.
6671.63Ssjg		Otherwise the default is
6681.63Ssjg		${KERNSRCDIR}/${KERNARCHDIR}/compile.
6691.63Ssjg
6701.63SsjgIt is important that Makefiles (such as those under src/distrib) that
6711.63Ssjgwish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
6721.63Ssjgrather than make assumptions about the location of the compiled kernel.
6731.30Sagc
6741.30Sagc=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
675