bsd.README revision 1.143
11.143Slukem#	$NetBSD: bsd.README,v 1.143 2004/01/03 01:06:55 lukem 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.142SlukemThere are various make variables used during the build.
621.142Slukem
631.142SlukemMany variables support a (case sensitive) value of "no" or "yes",
641.142Slukemand are tested with  ${VAR} == "no"  and  ${VAR} != "no" .
651.142Slukem
661.142Slukem
671.142SlukemThe basic rule for the variable naming scheme is as follows:
681.97Sitojun
691.129SlukemMKxxx		Can be set to "no" to disable functionality, or
701.129Slukem		"yes" to enable it.
711.129Slukem		Usually defaults to "yes", although some variables
721.129Slukem		default to "no".
731.129Slukem		Due to make(1) implementation issues, if a temporary
741.142Slukem		command-line override of a mk.conf or <bsd.own.mk>
751.142Slukem		setting is required whilst still honouring a particular
761.129Slukem		Makefile's setting of MKxxx, use
771.129Slukem			env MKxxx=value make
781.129Slukem		instead of
791.129Slukem			make MKxxx=value
801.97Sitojun
811.116SlukemNOxxx		If defined, disables a feature.
821.116Slukem		Not intended for users.
831.116Slukem		This is to allow Makefiles to disable functionality
841.116Slukem		that they don't support (such as missing man pages).
851.101Slukem		NOxxx variables must be defined before <bsd.own.mk>
861.101Slukem		is included.
871.21Schristos
881.45SlukemThe following variables that control how things are made/installed that
891.47Stvare not set by default. These should not be set by Makefiles; they're for
901.134Slukemthe user to define in MAKECONF (see <bsd.own.mk>, below) or on the make(1)
911.47Stvcommand line:
921.21Schristos
931.45SlukemBUILD 		If defined, 'make install' checks that the targets in the
941.45Slukem		source directories are up-to-date and remakes them if they
951.21Schristos                are out of date, instead of blindly trying to install
961.79Swiz                out of date or non-existent targets.
971.141Slukem
981.141SlukemMAKEVERBOSE	Control how "verbose" the standard make(1) rules are.
991.141Slukem		Default: 2
1001.141Slukem		Supported values:
1011.141Slukem		    0	Minimal output ("quiet")
1021.141Slukem		    1	Describe what is occurring
1031.141Slukem		    2	Describe what is occurring and echo the actual command
1041.141Slukem
1051.21Schristos
1061.120SlukemMKBFD		If "no", don't build libbfd, libiberty, or any of the things
1071.120Slukem		that depend on them (binutils/gas/ld, gdb, dbsym, mdsetimage).
1081.120Slukem		Default: yes
1091.120Slukem
1101.121SlukemMKCATPAGES	If "no", don't build or install the catman pages.
1111.121Slukem		Default: yes
1121.121Slukem
1131.120SlukemMKCRYPTO	If "no", no cryptography support will be built into the system,
1141.142Slukem		and also acts as "MKKERBEROS=no MKKERBEROS4=no".
1151.120Slukem		Default: yes
1161.120Slukem
1171.120SlukemMKCRYPTO_IDEA	If not "no", IDEA support will be built into libcrypto_idea.a.
1181.120Slukem		Default: no
1191.52Ssimonb
1201.120SlukemMKCRYPTO_MDC2	If not "no", MDC2 support will be built into libcrypto_mdc2.a
1211.120Slukem		Default: no
1221.45Slukem
1231.120SlukemMKCRYPTO_RC5	If not "no", RC5 support will be built into libcrypto_rc5.a.
1241.120Slukem		Default: no
1251.86Sthorpej
1261.143SlukemMKCVS		If "no", don't build or install cvs(1).
1271.143Slukem		Default: yes
1281.143Slukem
1291.45SlukemMKDOC		If "no", don't build or install the documentation.
1301.120Slukem		Default: yes
1311.86Sthorpej
1321.104SlukemMKDYNAMICROOT	If "no", build programs in /bin and /sbin statically,
1331.104Slukem		don't install certain libraries in /lib, and don't
1341.104Slukem		install the shared linker into /libexec.
1351.120Slukem		Default: yes
1361.120Slukem
1371.143SlukemMKGCC		If "no", don't build gcc(1) or any of the gcc-related
1381.120Slukem		libraries (libg2c, libgcc, libobjc, libstdc++).
1391.120Slukem		Default: yes
1401.104Slukem
1411.143SlukemMKGCCCMDS	If "no", don't build gcc(1).
1421.143Slukem		Default: yes
1431.143Slukem
1441.143SlukemMKGDB		If "no", don't build gdb(1).
1451.120Slukem		Default: yes
1461.120Slukem
1471.120SlukemMKHESIOD	If "no", disables building of Hesiod infrastructure
1481.120Slukem		(libraries and support programs).
1491.120Slukem		Default: yes
1501.121Slukem
1511.142SlukemMKHOSTOBJ	If not "no", for programs intended to be run on the compile
1521.142Slukem		host, the name, release, and architecture of the host
1531.142Slukem		operating system will be suffixed to the name of the object
1541.142Slukem		directory created by "make obj".
1551.121Slukem		Default: no
1561.86Sthorpej
1571.120SlukemMKHTML		If "no", don't build or install the html man pages.
1581.120Slukem		Default: yes
1591.92Sross
1601.92SrossMKIEEEFP	If "no", don't add code for IEEE754/IEC60559 conformance.
1611.92Sross		Has no effect on most platforms.
1621.120Slukem		Default: yes
1631.45Slukem
1641.47StvMKINFO		If "no", don't build or install Info documentation from
1651.47Stv		Texinfo source files.
1661.120Slukem		Default: yes
1671.120Slukem
1681.126SitojunMKKERBEROS4	If "no", disables building of Kerberos v4
1691.126Sitojun		infrastructure (libraries and support programs).
1701.126Sitojun		Default: yes
1711.126Sitojun
1721.126SitojunMKKERBEROS	If "no", disables building of Kerberos v5
1731.120Slukem		infrastructure (libraries and support programs).
1741.120Slukem		Default: yes
1751.120Slukem
1761.120SlukemMKLINKLIB	If "no", act as "MKPICINSTALL=no MKPROFILE=no".
1771.120Slukem		Also:
1781.120Slukem			- don't install the .a libraries
1791.120Slukem			- don't install _pic.a libraries on PIC systems
1801.120Slukem			- don't build .a libraries on PIC systems
1811.120Slukem			- don't install the .so symlink on ELF systems
1821.120Slukem		I.e, only install the shared library (and the .so.major
1831.120Slukem		symlink on ELF).
1841.120Slukem		Default: yes
1851.45Slukem
1861.45SlukemMKLINT		If "no", don't build or install the lint libraries.
1871.120Slukem		Default: yes
1881.45Slukem
1891.120SlukemMKMAN		If "no", don't build or install the man or catman pages,
1901.142Slukem		and also acts as "MKCATPAGES=no MKHTML=no".
1911.120Slukem		Default: yes
1921.45Slukem
1931.119SlukemMKMANZ		If not "no", compress manual pages at installation time.
1941.120Slukem		Default: no
1951.119Slukem
1961.74SitojunMKNLS		If "no", don't build or install the NLS files and locale
1971.74Sitojun		definition files.
1981.120Slukem		Default: yes
1991.45Slukem
2001.120SlukemMKOBJ		If "no", don't enable the rule which creates objdirs,
2011.142Slukem		and also acts as "MKOBJDIRS=no".
2021.120Slukem		Default: yes
2031.55Ssommerfe
2041.55SsommerfeMKOBJDIRS	If "no", don't create objdirs during a "make build".
2051.120Slukem		Default: no
2061.45Slukem
2071.120SlukemMKPIC		If "no", don't build or install shared libraries, and
2081.120Slukem		also acts as "MKPICLIB=no"
2091.122Slukem		Default: yes, except for ${MACHINE_ARCH} == "sh3"
2101.45Slukem
2111.45SlukemMKPICINSTALL	If "no", don't install the *_pic.a libraries.
2121.120Slukem		Default: yes
2131.120Slukem
2141.120SlukemMKPICLIB	If "no", don't build *_pic.a libraries, and build the
2151.120Slukem		shared object libraries from the .a libraries.
2161.120Slukem		A symlink is installed in ${DESTDIR}/usr/lib for the
2171.120Slukem		_pic.a library pointing to the .a library.
2181.120Slukem		Default: yes
2191.45Slukem
2201.143SlukemMKPOSTFIX	If "no", don't build or install postfix(1).
2211.143Slukem		Default: yes
2221.143Slukem
2231.138SlukemMKPROFILE	If "no", don't build or install the profiling (*_p.a) libraries.
2241.120Slukem		Default: yes
2251.120Slukem
2261.143SlukemMKSENDMAIL	If "no", don't build or install sendmail(8).
2271.143Slukem		Default: yes
2281.143Slukem
2291.120SlukemMKSHARE		If "no", act as "MKCATPAGES=no MKDOC=no MKHTML=no MKINFO=no
2301.120Slukem		MKMAN=no MKNLS=no".
2311.120Slukem		I.e, don't build catman pages, documentation, Info
2321.120Slukem		documentation, man pages, NLS files, ...
2331.120Slukem		Default: yes
2341.120Slukem
2351.120SlukemMKSKEY		If "no", disables building of S/key authentication
2361.120Slukem		infrastructure (libraries and support programs).
2371.120Slukem		Default: yes
2381.120Slukem
2391.120SlukemMKSOFTFLOAT	If not "no", build with options to enable the compiler to
2401.120Slukem		generate output containing library calls for floating
2411.120Slukem		point and possibly soft-float library support.
2421.120Slukem		Default: no
2431.138Slukem
2441.138SlukemMKSTATICLIB	If "no", don't build or install the normal static (*.a)
2451.138Slukem		libraries.
2461.138Slukem		Default: yes
2471.120Slukem
2481.120SlukemMKUNPRIVED	If not "no", don't set the owner/group/mode when installing
2491.120Slukem		files or directories, and keep a metadata log of what
2501.120Slukem		the owner/group/mode should be.  This allows a
2511.120Slukem		non-root "make install".
2521.120Slukem		Default: no
2531.120Slukem
2541.120SlukemMKUPDATE 	If not "no", 'make install' only installs targets that are
2551.120Slukem		more recently modified in the source directories that their
2561.120Slukem		installed counterparts.
2571.120Slukem		Default: no
2581.45Slukem
2591.143SlukemMKUUCP		If "no", don't build or install uucp(1).
2601.143Slukem		Default: yes
2611.143Slukem
2621.120SlukemMKYP		If "no", disables building of YP (NIS)
2631.120Slukem		infrastructure (libraries and support programs).
2641.120Slukem		Default: yes
2651.1Scgd
2661.129SlukemUSE_HESIOD	If "no", disables building Hesiod support into
2671.122Slukem		various system utilities/libraries that support it.
2681.142Slukem		If ${MKHESIOD} is "no", USE_HESIOD will also be
2691.122Slukem		forced to "no".
2701.122Slukem
2711.129SlukemUSE_KERBEROS4	If "no", disables building Kerberos v4
2721.126Sitojun		support into various system utilities/libraries that
2731.142Slukem		support it.  If ${MKKERBEROS4} is "no", USE_KERBEROS4
2741.126Sitojun		will also be forced to "no".
2751.126Sitojun
2761.129SlukemUSE_KERBEROS	If "no", disables building Kerberos v4 or v5)
2771.122Slukem		support into various system utilities/libraries that
2781.142Slukem		support it.  If ${MKKERBEROS} is "no", USE_KERBEROS
2791.122Slukem		will also be forced to "no".
2801.122Slukem
2811.129SlukemUSE_SKEY	If "no", disables building S/key authentication
2821.122Slukem		support into various system utilities/libraries that
2831.142Slukem		support it.  If ${MKSKEY} is "no", USE_SKEY will
2841.122Slukem		also be forced to "no".
2851.122Slukem
2861.129SlukemUSE_YP		If "no", disables building YP (NIS) support into
2871.129Slukem		various system utilities/libraries that support it.
2881.142Slukem		If ${MKYP} is "no", USE_YP will also be forced to "no".
2891.122Slukem
2901.136SerhCOPTS.lib<lib>
2911.136SerhLDADD.lib<lib>
2921.136SerhCPPFLAGS.lib<lib>
2931.136SerhCXXFLAGS.lib<lib>
2941.136SerhCOPTS.<prog>
2951.136SerhLDADD.<prog>
2961.136SerhCPPFLAGS.<prog>
2971.137SsimonbCXXFLAGS.<prog>	These provide a way to specify additions to the associated
2981.137Ssimonb		variables in a way that applies only to a particular library
2991.137Ssimonb		or program.  <lib> corresponds to the LIB variable set in
3001.137Ssimonb		the library's makefile.  <prog> corresponds to either PROG
3011.137Ssimonb		or PROG_CXX (if set).  For example, if COPTS.libcrypto is
3021.137Ssimonb		set to "-g", "-g" will be added to COPTS only when compiling
3031.137Ssimonb		the crypto library.
3041.118Slukem
3051.118Slukem=-=-=-=-=   sys.mk   =-=-=-=-=
3061.1Scgd
3071.1ScgdThe include file <sys.mk> has the default rules for all makes, in the BSD
3081.1Scgdenvironment or otherwise.  You probably don't want to touch this file.
3091.1Scgd
3101.118Slukem=-=-=-=-=   bsd.own.mk   =-=-=-=-=
3111.1Scgd
3121.17SthorpejThe include file <bsd.own.mk> contains source tree configuration parameters,
3131.17Sthorpejsuch as the owners, groups, etc. for both manual pages and binaries, and
3141.17Sthorpeja few global "feature configuration" parameters.
3151.1Scgd
3161.1ScgdIt has no targets.
3171.1Scgd
3181.134SlukemTo get system-specific configuration parameters, <bsd.own.mk> will try to
3191.29Scjsinclude the file specified by the "MAKECONF" variable.  If MAKECONF is not
3201.29Scjsset, or no such file exists, the system make configuration file, /etc/mk.conf
3211.29Scjsis included.  These files may define any of the variables described below.
3221.17Sthorpej
3231.134Slukem<bsd.own.mk> sets the following variables, if they are not already defined
3241.17Sthorpej(defaults are in brackets):
3251.15Scgd
3261.98SlukemNETBSDSRCDIR	Top of the NetBSD source tree.
3271.98Slukem		If _SRC_TOP_ != "", that will be used as the default,
3281.98Slukem		otherwise BSDSRCDIR will be used as the default.
3291.98Slukem		Various makefiles within the NetBSD source tree will
3301.98Slukem		use this to reference the top level of the source tree.
3311.98Slukem
3321.95Slukem_SRC_TOP_	Top of the system source tree, as determined by <bsd.own.mk>
3331.98Slukem		based on the presence of tools/ and build.sh.  This variable
3341.98Slukem		is "internal" to <bsd.own.mk>, although its value is only
3351.98Slukem		determined once and then propagated to all sub-makes.
3361.95Slukem
3371.15ScgdBSDSRCDIR	The real path to the system sources, so that 'make obj'
3381.116Slukem		will work correctly.  [/usr/src]
3391.15Scgd
3401.15ScgdBSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
3411.116Slukem		will work correctly.  [/usr/obj]
3421.15Scgd
3431.116SlukemBINGRP		Binary group.  [wheel]
3441.15Scgd
3451.116SlukemBINOWN		Binary owner.  [root]
3461.15Scgd
3471.116SlukemBINMODE		Binary mode.  [555]
3481.15Scgd
3491.116SlukemNONBINMODE	Mode for non-executable files.  [444]
3501.15Scgd
3511.116SlukemMANDIR		Base path for manual installation.  [/usr/share/man/cat]
3521.15Scgd
3531.116SlukemMANGRP		Manual group.  [wheel]
3541.15Scgd
3551.116SlukemMANOWN		Manual owner.  [root]
3561.15Scgd
3571.116SlukemMANMODE		Manual mode.  [${NONBINMODE}]
3581.15Scgd
3591.21SchristosMANINSTALL	Manual installation type: maninstall, catinstall, or both
3601.76Sfair
3611.76SfairLDSTATIC	Control program linking; if set blank, link everything
3621.129Slukem		dynamically.  If set to "-static", link everything statically.
3631.76Sfair		If not set, programs link according to their makefile.
3641.21Schristos
3651.116SlukemLIBDIR		Base path for library installation.  [/usr/lib]
3661.15Scgd
3671.116SlukemLINTLIBDIR	Base path for lint(1) library installation.  [/usr/libdata/lint]
3681.15Scgd
3691.116SlukemLIBGRP		Library group.  [${BINGRP}]
3701.15Scgd
3711.116SlukemLIBOWN		Library owner.  [${BINOWN}]
3721.15Scgd
3731.116SlukemLIBMODE		Library mode.  [${NONBINMODE}]
3741.15Scgd
3751.15ScgdDOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
3761.116Slukem	        installation.  [/usr/share/doc]
3771.62Ssimonb
3781.62SsimonbHTMLDOCDIR	Base path for html system documentation installation.
3791.62Ssimonb		[/usr/share/doc/html]
3801.15Scgd
3811.116SlukemDOCGRP		Documentation group.  [wheel]
3821.15Scgd
3831.116SlukemDOCOWN		Documentation owner.  [root]
3841.15Scgd
3851.116SlukemDOCMODE		Documentation mode.  [${NONBINMODE}]
3861.15Scgd
3871.84SkleinkNLSDIR		Base path for Native Language Support files installation.
3881.15Scgd		[/usr/share/nls]
3891.1Scgd
3901.116SlukemNLSGRP		Native Language Support files group.  [wheel]
3911.1Scgd
3921.116SlukemNLSOWN		Native Language Support files owner.  [root]
3931.1Scgd
3941.116SlukemNLSMODE		Native Language Support files mode.  [${NONBINMODE}]
3951.1Scgd
3961.32SmikelSTRIPFLAG	The flag passed to the install program to cause the binary
3971.1Scgd		to be stripped.  This is to be used when building your
3981.1Scgd		own install script so that the entire system can be made
3991.116Slukem		stripped/not-stripped using a single knob.  [-s]
4001.1Scgd
4011.2ScgdCOPY		The flag passed to the install program to cause the binary
4021.2Scgd		to be copied rather than moved.  This is to be used when
4031.2Scgd		building our own install script so that the entire system
4041.2Scgd		can either be installed with copies, or with moves using
4051.116Slukem		a single knob.  [-c]
4061.15Scgd
4071.134SlukemAdditionally, the following variables may be set by <bsd.own.mk> or in a
4081.17Sthorpejmake configuration file to modify the behaviour of the system build
4091.17Sthorpejprocess (default values are in brackets along with comments, if set by
4101.134Slukem<bsd.own.mk>):
4111.33Sjonathan
4121.142SlukemUSETOOLS	Indicates whether the tools specified by ${TOOLDIR} should
4131.142Slukem		be used as part of a build in progress.
4141.142Slukem		Supported values:
4151.142Slukem
4161.142Slukem		yes	Use the tools from TOOLDIR.
4171.142Slukem			Must be set to this if cross-compiling.
4181.142Slukem
4191.142Slukem		no	Do not use the tools from TOOLDIR, but refuse to
4201.142Slukem			build native compilation tool components that are
4211.142Slukem			version-specific for that tool.
4221.142Slukem
4231.142Slukem		never	Do not use the tools from TOOLDIR, even when
4241.142Slukem			building native tool components.  This is similar to
4251.142Slukem			the traditional NetBSD build method, but does not
4261.142Slukem			verify that the compilation tools in use are
4271.142Slukem			up-to-date enough in order to build the tree
4281.142Slukem			successfully.  This may cause build or runtime
4291.142Slukem			problems when building the whole NetBSD source tree.
4301.142Slukem
4311.142Slukem		Default: "yes" if building all or part of a whole NetBSD
4321.142Slukem		source tree (detected automatically); "no" otherwise
4331.142Slukem		(to preserve traditional semantics of the <bsd.*.mk>
4341.142Slukem		make(1) include files).
4351.142Slukem
4361.116SlukemOBJECT_FMT	Object file format.  [set to "ELF" on architectures that
4371.50Sthorpej		use ELF -- currently if ${MACHINE_ARCH} is "alpha",
4381.50Sthorpej		"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
4391.77Ssimonb		"i386" and some m68k machines, or set to "a.out" on
4401.77Ssimonb		other architectures].
4411.33Sjonathan
4421.103SthorpejTOOLCHAIN_MISSING
4431.142Slukem		If not "no", this indicates that the platform being built
4441.103Sthorpej		does not have a working in-tree toolchain.  If the
4451.142Slukem		${MACHINE_ARCH} in question falls into this category,
4461.142Slukem		TOOLCHAIN_MISSING is conditionally assigned the value "yes". 
4471.103Sthorpej		Otherwise, the variable is unconditionally assigned the
4481.103Sthorpej		value "no".
4491.142Slukem		If not "no", ${MKBFD}, ${MKGCC}, and ${MKGDB} are
4501.142Slukem		unconditionally assigned the value "no".
4511.103Sthorpej
4521.103SthorpejEXTERNAL_TOOLCHAIN
4531.103Sthorpej		This variable is not directly set by <bsd.own.mk>, but
4541.103Sthorpej		including <bsd.own.mk> is the canonical way to gain
4551.103Sthorpej		access to this variable.  The variable should be defined
4561.103Sthorpej		either in the user's environment or in the user's mk.conf
4571.103Sthorpej		file.  If defined, this variable indicates the root of
4581.103Sthorpej		an external toolchain which will be used to build the
4591.142Slukem		tree.  For example, if a platform is a ${TOOLCHAIN_MISSING}
4601.103Sthorpej		platform, EXTERNAL_TOOLCHAIN can be used to re-enable the
4611.103Sthorpej		cross-compile framework.
4621.103Sthorpej
4631.142Slukem		If EXTERNAL_TOOLCHAIN is defined, ${MKGCC} is unconditionally
4641.142Slukem		assigned the value "no", since the external version of the
4651.142Slukem		compiler may not be able to build the library components of
4661.142Slukem		the in-tree compiler.
4671.103Sthorpej
4681.103Sthorpej		NOTE: This variable is not yet used in as many places as
4691.103Sthorpej		it should be.  Expect the exact semantics of this variable
4701.103Sthorpej		to change in the short term as parts of the cross-compile
4711.103Sthorpej		framework continue to be cleaned up.
4721.1Scgd
4731.134Slukem<bsd.own.mk> is generally useful when building your own Makefiles so that
4741.1Scgdthey use the same default owners etc. as the rest of the tree.
4751.131Slukem
4761.131Slukem
4771.131Slukem=-=-=-=-=   bsd.dep.mk   =-=-=-=-=
4781.131Slukem
4791.131SlukemThe include file <bsd.dep.mk> contains the default targets for building
4801.133Slukem.depend files.  It creates .d files from entries in SRCS and DPSRCS
4811.133Slukemthat are C, C++, or Objective C source files, and builds .depend from the
4821.133Slukem.d files.  All other files in SRCS and all of DPSRCS will be used as
4831.133Slukemdependencies for the .d files.  In order for this to function correctly,
4841.132Slukemit should be .included after all other .mk files and directives that may
4851.132Slukemmodify SRCS or DPSRCS.  It uses the following variables:
4861.132Slukem
4871.132SlukemSRCS		List of source files to build the program.
4881.132Slukem
4891.132SlukemDPSRCS		List of source files which are needed for generating
4901.132Slukem		dependencies, but are not needed in ${SRCS}.
4911.1Scgd
4921.1Scgd
4931.118Slukem=-=-=-=-=   bsd.files.mk   =-=-=-=-=
4941.106Sthorpej
4951.118SlukemThe include file <bsd.files.mk> handles the FILES variables and is included
4961.134Slukemfrom <bsd.lib.mk> and <bsd.prog.mk>, and uses the following variables:
4971.124Slukem
4981.124SlukemFILES		The list of files to install.
4991.124Slukem
5001.124SlukemFILESOWN	File owner.  [${BINOWN}]
5011.124Slukem
5021.124SlukemFILESGRP	File group.  [${BINGRP}]
5031.124Slukem
5041.124SlukemFILESMODE	File mode.  [${BINMODE}]
5051.124Slukem
5061.124SlukemFILESDIR	The location to install the files.
5071.124Slukem
5081.124SlukemFILESNAME	Optional name to install each file as.
5091.124Slukem
5101.124SlukemFILESDIR.<fn>	The location to install the specific file <fn>.
5111.124Slukem
5121.124SlukemFILESNAME.<fn>	Optional name to install <fn> as.
5131.135Slukem
5141.139SlukemBUILDSYMLINKS	List of two word items:
5151.135Slukem			lnsrc lntgt
5161.135Slukem		For each lnsrc item, create a symlink named lntgt.
5171.135Slukem		The lntgt symlinks are removed by the cleandir target.
5181.106Sthorpej
5191.106Sthorpej
5201.118Slukem=-=-=-=-=   bsd.gcc.mk   =-=-=-=-=
5211.113Sthorpej
5221.113SthorpejThe include file <bsd.gcc.mk> computes various parameters related to GCC
5231.113Sthorpejsupport libraries.  It defines no targets.  <bsd.own.mk> MUST be included
5241.134Slukembefore <bsd.gcc.mk>.
5251.113Sthorpej
5261.134SlukemThe primary users of <bsd.gcc.mk> are <bsd.prog.mk> and <bsd.lib.mk>, each
5271.113Sthorpejof which need to know where to find certain GCC support libraries.
5281.113Sthorpej
5291.134SlukemThe behavior of <bsd.gcc.mk> is influenced by the EXTERNAL_TOOLCHAIN variable,
5301.113Sthorpejwhich is generally set by the user.  If EXTERNAL_TOOLCHAIN it set, then
5311.113Sthorpejthe compiler is asked where to find the support libraries, otherwise the
5321.113Sthorpejsupport libraries are found in ${DESTDIR}/usr/lib.
5331.113Sthorpej
5341.134Slukem<bsd.gcc.mk> sets the following variables:
5351.113Sthorpej
5361.118Slukem_GCC_CRTBEGIN	The full path name to crtbegin.o.
5371.118Slukem
5381.118Slukem_GCC_CRTBEGINS	The full path name to crtbeginS.o.
5391.118Slukem
5401.118Slukem_GCC_CRTEND	The full path name to crtend.o.
5411.118Slukem
5421.118Slukem_GCC_CRTENDS	The full path name to crtendS.o.
5431.118Slukem
5441.118Slukem_GCC_LIBGCCDIR	The directory where libgcc.a is located.
5451.118Slukem
5461.118Slukem
5471.118Slukem=-=-=-=-=   bsd.inc.mk   =-=-=-=-=
5481.118Slukem
5491.134SlukemThe include file <bsd.inc.mk> defines the includes target and uses the
5501.118Slukemvariables:
5511.118Slukem
5521.124SlukemINCS		The list of include files.
5531.118Slukem
5541.118SlukemINCSDIR		The location to install the include files.
5551.118Slukem
5561.118SlukemINCSNAME	Target name of the include file, if only one; same as
5571.118Slukem		FILESNAME, but for include files.
5581.118Slukem
5591.134SlukemINCSYMLINKS	Similar to SYMLINKS in <bsd.links.mk>, except that these
5601.134Slukem		are installed in the 'includes' target and not the
5611.134Slukem		(much later) 'install' target.
5621.134Slukem
5631.118SlukemINCSNAME_<file>	The name file <file> should be installed as, if not <file>,
5641.118Slukem		same as FILESNAME_<file>, but for include files.
5651.118Slukem
5661.118Slukem
5671.118Slukem=-=-=-=-=   bsd.info.mk   =-=-=-=-=
5681.118Slukem
5691.118SlukemThe include file <bsd.info.mk> is used to generate and install GNU Info
5701.118Slukemdocumentation from respective Texinfo source files.  It defines three
5711.118Slukemimplicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
5721.118Slukemfollowing variables:
5731.118Slukem
5741.118SlukemTEXINFO		List of Texinfo source files.  Info documentation will
5751.118Slukem		consist of single files with the extension replaced by
5761.118Slukem		.info.
5771.118Slukem
5781.118SlukemINFOFLAGS	Flags to pass to makeinfo.  []
5791.118Slukem
5801.118Slukem
5811.118Slukem=-=-=-=-=   bsd.kernobj.mk   =-=-=-=-=
5821.118Slukem
5831.118SlukemThe include file <bsd.kernobj.mk> defines variables related to the
5841.118Slukemlocation of kernel sources and object directories.
5851.118Slukem
5861.118SlukemKERNSRCDIR	Is the location of the top of the kernel src.
5871.124Slukem		[${_SRC_TOP_}/sys]
5881.118Slukem
5891.124SlukemKERNARCHDIR	Is the location of the machine dependent kernel sources.
5901.124Slukem		[arch/${MACHINE}]
5911.120Slukem
5921.124SlukemKERNCONFDIR	Is where the configuration files for kernels are found.
5931.124Slukem		[${KERNSRCDIR}/${KERNARCHDIR}/conf]
5941.118Slukem
5951.118SlukemKERNOBJDIR	Is the kernel build directory.  The kernel GENERIC for
5961.118Slukem		instance will be compiled in ${KERNOBJDIR}/GENERIC.
5971.118Slukem		The default value is
5981.118Slukem		${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
5991.118Slukem		if it exists or the target 'obj' is being made.
6001.118Slukem		Otherwise the default is
6011.118Slukem		${KERNSRCDIR}/${KERNARCHDIR}/compile.
6021.118Slukem
6031.118SlukemIt is important that Makefiles (such as those under src/distrib) that
6041.134Slukemwish to find compiled kernels use <bsd.kernobj.mk> and ${KERNOBJDIR}
6051.118Slukemrather than make assumptions about the location of the compiled kernel.
6061.118Slukem
6071.118Slukem
6081.118Slukem=-=-=-=-=   bsd.kinc.mk   =-=-=-=-=
6091.118Slukem
6101.118SlukemThe include file <bsd.kinc.mk> defines the many targets (includes,
6111.118Slukemsubdirectories, etc.), and is used by kernel makefiles to handle
6121.118Slukeminclude file installation.  It is intended to be included alone, by
6131.134Slukemkernel Makefiles.  It uses similar variables to <bsd.inc.mk>.
6141.134SlukemPlease see <bsd.kinc.mk> for more details, and keep the documentation
6151.134Slukemin that file up to date.
6161.118Slukem
6171.118Slukem
6181.118Slukem=-=-=-=-=   bsd.lib.mk   =-=-=-=-=
6191.118Slukem
6201.118SlukemThe include file <bsd.lib.mk> has support for building libraries.  It has
6211.118Slukemthe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
6221.118Slukemincludes, install, lint, and tags.  Additionally, it has a checkver target
6231.118Slukemwhich checks for installed shared object libraries whose version is greater
6241.118Slukemthat the version of the source. It has a limited number of suffixes,
6251.134Slukemconsistent with the current needs of the BSD tree.  <bsd.lib.mk> includes
6261.118Slukem<bsd.shlib.mk> to get shared library parameters.
6271.118Slukem
6281.118SlukemIt sets/uses the following variables:
6291.118Slukem
6301.118SlukemLIB		The name of the library to build.
6311.118Slukem
6321.118SlukemLIBDIR		Target directory for libraries.
6331.118Slukem
6341.118SlukemSHLIBINSTALLDIR	Target directory for shared libraries if ${USE_SHLIBDIR}
6351.142Slukem		is not "no".
6361.118Slukem
6371.142SlukemUSE_SHLIBDIR	If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
6381.118Slukem		as the path to install shared libraries to.
6391.118Slukem		USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
6401.130Slukem		Default: no
6411.118Slukem
6421.118SlukemLINTLIBDIR	Target directory for lint libraries.
6431.118Slukem
6441.118SlukemLIBGRP		Library group.
6451.118Slukem
6461.118SlukemLIBOWN		Library owner.
6471.118Slukem
6481.118SlukemLIBMODE		Library mode.
6491.118Slukem
6501.118SlukemLDADD		Additional loader objects.
6511.118Slukem
6521.118SlukemMAN		The manual pages to be installed (use a .1 - .9 suffix).
6531.118Slukem
6541.118SlukemNOCHECKVER_<library>
6551.118SlukemNOCHECKVER	If set, disables checking for installed shared object
6561.118Slukem		libraries with versions greater than the source.  A
6571.118Slukem		particular library name, without the "lib" prefix, may
6581.118Slukem		be appended to the variable name to disable the check for
6591.118Slukem		only that library.
6601.118Slukem
6611.118SlukemSRCS		List of source files to build the library.  Suffix types
6621.118Slukem		.s, .c, and .f are supported.  Note, .s files are preferred
6631.118Slukem		to .c files of the same name.  (This is not the default for
6641.118Slukem		versions of make.)
6651.118Slukem
6661.118SlukemThe include file <bsd.lib.mk> includes the file named "../Makefile.inc"
6671.118Slukemif it exists, as well as the include file <bsd.man.mk>.
6681.118Slukem
6691.118SlukemIt has rules for building profiled objects; profiled libraries are
6701.118Slukembuilt by default.
6711.118Slukem
6721.118SlukemLibraries are ranlib'd when made.
6731.118Slukem
6741.118Slukem
6751.118Slukem=-=-=-=-=   bsd.links.mk   =-=-=-=-=
6761.118Slukem
6771.118SlukemThe include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
6781.134Slukemand is included from from <bsd.lib.mk> and <bsd.prog.mk>.
6791.134Slukem
6801.134SlukemLINKS		The list of hard links, consisting of pairs of paths:
6811.134Slukem			source-file target-file
6821.134Slukem		${DESTDIR} is prepended to both paths before linking.
6831.134Slukem		For example, to link /bin/test and /bin/[, use:
6841.134Slukem			LINKS=/bin/test /bin/[
6851.134Slukem
6861.134SlukemSYMLINKS	The list of symbolic links, consisting of pairs of paths:
6871.134Slukem			source-file target-file
6881.134Slukem		${DESTDIR} is only prepended to target-file before linking.
6891.134Slukem		For example, to symlink /usr/bin/tar to /bin/tar resulting
6901.134Slukem		in ${DESTDIR}/usr/bin/tar -> /bin/tar:
6911.134Slukem			SYMLINKS=/bin/tar /usr/bin/tar
6921.118Slukem
6931.118Slukem
6941.118Slukem=-=-=-=-=   bsd.man.mk   =-=-=-=-=
6951.118Slukem
6961.118SlukemThe include file <bsd.man.mk> handles installing manual pages and their
6971.118Slukemlinks.
6981.118Slukem
6991.118SlukemIt has a two targets:
7001.118Slukem
7011.118Slukem	maninstall:
7021.118Slukem		Install the manual page sources and their links.
7031.118Slukem	catinstall:
7041.118Slukem		Install the preformatted manual pages and their links.
7051.118Slukem
7061.118SlukemIt sets/uses the following variables:
7071.118Slukem
7081.118SlukemMANDIR		Base path for manual installation.
7091.118Slukem
7101.118SlukemMANGRP		Manual group.
7111.118Slukem
7121.118SlukemMANOWN		Manual owner.
7131.118Slukem
7141.118SlukemMANMODE		Manual mode.
7151.118Slukem
7161.118SlukemMANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
7171.118Slukem		or "/tahoe" for machine specific manual pages.
7181.118Slukem
7191.118SlukemMAN		The manual pages to be installed (use a .1 - .9 suffix).
7201.118Slukem
7211.118SlukemMLINKS		List of manual page links (using a .1 - .9 suffix).  The
7221.118Slukem		linked-to file must come first, the linked file second,
7231.118Slukem		and there may be multiple pairs.  The files are soft-linked.
7241.118Slukem
7251.118SlukemThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if
7261.118Slukemit exists.
7271.118Slukem
7281.118Slukem
7291.118Slukem=-=-=-=-=   bsd.obj.mk   =-=-=-=-=
7301.118Slukem
7311.118SlukemThe include file <bsd.obj.mk> defines targets related to the creation
7321.118Slukemand use of separated object and source directories.
7331.118Slukem
7341.118SlukemIf an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
7351.118Slukem${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
7361.118Slukemit exists.  Otherwise make(1) looks for the existence of a
7371.118Slukemsubdirectory (or a symlink to a directory) of the source directory
7381.118Slukeminto which built targets should be placed.  If an environment variable
7391.118Slukemnamed MAKEOBJDIR is set, make(1) uses its value as the name of the
7401.118Slukemobject directory; failing that, make first looks for a subdirectory
7411.118Slukemnamed "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
7421.118Slukem
7431.118SlukemObject directories are not created automatically by make(1) if they
7441.118Slukemdon't exist; you need to run a separate "make obj".  (This will happen
7451.118Slukemduring a top-level build if "MKOBJDIRS" is set to a value other than
7461.118Slukem"no").  When the source directory is a subdirectory of ${BSDSRCDIR} --
7471.118Slukemand this is determined by a simple string prefix comparison -- object
7481.118Slukemdirectories are created in a separate object directory tree, and a
7491.118Slukemsymlink to the object directory in that tree is created in the source
7501.118Slukemdirectory; otherwise, "make obj" assumes that you're not in the main
7511.118Slukemsource tree and that it's not safe to use a separate object tree.
7521.118Slukem
7531.118SlukemSeveral variables used by <bsd.obj.mk> control exactly what
7541.118Slukemdirectories and links get created during a "make obj":
7551.118Slukem
7561.118SlukemMAKEOBJDIR	If set, this is the component name of the object
7571.118Slukem		directory.
7581.118Slukem
7591.118SlukemOBJMACHINE	If this is set but MAKEOBJDIR is not set, creates
7601.118Slukem		object directories or links named "obj.${MACHINE}";
7611.118Slukem		otherwise, just creates ones named "obj".
7621.118Slukem
7631.118SlukemUSR_OBJMACHINE  If set, and the current directory is a subdirectory of
7641.118Slukem		${BSDSRCDIR}, create object directory in the
7651.118Slukem		corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
7661.118Slukem		otherwise, create it in the corresponding subdirectory
7671.118Slukem		of ${BSDOBJDIR}
7681.113Sthorpej
7691.118SlukemBUILDID		If set, the contents of this variable are appended
7701.118Slukem		to the object directory name.  If OBJMACHINE is also
7711.118Slukem		set, ".${BUILDID}" is added after ".${MACHINE}".
7721.113Sthorpej
7731.106Sthorpej
7741.118Slukem=-=-=-=-=   bsd.prog.mk   =-=-=-=-=
7751.106Sthorpej
7761.1ScgdThe include file <bsd.prog.mk> handles building programs from one or
7771.1Scgdmore source files, along with their manual pages.  It has a limited number
7781.134Slukemof suffixes, consistent with the current needs of the BSD tree. 
7791.134Slukem<bsd.prog.mk> includes <bsd.shlib.mk> to get shared library parameters.
7801.1Scgd
7811.16SjtcIt has eight targets:
7821.1Scgd
7831.1Scgd	all:
7841.102Sthorpej		build the program and its manual page.  This also
7851.102Sthorpej		creates a GDB initialization file (.gdbinit) in
7861.102Sthorpej		the objdir.  The .gdbinit file sets the shared library
7871.102Sthorpej		prefix to ${DESTDIR} to facilitate cross-debugging.
7881.1Scgd	clean:
7891.1Scgd		remove the program, any object files and the files a.out,
7901.24Smikel		Errs, errs, mklog, and ${PROG}.core.
7911.1Scgd	cleandir:
7921.1Scgd		remove all of the files removed by the target clean, as
7931.1Scgd		well as .depend, tags, and any manual pages.
7941.42Slukem		`distclean' is a synonym for `cleandir'.
7951.1Scgd	depend:
7961.1Scgd		make the dependencies for the source files, and store
7971.1Scgd		them in the file .depend.
7981.16Sjtc	includes:
7991.16Sjtc		install any header files.
8001.1Scgd	install:
8011.1Scgd		install the program and its manual pages; if the Makefile
8021.1Scgd		does not itself define the target install, the targets
8031.1Scgd		beforeinstall and afterinstall may also be used to cause
8041.1Scgd		actions immediately before and after the install target
8051.1Scgd		is executed.
8061.1Scgd	lint:
8071.1Scgd		run lint on the source files
8081.1Scgd	tags:
8091.1Scgd		create a tags file for the source files.
8101.1Scgd
8111.1ScgdIt sets/uses the following variables:
8121.1Scgd
8131.1ScgdBINGRP		Binary group.
8141.1Scgd
8151.1ScgdBINOWN		Binary owner.
8161.1Scgd
8171.1ScgdBINMODE		Binary mode.
8181.1Scgd
8191.1ScgdCLEANFILES	Additional files to remove for the clean and cleandir targets.
8201.1Scgd
8211.1ScgdCOPTS		Additional flags to the compiler when creating C objects.
8221.112Sthorpej
8231.125SlukemCOPTS.<fn>	Additional flags to the compiler when creating the
8241.125Slukem		C objects for <fn>.
8251.125Slukem		For <fn>.[ly], "<fn>.c" must be used.
8261.125Slukem
8271.112SthorpejCPUFLAGS	Additional flags to the compiler/assembler to select
8281.112Sthorpej		CPU instruction set options, CPU tuning options, etc.
8291.35Slukem
8301.125SlukemCPUFLAGS.<fn>	Additional flags to the compiler/assembler for <fn>.
8311.125Slukem		For <fn>.[ly], "<fn>.c" must be used.
8321.125Slukem
8331.124SlukemCPPFLAGS	Additional flags to the C pre-processor.
8341.125Slukem
8351.125SlukemCPPFLAGS.<fn>	Additional flags to the C pre-processor for <fn>.
8361.125Slukem		For <fn>.[ly], "<fn>.c" must be used.
8371.102Sthorpej
8381.102SthorpejGDBINIT		List of GDB initialization files to add to "source"
8391.102Sthorpej		directives in the .gdbinit file that is created in the
8401.102Sthorpej		objdir.
8411.1Scgd
8421.1ScgdLDADD		Additional loader objects.  Usually used for libraries.
8431.1Scgd		For example, to load with the compatibility and utility
8441.1Scgd		libraries, use:
8451.1Scgd
8461.5Sjtc			LDADD+=-lutil -lcompat
8471.1Scgd
8481.1ScgdLDFLAGS		Additional loader flags.
8491.1Scgd
8501.134SlukemLINKS		See <bsd.links.mk>
8511.134Slukem
8521.134SlukemSYMLINKS	See <bsd.links.mk>
8531.1Scgd
8541.15ScgdMAN		Manual pages (should end in .1 - .9).  If no MAN variable is
8551.8Scgd		defined, "MAN=${PROG}.1" is assumed.
8561.1Scgd
8571.1ScgdPROG		The name of the program to build.  If not supplied, nothing
8581.1Scgd		is built.
8591.1Scgd
8601.88SthorpejPROG_CXX	If defined, the name of the program to build.  Also
8611.88Sthorpej		causes <bsd.prog.mk> to link the program with the C++
8621.88Sthorpej		compiler rather than the C compiler.  PROG_CXX overrides
8631.88Sthorpej		the value of PROG if PROG is also set.
8641.87Sthorpej
8651.21SchristosPROGNAME	The name that the above program will be installed as, if
8661.21Schristos		different from ${PROG}.
8671.21Schristos
8681.37StvSRCS		List of source files to build the program.  If SRCS is not
8691.1Scgd		defined, it's assumed to be ${PROG}.c.
8701.108Sjwise
8711.108SjwiseDPSRCS		List of source files which are needed for generating
8721.108Sjwise		dependencies, but are not needed in ${SRCS}.
8731.1Scgd
8741.1ScgdDPADD		Additional dependencies for the program.  Usually used for
8751.1Scgd		libraries.  For example, to depend on the compatibility and
8761.1Scgd		utility libraries use:
8771.1Scgd
8781.5Sjtc			DPADD+=${LIBCOMPAT} ${LIBUTIL}
8791.1Scgd
8801.1Scgd		The following libraries are predefined for DPADD:
8811.1Scgd
8821.21Schristos		LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o
8831.99Sitojun		LIBBZ2?=	${DESTDIR}/usr/lib/libbz2.a
8841.21Schristos		LIBC?=		${DESTDIR}/usr/lib/libc.a
8851.21Schristos		LIBC_PIC?=	${DESTDIR}/usr/lib/libc_pic.a
8861.99Sitojun		LIBCDK?=	${DESTDIR}/usr/lib/libcdk.a
8871.99Sitojun		LIBCOM_ERR?=	${DESTDIR}/usr/lib/libcom_err.a
8881.21Schristos		LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a
8891.21Schristos		LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a
8901.99Sitojun		LIBCRYPTO?=	${DESTDIR}/usr/lib/libcrypto.a
8911.99Sitojun		LIBCRYPTO_IDEA?=${DESTDIR}/usr/lib/libcrypto_idea.a
8921.105Sitojun		LIBCRYPTO_MDC2?=${DESTDIR}/usr/lib/libcrypto_mdc2.a
8931.99Sitojun		LIBCRYPTO_RC5?=	${DESTDIR}/usr/lib/libcrypto_rc5.a
8941.21Schristos		LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a
8951.21Schristos		LIBDBM?=	${DESTDIR}/usr/lib/libdbm.a
8961.21Schristos		LIBDES?=	${DESTDIR}/usr/lib/libdes.a
8971.21Schristos		LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
8981.114Sprovos		LIBEVENT?=	${DESTDIR}/usr/lib/libevent.a
8991.73Sblymn		LIBFORM?=	${DESTDIR}/usr/lib/libform.a
9001.21Schristos		LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
9011.21Schristos		LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
9021.99Sitojun		LIBGSSAPI?=	${DESTDIR}/usr/lib/libgssapi.a
9031.99Sitojun		LIBHDB?=	${DESTDIR}/usr/lib/libhdb.a
9041.70Sitojun		LIBINTL?=	${DESTDIR}/usr/lib/libintl.a
9051.49Sitojun		LIBIPSEC?=	${DESTDIR}/usr/lib/libipsec.a
9061.99Sitojun		LIBKADM?=	${DESTDIR}/usr/lib/libkadm.a
9071.99Sitojun		LIBKADM5CLNT?=	${DESTDIR}/usr/lib/libkadm5clnt.a
9081.99Sitojun		LIBKADM5SRV?=	${DESTDIR}/usr/lib/libkadm5srv.a
9091.99Sitojun		LIBKAFS?=	${DESTDIR}/usr/lib/libkafs.a
9101.21Schristos		LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
9111.21Schristos		LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
9121.99Sitojun		LIBKRB5?=	${DESTDIR}/usr/lib/libkrb5.a
9131.99Sitojun		LIBKSTREAM?=	${DESTDIR}/usr/lib/libkstream.a
9141.21Schristos		LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a
9151.21Schristos		LIBL?=		${DESTDIR}/usr/lib/libl.a
9161.21Schristos		LIBM?=		${DESTDIR}/usr/lib/libm.a
9171.53Sblymn		LIBMENU?=	${DESTDIR}/usr/lib/libmenu.a
9181.99Sitojun		LIBOBJC?=	${DESTDIR}/usr/lib/libobjc.a
9191.99Sitojun		LIBOSSAUDIO?=	${DESTDIR}/usr/lib/libossaudio.a
9201.21Schristos		LIBPCAP?=	${DESTDIR}/usr/lib/libpcap.a
9211.99Sitojun		LIBPCI?=	${DESTDIR}/usr/lib/libpci.a
9221.100Sthorpej		LIBPMC?=	${DESTDIR}/usr/lib/libpmc.a
9231.26Skleink		LIBPOSIX?=	${DESTDIR}/usr/lib/libposix.a
9241.110Sthorpej		LIBPTHREAD?=	${DESTDIR}/usr/lib/libpthread.a
9251.110Sthorpej		LIBPTHREAD_DBG?=${DESTDIR}/usr/lib/libpthread_dbg.a
9261.21Schristos		LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a
9271.99Sitojun		LIBRMT?=	${DESTDIR}/usr/lib/librmt.a
9281.99Sitojun		LIBROKEN?=	${DESTDIR}/usr/lib/libroken.a
9291.21Schristos		LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a
9301.110Sthorpej		LIBRT?=		${DESTDIR}/usr/lib/librt.a
9311.21Schristos		LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a
9321.140Slukem		LIBSL?=		${DESTDIR}/usr/lib/libsl.a
9331.99Sitojun		LIBSS?=		${DESTDIR}/usr/lib/libss.a
9341.99Sitojun		LIBSSL?=	${DESTDIR}/usr/lib/libssl.a
9351.140Slukem		LIBSTDCXX?=	${DESTDIR}/usr/lib/libstdc++.a
9361.21Schristos		LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a
9371.99Sitojun		LIBUSBHID?=	${DESTDIR}/usr/lib/libusbhid.a
9381.21Schristos		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
9391.21Schristos		LIBWRAP?=	${DESTDIR}/usr/lib/libwrap.a
9401.21Schristos		LIBY?=		${DESTDIR}/usr/lib/liby.a
9411.21Schristos		LIBZ?=		${DESTDIR}/usr/lib/libz.a
9421.1Scgd
9431.1ScgdSHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
9441.12Schristos		strings, using xstr(1). Note that this will not work with
9451.12Schristos		parallel makes.
9461.1Scgd
9471.59SjlamSTRIPFLAG	The flag passed to the install program to cause the binary
9481.1Scgd		to be stripped.
9491.1Scgd
9501.1ScgdSUBDIR		A list of subdirectories that should be built as well.
9511.1Scgd		Each of the targets will execute the same target in the
9521.1Scgd		subdirectories.
9531.1Scgd
9541.21SchristosSCRIPTS		A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
9551.21Schristos		These are installed exactly like programs.
9561.21Schristos
9571.21SchristosSCRIPTSNAME	The name that the above program will be installed as, if
9581.21Schristos		different from ${SCRIPTS}. These can be further specialized
9591.21Schristos		by setting SCRIPTSNAME_<script>.
9601.21Schristos
9611.124SlukemFILES		See description of <bsd.files.mk>.
9621.21Schristos
9631.106SthorpejSHLINKDIR	Target directory for shared linker.  See description of
9641.106Sthorpej		<bsd.own.mk> for additional information about this variable.
9651.130Slukem
9661.130SlukemUSE_LIBSTDCXX	If "no", the support libraries needed for C++ programs
9671.130Slukem		are set to `-lsupc++ -lm', rather than `-lstdc++ -lm'.
9681.130Slukem		Default: yes
9691.85Slukem
9701.1ScgdThe include file <bsd.prog.mk> includes the file named "../Makefile.inc"
9711.1Scgdif it exists, as well as the include file <bsd.man.mk>.
9721.1Scgd
9731.1ScgdSome simple examples:
9741.1Scgd
9751.1ScgdTo build foo from foo.c with a manual page foo.1, use:
9761.1Scgd
9771.1Scgd	PROG=	foo
9781.1Scgd
9791.1Scgd	.include <bsd.prog.mk>
9801.1Scgd
9811.1ScgdTo build foo from foo.c with a manual page foo.2, add the line:
9821.1Scgd
9831.9Scgd	MAN=	foo.2
9841.1Scgd
9851.1ScgdIf foo does not have a manual page at all, add the line:
9861.1Scgd
9871.75Sagc	MKMAN=	no
9881.1Scgd
9891.1ScgdIf foo has multiple source files, add the line:
9901.1Scgd
9911.1Scgd	SRCS=	a.c b.c c.c d.c
9921.1Scgd
9931.1Scgd
9941.118Slukem=-=-=-=-=   bsd.rpc.mk   =-=-=-=-=
9951.118Slukem
9961.118SlukemThe include file <bsd.rpc.mk> contains a makefile fragment used to
9971.118Slukemconstruct source files built by rpcgen.
9981.72Ssommerfe
9991.118SlukemThe following macros may be defined in makefiles which include
10001.118Slukem<bsd.rpc.mk> in order to control which files get built and how they
10011.118Slukemare to be built:
10021.21Schristos
10031.118SlukemRPC_INCS:	construct .h file from .x file
10041.120SlukemRPC_XDRFILES:	construct _xdr.c from .x file
10051.118Slukem		(for marshalling/unmarshalling data types)
10061.118SlukemRPC_SVCFILES:	construct _svc.c from .x file
10071.118Slukem		(server-side stubs)
10081.118SlukemRPC_SVCFLAGS:	Additional flags passed to builds of RPC_SVCFILES.
10091.21Schristos
10101.118SlukemRPC_XDIR:	Directory containing .x/.h files
10111.23Schristos
10121.23Schristos
10131.118Slukem=-=-=-=-=   bsd.shlib.mk   =-=-=-=-=
10141.21Schristos
10151.118SlukemThe include file <bsd.shlib.mk> computes parameters for shared library
10161.118Slukeminstallation and use.  It defines no targets.  <bsd.own.mk> MUST be
10171.134Slukemincluded before <bsd.shlib.mk>.
10181.21Schristos
10191.134Slukem<bsd.own.mk> sets the following variables, if they are not already defined
10201.118Slukem(defaults are in brackets):
10211.21Schristos
10221.142SlukemSHLIBINSTALLDIR	If ${USE_SHLIBDIR} is not "no", use ${SHLIBINSTALLDIR}
10231.142Slukem		instead of ${LIBDIR} as the base path for shared library
10241.142Slukem		installation.  [/lib]
10251.21Schristos
10261.118SlukemSHLIBDIR	The path to USE_SHLIBDIR shared libraries to use when building
10271.118Slukem		a program.  [/lib for programs in /bin and /sbin, /usr/lib
10281.118Slukem		for all others.]
10291.81Swiz
10301.142Slukem_LIBSODIR	Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is not "no",
10311.118Slukem		otherwise set to ${LIBDIR}
10321.81Swiz
10331.118SlukemSHLINKINSTALLDIR Base path for shared linker.  [/libexec]
10341.39Scgd
10351.118SlukemSHLINKDIR	Path to use for shared linker when building a program.
10361.118Slukem		[/libexec for programs in /bin and /sbin, /usr/libexec for
10371.118Slukem		all others.]
10381.39Scgd
10391.13Schristos
10401.118Slukem=-=-=-=-=   bsd.subdir.mk   =-=-=-=-=
10411.13Schristos
10421.118SlukemThe include file <bsd.subdir.mk> contains the default targets for building
10431.120Slukemsubdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
10441.118Slukemclean, cleandir, depend, includes, install, lint, and tags.  For all of
10451.142Slukemthe directories listed in ${SUBDIR}, the specified directory will be
10461.142Slukemvisited and the target made.  There is also a default target which allows
10471.142Slukemthe command "make subdir" where subdir is any directory listed in ${SUBDIR}.
10481.47Stv
10491.118SlukemAs a special case, the use of a token .WAIT as an entry in SUBDIR acts
10501.118Slukemas a synchronization barrier when multiple make jobs are run; subdirs
10511.118Slukembefore the .WAIT must complete before any subdirs after .WAIT are
10521.118Slukemstarted.  See make(1) for some caveats on use of .WAIT and other
10531.118Slukemspecial sources.
10541.47Stv
10551.47Stv
10561.118Slukem=-=-=-=-=   bsd.sys.mk   =-=-=-=-=
10571.47Stv
10581.13SchristosThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and
10591.14Scgd<bsd.lib.mk>.  It contains overrides that are used when building
10601.133Slukemthe NetBSD source tree.
10611.133Slukem
10621.133SlukemThe following variables control how various files are compiled/built.
10631.142Slukem(Note that these may be overridden in <bsd.own.mk> if USETOOLS == "yes"):
10641.133Slukem
10651.133SlukemAR		Create, modify, and extract from archives.  [ar]
10661.133Slukem
10671.133SlukemARFLAGS		Options to ${AR}.  [rl]
10681.133Slukem
10691.133SlukemCC		C compiler.  [cc]
10701.133Slukem
10711.133SlukemCFLAGS		Options to ${CC}.  [Usually -O or -O2]
10721.133Slukem
10731.133SlukemCPP		C Pre-Processor.  [cpp]
10741.133Slukem
10751.133SlukemCPPFLAGS	Options to ${CPP}.  []
10761.133Slukem
10771.133SlukemCPUFLAGS	Optimization flags for ${CC}
10781.133Slukem
10791.133SlukemCXX		C++ compiler.  [c++]
10801.133Slukem
10811.133SlukemCXXFLAGS	Options to ${CXX}.  [${CFLAGS}]
10821.133Slukem
10831.133SlukemELF2ECOFF	Convert ELF-format executable to ECOFF.  [elf2ecoff]
10841.133Slukem
10851.133SlukemFC		Fortran compiler.  [f77]
10861.133Slukem
10871.133SlukemFFLAGS		Options to {$FC}.  [-O]
10881.133Slukem
10891.133SlukemINSTALL		install(1) command.  [install]
10901.133Slukem
10911.133SlukemLEX		Lexical analyzer.  [lex]
10921.133Slukem
10931.133SlukemLFLAGS		Options to ${LEX}.  []
10941.133Slukem
10951.133SlukemLD		Linker.  [ld]
10961.133Slukem
10971.133SlukemLDFLAGS		Options to ${LD}.  []
10981.133Slukem
10991.133SlukemLINT		C program verifier.  [lint]
11001.133Slukem
11011.133SlukemLINTFLAGS	Options to ${LINT}.  [-chapbxzF]
11021.133Slukem
11031.133SlukemLORDER		List dependencies for object files.  [lorder]
11041.133Slukem
11051.133SlukemMAKE		make(1).  [make]
11061.133Slukem
11071.133SlukemMKDEP		Construct Makefile dependency list.  [mkdep]
11081.133Slukem
11091.133SlukemNM		List symbols from object files.  [nm]
11101.133Slukem
11111.133SlukemPC		Pascal compiler.  [pc]  (Not present)
11121.133Slukem
11131.133SlukemPFLAGS		Options to ${PC}.  []
11141.133Slukem
11151.133SlukemOBJC		Objective C compiler.  [${CC}]
11161.133Slukem
11171.133SlukemOBJCFLAGS	Options to ${OBJC}.  [${CFLAGS}]
11181.133Slukem
11191.133SlukemOBJCOPY		Copy and translate object files.  [objcopy]
11201.133Slukem
11211.133SlukemRANLIB		Generate index to archive.  [ranlib]
11221.133Slukem
11231.133SlukemSHELL		Shell.  [sh]
11241.133Slukem
11251.133SlukemSIZE		List section sizes and total size.  [size]
11261.133Slukem
11271.133SlukemSTRIP		Discard symbols from object files.  [strip]
11281.133Slukem
11291.133SlukemTSORT		Topological sort of a directed graph.  [tsort -q]
11301.133Slukem
11311.133SlukemYACC		LALR(1) parser generator.  [yacc]
11321.133Slukem
11331.133SlukemYFLAGS		Options to ${YACC}.  []
11341.133Slukem
11351.133SlukemYHEADER		If defined, add "-d" to YFLAGS, and add dependencies
11361.133Slukem		from <file>.y to <file>.h and <file>.c, and add
11371.133Slukem		<foo>.h to CLEANFILES.
11381.133Slukem
11391.133SlukemYPREFIX		If defined, add "-p ${YPREFIX}" to YFLAGS.
11401.133Slukem
11411.116Slukem
11421.116SlukemThe following variables are defined to commands to perform the
11431.116Slukemappropriate operation, with the default in [brackets].
11441.142Slukem(Note that these are overridden in <bsd.own.mk> if USETOOLS == "yes"):
11451.116Slukem
11461.116SlukemTOOL_ASN1_COMPILE	ASN1 compiler.  [asn1_compile]
11471.116Slukem
11481.116SlukemTOOL_CAP_MKDB		Create capability database.  [cap_mkdb]
11491.116Slukem
11501.116SlukemTOOL_CAT		Concatenate and print files.  [cat]
11511.116Slukem
11521.116SlukemTOOL_CKSUM		Display file checksums.  [cksum]
11531.116Slukem
11541.116SlukemTOOL_COMPILE_ET		Error table compiler.  [compile_et]
11551.116Slukem
11561.116SlukemTOOL_CONFIG		Build kernel compilation directories.  [config]
11571.116Slukem
11581.116SlukemTOOL_CRUNCHGEN		Generate crunched binary build environment.  [crunchgen]
11591.116Slukem
11601.116SlukemTOOL_CTAGS		Create a tags file.  [ctags]
11611.116Slukem
11621.116SlukemTOOL_DB			Manipulate db(3) databases.  [db]
11631.116Slukem
11641.116SlukemTOOL_EQN		Format equations for groff.  [eqn]
11651.116Slukem
11661.116SlukemTOOL_FGEN		IEEE 1275 Open Firmware FCode Tokenizer.  [fgen]
11671.116Slukem
11681.116SlukemTOOL_GENCAT		Generate NLS message catalogs.  [gencat]
11691.116Slukem
11701.116SlukemTOOL_GROFF		Front end for groff document formatting system.  [groff]
11711.116Slukem
11721.116SlukemTOOL_HEXDUMP		Ascii, decimal, hexadecimal, octal dump.  [hexdump]
11731.116Slukem
11741.116SlukemTOOL_INDXBIB		Make bibliographic database's inverted index.  [indxbib]
11751.116Slukem
11761.116SlukemTOOL_INSTALLBOOT	Install disk bootstrap software.  [installboot]
11771.116Slukem
11781.116SlukemTOOL_INSTALL_INFO	Update info/dir entries.  [install-info]
11791.116Slukem
11801.116SlukemTOOL_M4			M4 macro language processor.  [m4]
11811.116Slukem
11821.116SlukemTOOL_MAKEFS		Create file system image from directory tree.  [makefs]
11831.116Slukem
11841.116SlukemTOOL_MAKEINFO		Translate Texinfo documents.  [makeinfo]
11851.116Slukem
11861.116SlukemTOOL_MAKEWHATIS		Create a whatis.db database.  [makewhatis]
11871.116Slukem
11881.116SlukemTOOL_MDSETIMAGE		Set kernel RAM disk image.  [mdsetimage]
11891.116Slukem
11901.116SlukemTOOL_MENUC		Menu compiler.  [menuc]
11911.116Slukem
11921.116SlukemTOOL_MKCSMAPPER		Make charset mapping table.  [mkcsmapper]
11931.116Slukem
11941.116SlukemTOOL_MKESDB		Make encoding scheme database.  [mkesdb]
11951.116Slukem
11961.116SlukemTOOL_MKLOCALE		Make LC_CTYPE locale files.  [mklocale]
11971.116Slukem
11981.116SlukemTOOL_MKMAGIC		Create database for file(1).  [file]
11991.116Slukem
12001.116SlukemTOOL_MKTEMP		Make (unique) temporary file name.  [mktemp]
12011.116Slukem
12021.116SlukemTOOL_MSGC		Simple message list compiler.  [msgc]
12031.116Slukem
12041.116SlukemTOOL_MTREE		Map a directory hierarchy.  [mtree]
12051.116Slukem
12061.116SlukemTOOL_PAX		Manipulate file archives and copy directories.  [pax]
12071.116Slukem
12081.116SlukemTOOL_PIC		Compile pictures for groff.  [pic]
12091.116Slukem
12101.116SlukemTOOL_PREPMKBOOTIMAGE	prep-mkbootimage (XXXBUILDSH).  [prep-mkbootimage]
12111.116Slukem
12121.116SlukemTOOL_PWD_MKDB		Generate the password databases.  [pwd_mkdb]
12131.116Slukem
12141.116SlukemTOOL_REFER		Preprocess bibliographic references for groff.  [refer]
12151.116Slukem
12161.116SlukemTOOL_ROFF_ASCII		Generate ASCII groff output.  [nroff]
12171.116Slukem
12181.116SlukemTOOL_ROFF_DVI		Generate DVI groff output.  [${TOOL_GROFF} -Tdvi]
12191.116Slukem
12201.116SlukemTOOL_ROFF_HTML		Generate HTML groff output.
12211.119Slukem			[${TOOL_GROFF} -Tlatin1 -mdoc2html]
12221.116Slukem
12231.116SlukemTOOL_ROFF_PS		Generate PS groff output.  [${TOOL_GROFF} -Tps]
12241.116Slukem
12251.116SlukemTOOL_ROFF_RAW		Generate "raw" groff output.  [${TOOL_GROFF} -Z]
12261.116Slukem
12271.116SlukemTOOL_RPCGEN		Remote Procedure Call (RPC) protocol compiler.  [rpcgen]
12281.116Slukem
12291.116SlukemTOOL_SOELIM		Eliminate .so's from groff input.  [soelim]
12301.123Slukem
12311.123SlukemTOOL_STAT		Display file status.  [stat]
12321.116Slukem
12331.116SlukemTOOL_SUNLABEL		Read or modify a SunOS disk label.  [sunlabel]
12341.116Slukem
12351.116SlukemTOOL_TBL		Format tables for groff.  [tbl]
12361.116Slukem
12371.116SlukemTOOL_UUDECODE		Uudecode a binary file.  [uudecode]
12381.116Slukem
12391.116SlukemTOOL_VGRIND		Grind nice listings of programs.  [vgrind -f]
12401.116Slukem
12411.116SlukemTOOL_ZIC		Time zone compiler.  [zic]
12421.116Slukem
12431.69Ssommerfe
12441.69SsommerfeOther variables of note (incomplete list):
12451.69Ssommerfe
12461.82SlukemWARNS		Crank up gcc warning options; the distinct levels are:
12471.82Slukem			WARNS=1
12481.82Slukem			WARNS=2
12491.82Slukem			WARNS=3
12501.69Ssommerfe
12511.69SsommerfeFORMAT_AUDIT	If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
12521.69SsommerfeWFORMAT 	-Wnetbsd-format-audit for extra-stringent format checking.
12531.75Sagc		WFORMAT belongs in individual makefiles and/or
12541.75Sagc		Makefile.inc files.  (set WFORMAT=1 in individual
12551.75Sagc		makefiles if a program is not security critical and is
12561.75Sagc		doing bizarre things with format strings which would
12571.75Sagc		be even uglier if rewritten) FORMAT_AUDIT should go in
12581.120Slukem		mk.conf if you're doing format-string auditing.
12591.69Ssommerfe		FORMAT_AUDIT may go away in time.
12601.30Sagc
12611.30Sagc=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1262