xref: /freebsd/contrib/bmake/mk/README (revision 2c3632d14fe37fa35c262ee9fb66835be0a52621)
1*2c3632d1SSimon J. Gerraty#	$Id: README,v 1.2 2020/08/19 17:51:53 sjg Exp $
23cbdda60SSimon J. Gerraty
33cbdda60SSimon J. GerratyThis directory contains some macro's derrived from the NetBSD bsd.*.mk
43cbdda60SSimon J. Gerratymacros.  They have the same names but without the bsd., separate macro
53cbdda60SSimon J. Gerratyfiles are needed to ensure we can make them do what we want for
63cbdda60SSimon J. Gerratybuiling things outside of /usr/src.  Nearly all the comments below
73cbdda60SSimon J. Gerratyapply.
83cbdda60SSimon J. Gerraty
93cbdda60SSimon J. Gerraty#	$NetBSD: bsd.README,v 1.18 1997/01/13 00:54:23 mark Exp $
103cbdda60SSimon J. Gerraty#	@(#)bsd.README	5.1 (Berkeley) 5/11/90
113cbdda60SSimon J. Gerraty
123cbdda60SSimon J. GerratyThis is the README file for the new make "include" files for the BSD
133cbdda60SSimon J. Gerratysource tree.  The files are installed in /usr/share/mk, and are, by
143cbdda60SSimon J. Gerratyconvention, named with the suffix ".mk".
153cbdda60SSimon J. Gerraty
163cbdda60SSimon J. GerratyNote, this file is not intended to replace reading through the .mk
173cbdda60SSimon J. Gerratyfiles for anything tricky.
183cbdda60SSimon J. Gerraty
193cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
203cbdda60SSimon J. Gerraty
213cbdda60SSimon J. GerratyRANDOM THINGS WORTH KNOWING:
223cbdda60SSimon J. Gerraty
233cbdda60SSimon J. GerratyThe files are simply C-style #include files, and pretty much behave like
243cbdda60SSimon J. Gerratyyou'd expect.  The syntax is slightly different in that a single '.' is
253cbdda60SSimon J. Gerratyused instead of the hash mark, i.e. ".include <bsd.prog.mk>".
263cbdda60SSimon J. Gerraty
273cbdda60SSimon J. GerratyOne difference that will save you lots of debugging time is that inclusion
283cbdda60SSimon J. Gerratyof the file is normally done at the *end* of the Makefile.  The reason for
293cbdda60SSimon J. Gerratythis is because .mk files often modify variables and behavior based on the
303cbdda60SSimon J. Gerratyvalues of variables set in the Makefile.  To make this work, remember that
313cbdda60SSimon J. Gerratythe FIRST target found is the target that is used, i.e. if the Makefile has:
323cbdda60SSimon J. Gerraty
333cbdda60SSimon J. Gerraty	a:
343cbdda60SSimon J. Gerraty		echo a
353cbdda60SSimon J. Gerraty	a:
363cbdda60SSimon J. Gerraty		echo a number two
373cbdda60SSimon J. Gerraty
383cbdda60SSimon J. Gerratythe command "make a" will echo "a".  To make things confusing, the SECOND
393cbdda60SSimon J. Gerratyvariable assignment is the overriding one, i.e. if the Makefile has:
403cbdda60SSimon J. Gerraty
413cbdda60SSimon J. Gerraty	a=	foo
423cbdda60SSimon J. Gerraty	a=	bar
433cbdda60SSimon J. Gerraty
443cbdda60SSimon J. Gerraty	b:
453cbdda60SSimon J. Gerraty		echo ${a}
463cbdda60SSimon J. Gerraty
473cbdda60SSimon J. Gerratythe command "make b" will echo "bar".  This is for compatibility with the
483cbdda60SSimon J. Gerratyway the V7 make behaved.
493cbdda60SSimon J. Gerraty
503cbdda60SSimon J. GerratyIt's fairly difficult to make the BSD .mk files work when you're building
513cbdda60SSimon J. Gerratymultiple programs in a single directory.  It's a lot easier split up the
523cbdda60SSimon J. Gerratyprograms than to deal with the problem.  Most of the agony comes from making
533cbdda60SSimon J. Gerratythe "obj" directory stuff work right, not because we switch to a new version
543cbdda60SSimon J. Gerratyof make.  So, don't get mad at us, figure out a better way to handle multiple
553cbdda60SSimon J. Gerratyarchitectures so we can quit using the symbolic link stuff.  (Imake doesn't
563cbdda60SSimon J. Gerratycount.)
573cbdda60SSimon J. Gerraty
583cbdda60SSimon J. GerratyThe file .depend in the source directory is expected to contain dependencies
593cbdda60SSimon J. Gerratyfor the source files.  This file is read automatically by make after reading
603cbdda60SSimon J. Gerratythe Makefile.
613cbdda60SSimon J. Gerraty
623cbdda60SSimon J. GerratyThe variable DESTDIR works as before.  It's not set anywhere but will change
633cbdda60SSimon J. Gerratythe tree where the file gets installed.
643cbdda60SSimon J. Gerraty
653cbdda60SSimon J. GerratyThe profiled libraries are no longer built in a different directory than
663cbdda60SSimon J. Gerratythe regular libraries.  A new suffix, ".po", is used to denote a profiled
673cbdda60SSimon J. Gerratyobject.
683cbdda60SSimon J. Gerraty
693cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
703cbdda60SSimon J. Gerraty
713cbdda60SSimon J. GerratyThe include file <sys.mk> has the default rules for all makes, in the BSD
723cbdda60SSimon J. Gerratyenvironment or otherwise.  You probably don't want to touch this file.
733cbdda60SSimon J. Gerraty
743cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
753cbdda60SSimon J. Gerraty
763cbdda60SSimon J. GerratyThe include file <bsd.man.mk> handles installing manual pages and their
773cbdda60SSimon J. Gerratylinks.
783cbdda60SSimon J. Gerraty
793cbdda60SSimon J. GerratyIt has a single target:
803cbdda60SSimon J. Gerraty
813cbdda60SSimon J. Gerraty	maninstall:
823cbdda60SSimon J. Gerraty		Install the manual pages and their links.
833cbdda60SSimon J. Gerraty
843cbdda60SSimon J. GerratyIt sets/uses the following variables:
853cbdda60SSimon J. Gerraty
863cbdda60SSimon J. GerratyMANDIR		Base path for manual installation.
873cbdda60SSimon J. Gerraty
883cbdda60SSimon J. GerratyMANGRP		Manual group.
893cbdda60SSimon J. Gerraty
903cbdda60SSimon J. GerratyMANOWN		Manual owner.
913cbdda60SSimon J. Gerraty
923cbdda60SSimon J. GerratyMANMODE		Manual mode.
933cbdda60SSimon J. Gerraty
943cbdda60SSimon J. GerratyMANSUBDIR	Subdirectory under the manual page section, i.e. "/vax"
953cbdda60SSimon J. Gerraty		or "/tahoe" for machine specific manual pages.
963cbdda60SSimon J. Gerraty
973cbdda60SSimon J. GerratyMAN		The manual pages to be installed (use a .1 - .9 suffix).
983cbdda60SSimon J. Gerraty
993cbdda60SSimon J. GerratyMLINKS		List of manual page links (using a .1 - .9 suffix).  The
1003cbdda60SSimon J. Gerraty		linked-to file must come first, the linked file second,
1013cbdda60SSimon J. Gerraty		and there may be multiple pairs.  The files are soft-linked.
1023cbdda60SSimon J. Gerraty
1033cbdda60SSimon J. GerratyThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if
1043cbdda60SSimon J. Gerratyit exists.
1053cbdda60SSimon J. Gerraty
1063cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1073cbdda60SSimon J. Gerraty
1083cbdda60SSimon J. GerratyThe include file <bsd.own.mk> contains source tree configuration parameters,
1093cbdda60SSimon J. Gerratysuch as the owners, groups, etc. for both manual pages and binaries, and
1103cbdda60SSimon J. Gerratya few global "feature configuration" parameters.
1113cbdda60SSimon J. Gerraty
1123cbdda60SSimon J. GerratyIt has no targets.
1133cbdda60SSimon J. Gerraty
1143cbdda60SSimon J. GerratyTo get system-specific configuration parameters, bsd.own.mk will try to
1153cbdda60SSimon J. Gerratyinclude the file specified by the "MAKECONF" variable.  If MAKECONF is not
1163cbdda60SSimon J. Gerratyset, or no such file exists, the system make configuration file, /etc/mk.conf
1173cbdda60SSimon J. Gerratyis included.  These files may define any of the variables described below.
1183cbdda60SSimon J. Gerraty
1193cbdda60SSimon J. Gerratybsd.own.mk sets the following variables, if they are not already defined
1203cbdda60SSimon J. Gerraty(defaults are in brackets):
1213cbdda60SSimon J. Gerraty
1223cbdda60SSimon J. GerratyBSDSRCDIR	The real path to the system sources, so that 'make obj'
1233cbdda60SSimon J. Gerraty		will work correctly. [/usr/src]
1243cbdda60SSimon J. Gerraty
1253cbdda60SSimon J. GerratyBSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj'
1263cbdda60SSimon J. Gerraty		will work correctly. [/usr/obj]
1273cbdda60SSimon J. Gerraty
1283cbdda60SSimon J. GerratyBINGRP		Binary group. [bin]
1293cbdda60SSimon J. Gerraty
1303cbdda60SSimon J. GerratyBINOWN		Binary owner. [bin]
1313cbdda60SSimon J. Gerraty
1323cbdda60SSimon J. GerratyBINMODE		Binary mode. [555]
1333cbdda60SSimon J. Gerraty
1343cbdda60SSimon J. GerratyNONBINMODE	Mode for non-executable files. [444]
1353cbdda60SSimon J. Gerraty
1363cbdda60SSimon J. GerratyMANDIR		Base path for manual installation. [/usr/share/man/cat]
1373cbdda60SSimon J. Gerraty
1383cbdda60SSimon J. GerratyMANGRP		Manual group. [bin]
1393cbdda60SSimon J. Gerraty
1403cbdda60SSimon J. GerratyMANOWN		Manual owner. [bin]
1413cbdda60SSimon J. Gerraty
1423cbdda60SSimon J. GerratyMANMODE		Manual mode. [${NONBINMODE}]
1433cbdda60SSimon J. Gerraty
1443cbdda60SSimon J. GerratyLIBDIR		Base path for library installation. [/usr/lib]
1453cbdda60SSimon J. Gerraty
1463cbdda60SSimon J. GerratyLINTLIBDIR	Base path for lint(1) library installation. [/usr/libdata/lint]
1473cbdda60SSimon J. Gerraty
1483cbdda60SSimon J. GerratyLIBGRP		Library group. [${BINGRP}]
1493cbdda60SSimon J. Gerraty
1503cbdda60SSimon J. GerratyLIBOWN		Library owner. [${BINOWN}]
1513cbdda60SSimon J. Gerraty
1523cbdda60SSimon J. GerratyLIBMODE		Library mode. [${NONBINMODE}]
1533cbdda60SSimon J. Gerraty
1543cbdda60SSimon J. GerratyDOCDIR		Base path for system documentation (e.g. PSD, USD, etc.)
1553cbdda60SSimon J. Gerraty	        installation. [/usr/share/doc]
1563cbdda60SSimon J. Gerraty
1573cbdda60SSimon J. GerratyDOCGRP		Documentation group. [bin]
1583cbdda60SSimon J. Gerraty
1593cbdda60SSimon J. GerratyDOCOWN		Documentation owner. [bin]
1603cbdda60SSimon J. Gerraty
1613cbdda60SSimon J. GerratyDOCMODE		Documentation mode. [${NONBINMODE}]
1623cbdda60SSimon J. Gerraty
1633cbdda60SSimon J. GerratyNLSDIR		Base path for National Language Support files installation.
1643cbdda60SSimon J. Gerraty		[/usr/share/nls]
1653cbdda60SSimon J. Gerraty
1663cbdda60SSimon J. GerratyNLSGRP		National Language Support files group. [bin]
1673cbdda60SSimon J. Gerraty
1683cbdda60SSimon J. GerratyNLSOWN		National Language Support files owner. [bin]
1693cbdda60SSimon J. Gerraty
1703cbdda60SSimon J. GerratyNLSMODE		National Language Support files mode. [${NONBINMODE}]
1713cbdda60SSimon J. Gerraty
1723cbdda60SSimon J. GerratySTRIP		The flag passed to the install program to cause the binary
1733cbdda60SSimon J. Gerraty		to be stripped.  This is to be used when building your
1743cbdda60SSimon J. Gerraty		own install script so that the entire system can be made
1753cbdda60SSimon J. Gerraty		stripped/not-stripped using a single knob. [-s]
1763cbdda60SSimon J. Gerraty
1773cbdda60SSimon J. GerratyCOPY		The flag passed to the install program to cause the binary
1783cbdda60SSimon J. Gerraty		to be copied rather than moved.  This is to be used when
1793cbdda60SSimon J. Gerraty		building our own install script so that the entire system
1803cbdda60SSimon J. Gerraty		can either be installed with copies, or with moves using
1813cbdda60SSimon J. Gerraty		a single knob. [-c]
1823cbdda60SSimon J. Gerraty
1833cbdda60SSimon J. GerratyAdditionally, the following variables may be set by bsd.own.mk or in a
1843cbdda60SSimon J. Gerratymake configuration file to modify the behaviour of the system build
1853cbdda60SSimon J. Gerratyprocess (default values are in brackets along with comments, if set by
1863cbdda60SSimon J. Gerratybsd.own.mk):
1873cbdda60SSimon J. Gerraty
1883cbdda60SSimon J. GerratyEXPORTABLE_SYSTEM
1893cbdda60SSimon J. Gerraty		Do not build /usr/src/domestic, even if it is present.
1903cbdda60SSimon J. Gerraty
1913cbdda60SSimon J. GerratySKEY		Compile in support for S/key authentication. [yes, set
1923cbdda60SSimon J. Gerraty		unconditionally]
1933cbdda60SSimon J. Gerraty
1943cbdda60SSimon J. GerratyKERBEROS	Compile in support for Kerberos 4 authentication.
1953cbdda60SSimon J. Gerraty
1963cbdda60SSimon J. GerratyKERBEROS5	Compile in support for Kerberos 5 authentication.
1973cbdda60SSimon J. Gerraty
1983cbdda60SSimon J. GerratyMANZ		Compress manual pages at installation time.
1993cbdda60SSimon J. Gerraty
2003cbdda60SSimon J. GerratySYS_INCLUDE	Copy or symlink kernel include files into /usr/include.
2013cbdda60SSimon J. Gerraty		Possible values are "symlinks" or "copies" (which is
2023cbdda60SSimon J. Gerraty		the same as the variable being unset).
2033cbdda60SSimon J. Gerraty
2043cbdda60SSimon J. GerratyNOPROFILE	Do not build profiled versions of system libraries
2053cbdda60SSimon J. Gerraty
2063cbdda60SSimon J. GerratyNOPIC		Do not build PIC versions of system libraries, and
2073cbdda60SSimon J. Gerraty		do not build shared libraries.  [set if ${MACHINE_ARCH}
2083cbdda60SSimon J. Gerraty		is "mips", "vax", "alpha" or "arm32", unset otherwise.]
2093cbdda60SSimon J. Gerraty
2103cbdda60SSimon J. GerratyNOLINT		Do not build lint libraries. [set, set unconditionally]
2113cbdda60SSimon J. Gerraty
2123cbdda60SSimon J. Gerratybsd.own.mk is generally useful when building your own Makefiles so that
2133cbdda60SSimon J. Gerratythey use the same default owners etc. as the rest of the tree.
2143cbdda60SSimon J. Gerraty
2153cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2163cbdda60SSimon J. Gerraty
2173cbdda60SSimon J. GerratyThe include file <bsd.prog.mk> handles building programs from one or
2183cbdda60SSimon J. Gerratymore source files, along with their manual pages.  It has a limited number
2193cbdda60SSimon J. Gerratyof suffixes, consistent with the current needs of the BSD tree.
2203cbdda60SSimon J. Gerraty
2213cbdda60SSimon J. GerratyIt has eight targets:
2223cbdda60SSimon J. Gerraty
2233cbdda60SSimon J. Gerraty	all:
2243cbdda60SSimon J. Gerraty		build the program and its manual page
2253cbdda60SSimon J. Gerraty	clean:
2263cbdda60SSimon J. Gerraty		remove the program, any object files and the files a.out,
2273cbdda60SSimon J. Gerraty		Errs, errs, mklog, and core.
2283cbdda60SSimon J. Gerraty	cleandir:
2293cbdda60SSimon J. Gerraty		remove all of the files removed by the target clean, as
2303cbdda60SSimon J. Gerraty		well as .depend, tags, and any manual pages.
2313cbdda60SSimon J. Gerraty	depend:
2323cbdda60SSimon J. Gerraty		make the dependencies for the source files, and store
2333cbdda60SSimon J. Gerraty		them in the file .depend.
2343cbdda60SSimon J. Gerraty	includes:
2353cbdda60SSimon J. Gerraty		install any header files.
2363cbdda60SSimon J. Gerraty	install:
2373cbdda60SSimon J. Gerraty		install the program and its manual pages; if the Makefile
2383cbdda60SSimon J. Gerraty		does not itself define the target install, the targets
2393cbdda60SSimon J. Gerraty		beforeinstall and afterinstall may also be used to cause
2403cbdda60SSimon J. Gerraty		actions immediately before and after the install target
2413cbdda60SSimon J. Gerraty		is executed.
2423cbdda60SSimon J. Gerraty	lint:
2433cbdda60SSimon J. Gerraty		run lint on the source files
2443cbdda60SSimon J. Gerraty	tags:
2453cbdda60SSimon J. Gerraty		create a tags file for the source files.
2463cbdda60SSimon J. Gerraty
2473cbdda60SSimon J. GerratyIt sets/uses the following variables:
2483cbdda60SSimon J. Gerraty
2493cbdda60SSimon J. GerratyBINGRP		Binary group.
2503cbdda60SSimon J. Gerraty
2513cbdda60SSimon J. GerratyBINOWN		Binary owner.
2523cbdda60SSimon J. Gerraty
2533cbdda60SSimon J. GerratyBINMODE		Binary mode.
2543cbdda60SSimon J. Gerraty
2553cbdda60SSimon J. GerratyCLEANFILES	Additional files to remove for the clean and cleandir targets.
2563cbdda60SSimon J. Gerraty
2573cbdda60SSimon J. GerratyCOPTS		Additional flags to the compiler when creating C objects.
2583cbdda60SSimon J. Gerraty
2593cbdda60SSimon J. GerratyHIDEGAME	If HIDEGAME is defined, the binary is installed in
2603cbdda60SSimon J. Gerraty		/usr/games/hide, and a symbolic link is created to
2613cbdda60SSimon J. Gerraty		/usr/games/dm.
2623cbdda60SSimon J. Gerraty
2633cbdda60SSimon J. GerratyLDADD		Additional loader objects.  Usually used for libraries.
2643cbdda60SSimon J. Gerraty		For example, to load with the compatibility and utility
2653cbdda60SSimon J. Gerraty		libraries, use:
2663cbdda60SSimon J. Gerraty
2673cbdda60SSimon J. Gerraty			LDADD+=-lutil -lcompat
2683cbdda60SSimon J. Gerraty
2693cbdda60SSimon J. GerratyLDFLAGS		Additional loader flags.
2703cbdda60SSimon J. Gerraty
2713cbdda60SSimon J. GerratyLINKS		The list of binary links; should be full pathnames, the
2723cbdda60SSimon J. Gerraty		linked-to file coming first, followed by the linked
2733cbdda60SSimon J. Gerraty		file.  The files are hard-linked.  For example, to link
2743cbdda60SSimon J. Gerraty		/bin/test and /bin/[, use:
2753cbdda60SSimon J. Gerraty
2763cbdda60SSimon J. Gerraty			LINKS=	${DESTDIR}/bin/test ${DESTDIR}/bin/[
2773cbdda60SSimon J. Gerraty
2783cbdda60SSimon J. GerratyMAN		Manual pages (should end in .1 - .9).  If no MAN variable is
2793cbdda60SSimon J. Gerraty		defined, "MAN=${PROG}.1" is assumed.
2803cbdda60SSimon J. Gerraty
2813cbdda60SSimon J. GerratyPROG		The name of the program to build.  If not supplied, nothing
2823cbdda60SSimon J. Gerraty		is built.
2833cbdda60SSimon J. Gerraty
2843cbdda60SSimon J. GerratySRCS		List of source files to build the program.  If PROG is not
2853cbdda60SSimon J. Gerraty		defined, it's assumed to be ${PROG}.c.
2863cbdda60SSimon J. Gerraty
2873cbdda60SSimon J. GerratyDPADD		Additional dependencies for the program.  Usually used for
2883cbdda60SSimon J. Gerraty		libraries.  For example, to depend on the compatibility and
2893cbdda60SSimon J. Gerraty		utility libraries use:
2903cbdda60SSimon J. Gerraty
2913cbdda60SSimon J. Gerraty			DPADD+=${LIBCOMPAT} ${LIBUTIL}
2923cbdda60SSimon J. Gerraty
2933cbdda60SSimon J. Gerraty		The following libraries are predefined for DPADD:
2943cbdda60SSimon J. Gerraty
2953cbdda60SSimon J. Gerraty			LIBC		/lib/libc.a
2963cbdda60SSimon J. Gerraty			LIBCOMPAT	/usr/lib/libcompat.a
2973cbdda60SSimon J. Gerraty			LIBCRYPT	/usr/lib/libcrypt.a
2983cbdda60SSimon J. Gerraty			LIBCURSES	/usr/lib/libcurses.a
2993cbdda60SSimon J. Gerraty			LIBDBM		/usr/lib/libdbm.a
3003cbdda60SSimon J. Gerraty			LIBDES		/usr/lib/libdes.a
3013cbdda60SSimon J. Gerraty			LIBL		/usr/lib/libl.a
3023cbdda60SSimon J. Gerraty			LIBKDB		/usr/lib/libkdb.a
3033cbdda60SSimon J. Gerraty			LIBKRB		/usr/lib/libkrb.a
3043cbdda60SSimon J. Gerraty			LIBKVM		/usr/lib/libkvm.a
3053cbdda60SSimon J. Gerraty			LIBM		/usr/lib/libm.a
3063cbdda60SSimon J. Gerraty			LIBMP		/usr/lib/libmp.a
3073cbdda60SSimon J. Gerraty			LIBPC		/usr/lib/libpc.a
3083cbdda60SSimon J. Gerraty			LIBPLOT		/usr/lib/libplot.a
3093cbdda60SSimon J. Gerraty			LIBRPC		/usr/lib/sunrpc.a
3103cbdda60SSimon J. Gerraty			LIBTERM		/usr/lib/libterm.a
3113cbdda60SSimon J. Gerraty			LIBUTIL		/usr/lib/libutil.a
3123cbdda60SSimon J. Gerraty
3133cbdda60SSimon J. GerratySHAREDSTRINGS	If defined, a new .c.o rule is used that results in shared
3143cbdda60SSimon J. Gerraty		strings, using xstr(1). Note that this will not work with
3153cbdda60SSimon J. Gerraty		parallel makes.
3163cbdda60SSimon J. Gerraty
3173cbdda60SSimon J. GerratySTRIP		The flag passed to the install program to cause the binary
3183cbdda60SSimon J. Gerraty		to be stripped.
3193cbdda60SSimon J. Gerraty
3203cbdda60SSimon J. GerratySUBDIR		A list of subdirectories that should be built as well.
3213cbdda60SSimon J. Gerraty		Each of the targets will execute the same target in the
3223cbdda60SSimon J. Gerraty		subdirectories.
3233cbdda60SSimon J. Gerraty
3243cbdda60SSimon J. GerratyThe include file <bsd.prog.mk> includes the file named "../Makefile.inc"
3253cbdda60SSimon J. Gerratyif it exists, as well as the include file <bsd.man.mk>.
3263cbdda60SSimon J. Gerraty
3273cbdda60SSimon J. GerratySome simple examples:
3283cbdda60SSimon J. Gerraty
3293cbdda60SSimon J. GerratyTo build foo from foo.c with a manual page foo.1, use:
3303cbdda60SSimon J. Gerraty
3313cbdda60SSimon J. Gerraty	PROG=	foo
3323cbdda60SSimon J. Gerraty
3333cbdda60SSimon J. Gerraty	.include <bsd.prog.mk>
3343cbdda60SSimon J. Gerraty
3353cbdda60SSimon J. GerratyTo build foo from foo.c with a manual page foo.2, add the line:
3363cbdda60SSimon J. Gerraty
3373cbdda60SSimon J. Gerraty	MAN=	foo.2
3383cbdda60SSimon J. Gerraty
3393cbdda60SSimon J. GerratyIf foo does not have a manual page at all, add the line:
3403cbdda60SSimon J. Gerraty
3413cbdda60SSimon J. Gerraty	NOMAN=	noman
3423cbdda60SSimon J. Gerraty
3433cbdda60SSimon J. GerratyIf foo has multiple source files, add the line:
3443cbdda60SSimon J. Gerraty
3453cbdda60SSimon J. Gerraty	SRCS=	a.c b.c c.c d.c
3463cbdda60SSimon J. Gerraty
3473cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3483cbdda60SSimon J. Gerraty
3493cbdda60SSimon J. GerratyThe include file <bsd.subdir.mk> contains the default targets for building
3503cbdda60SSimon J. Gerratysubdirectories.  It has the same eight targets as <bsd.prog.mk>: all,
3513cbdda60SSimon J. Gerratyclean, cleandir, depend, includes, install, lint, and tags.  For all of
3523cbdda60SSimon J. Gerratythe directories listed in the variable SUBDIRS, the specified directory
3533cbdda60SSimon J. Gerratywill be visited and the target made.  There is also a default target which
3543cbdda60SSimon J. Gerratyallows the command "make subdir" where subdir is any directory listed in
3553cbdda60SSimon J. Gerratythe variable SUBDIRS.
3563cbdda60SSimon J. Gerraty
3573cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3583cbdda60SSimon J. Gerraty
3593cbdda60SSimon J. GerratyThe include file <bsd.sys.mk> is used by <bsd.prog.mk> and
3603cbdda60SSimon J. Gerraty<bsd.lib.mk>.  It contains overrides that are used when building
3613cbdda60SSimon J. Gerratythe NetBSD source tree.  For instance, if "PARALLEL" is defined by
3623cbdda60SSimon J. Gerratythe program/library Makefile, it includes a set of rules for lex and
3633cbdda60SSimon J. Gerratyyacc that allow multiple lex and yacc targets to be built in parallel.
3643cbdda60SSimon J. Gerraty
3653cbdda60SSimon J. Gerraty=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
3663cbdda60SSimon J. Gerraty
3673cbdda60SSimon J. GerratyThe include file <bsd.lib.mk> has support for building libraries.  It has
3683cbdda60SSimon J. Gerratythe same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
3693cbdda60SSimon J. Gerratyincludes, install, lint, and tags.  It has a limited number of suffixes,
3703cbdda60SSimon J. Gerratyconsistent with the current needs of the BSD tree.
3713cbdda60SSimon J. Gerraty
3723cbdda60SSimon J. GerratyIt sets/uses the following variables:
3733cbdda60SSimon J. Gerraty
3743cbdda60SSimon J. GerratyLIB		The name of the library to build.
3753cbdda60SSimon J. Gerraty
3763cbdda60SSimon J. GerratyLIBDIR		Target directory for libraries.
3773cbdda60SSimon J. Gerraty
3783cbdda60SSimon J. GerratyLINTLIBDIR	Target directory for lint libraries.
3793cbdda60SSimon J. Gerraty
3803cbdda60SSimon J. GerratyLIBGRP		Library group.
3813cbdda60SSimon J. Gerraty
3823cbdda60SSimon J. GerratyLIBOWN		Library owner.
3833cbdda60SSimon J. Gerraty
3843cbdda60SSimon J. GerratyLIBMODE		Library mode.
3853cbdda60SSimon J. Gerraty
3863cbdda60SSimon J. GerratyLDADD		Additional loader objects.
3873cbdda60SSimon J. Gerraty
3883cbdda60SSimon J. GerratyMAN		The manual pages to be installed (use a .1 - .9 suffix).
3893cbdda60SSimon J. Gerraty
3903cbdda60SSimon J. GerratySRCS		List of source files to build the library.  Suffix types
3913cbdda60SSimon J. Gerraty		.s, .c, and .f are supported.  Note, .s files are preferred
3923cbdda60SSimon J. Gerraty		to .c files of the same name.  (This is not the default for
3933cbdda60SSimon J. Gerraty		versions of make.)
3943cbdda60SSimon J. Gerraty
3953cbdda60SSimon J. GerratyThe include file <bsd.lib.mk> includes the file named "../Makefile.inc"
3963cbdda60SSimon J. Gerratyif it exists, as well as the include file <bsd.man.mk>.
3973cbdda60SSimon J. Gerraty
3983cbdda60SSimon J. GerratyIt has rules for building profiled objects; profiled libraries are
3993cbdda60SSimon J. Gerratybuilt by default.
4003cbdda60SSimon J. Gerraty
4013cbdda60SSimon J. GerratyLibraries are ranlib'd when made.
402