11638Srgrimes# @(#)bsd.README 8.2 (Berkeley) 4/2/94 250476Speter# $FreeBSD: stable/10/share/mk/bsd.README 318165 2017-05-10 23:14:09Z jhb $ 31638Srgrimes 4115103StrhodesThis is the README file for the "include" files for the FreeBSD 5115103Strhodessource tree. The files are installed in /usr/share/mk, and are by 6115103Strhodesconvention, named with the suffix ".mk". These files store several 7115103Strhodesbuild options and should be handled with caution. 83470Srgrimes 9115103StrhodesNote, this file is not intended to replace reading through the .mk 10115103Strhodesfiles for anything tricky. 111638Srgrimes 12115103StrhodesThere are two main types of make include files. One type is the generally 13115103Strhodesusable make include files, such as bsd.prog.mk and bsd.lib.mk. The other is 14115103Strhodesthe internal make include files, such as bsd.files.mk and bsd.man.mk, which 15115103Strhodescan not/should not be used directly but are used by the other make include 16115103Strhodesfiles. In most cases it is only interesting to include bsd.prog.mk or 17115103Strhodesbsd.lib.mk. 18115103Strhodes 19115103Strhodesbsd.cpu.mk - sets CPU/arch-related variables 20291786Sbdrewerybsd.crunchgen.mk - building crunched binaries using crunchgen(1) 2123559Swoschbsd.dep.mk - handle Makefile dependencies 2223559Swoschbsd.doc.mk - building troff system documents 23115103Strhodesbsd.files.mk - install of general purpose files 24115103Strhodesbsd.incs.mk - install of include files 2523559Swoschbsd.info.mk - building GNU Info hypertext system 26115103Strhodesbsd.init.mk - initialization for the make include files 2723559Swoschbsd.kmod.mk - building loadable kernel modules 2823559Swoschbsd.lib.mk - support for building libraries 2923559Swoschbsd.libnames.mk - define library names 30115103Strhodesbsd.links.mk - install of links (sym/hard) 31115103Strhodesbsd.man.mk - install of manual pages and their links 32115103Strhodesbsd.nls.mk - build and install of NLS catalogs 3323559Swoschbsd.obj.mk - creating 'obj' directories and cleaning up 3423559Swoschbsd.own.mk - define common variables 3523559Swoschbsd.port.mk - building ports 36115103Strhodesbsd.port.post.mk - building ports 37115103Strhodesbsd.port.pre.mk - building ports 3823559Swoschbsd.port.subdir.mk - targets for building subdirectories for ports 3923559Swoschbsd.prog.mk - building programs from source files 40152265Shartibsd.snmpmod.mk - building modules for the SNMP daemon bsnmpd 4123559Swoschbsd.subdir.mk - targets for building subdirectories 42115103Strhodesbsd.sys.mk - common settings used for building FreeBSD sources 43264483Sjmmvbsd.test.mk - building test programs from source files 44115103Strhodessys.mk - default rules for all makes 4523559Swosch 46115103StrhodesThis file does not document bsd.port*.mk. They are documented in ports(7). 4723559Swosch 48115103StrhodesSee also make(1), mkdep(1), style.Makefile(5) and `PMake - A 49115103StrhodesTutorial', located in /usr/share/doc/psd/12.make. 501638Srgrimes 51115103Strhodes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 5223578Swosch 53115103StrhodesRandom things worth knowing about this document: 54115103Strhodes 55115103StrhodesIf appropriate when documenting the variables the default value is 56115103Strhodesindicated using square brackets e.g. [gzip]. 57115103StrhodesIn some cases the default value depend on other values (e.g. system 58115103Strhodesarchitecture). In these cases the most common value is indicated. 59115103Strhodes 60115103StrhodesThis document contains some simple examples of the usage of the BSD make 61115103Strhodesinclude files. For more examples look at the makefiles in the FreeBSD 62115103Strhodessource tree. 63115103Strhodes 641638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 651638Srgrimes 661638SrgrimesRANDOM THINGS WORTH KNOWING: 671638Srgrimes 68115103StrhodesThe files are like C-style #include files, and pretty much behave like 691638Srgrimesyou'd expect. The syntax is slightly different in that a single '.' is 701638Srgrimesused instead of the hash mark, i.e. ".include <bsd.prog.mk>". 711638Srgrimes 721638SrgrimesOne difference that will save you lots of debugging time is that inclusion 731638Srgrimesof the file is normally done at the *end* of the Makefile. The reason for 741638Srgrimesthis is because .mk files often modify variables and behavior based on the 751638Srgrimesvalues of variables set in the Makefile. To make this work, remember that 761638Srgrimesthe FIRST target found is the target that is used, i.e. if the Makefile has: 771638Srgrimes 781638Srgrimes a: 791638Srgrimes echo a 801638Srgrimes a: 811638Srgrimes echo a number two 821638Srgrimes 831638Srgrimesthe command "make a" will echo "a". To make things confusing, the SECOND 841638Srgrimesvariable assignment is the overriding one, i.e. if the Makefile has: 851638Srgrimes 861638Srgrimes a= foo 871638Srgrimes a= bar 881638Srgrimes 891638Srgrimes b: 901638Srgrimes echo ${a} 911638Srgrimes 921638Srgrimesthe command "make b" will echo "bar". This is for compatibility with the 931638Srgrimesway the V7 make behaved. 941638Srgrimes 951638SrgrimesIt's fairly difficult to make the BSD .mk files work when you're building 96208420Smaximmultiple programs in a single directory. It's a lot easier to split up 97208420Smaximthe programs than to deal with the problem. Most of the agony comes from 98208420Smaximmaking the "obj" directory stuff work right, not because we switch to a new 99208420Smaximversion of make. So, don't get mad at us, figure out a better way to handle 100208420Smaximmultiple architectures so we can quit using the symbolic link stuff. 101208417Smaxim(Imake doesn't count.) 1021638Srgrimes 1031638SrgrimesThe file .depend in the source directory is expected to contain dependencies 1041638Srgrimesfor the source files. This file is read automatically by make after reading 1051638Srgrimesthe Makefile. 1061638Srgrimes 1071638SrgrimesThe variable DESTDIR works as before. It's not set anywhere but will change 1081638Srgrimesthe tree where the file gets installed. 1091638Srgrimes 1101638SrgrimesThe profiled libraries are no longer built in a different directory than 1111638Srgrimesthe regular libraries. A new suffix, ".po", is used to denote a profiled 1121638Srgrimesobject. 1131638Srgrimes 1141638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1151638Srgrimes 1161638SrgrimesThe include file <sys.mk> has the default rules for all makes, in the BSD 1171638Srgrimesenvironment or otherwise. You probably don't want to touch this file. 1181638Srgrimes 1191638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1201638Srgrimes 1211638SrgrimesThe include file <bsd.man.mk> handles installing manual pages and their 1221638Srgrimeslinks. 1231638Srgrimes 12483075SruIt has three targets: 1251638Srgrimes 12683075Sru all-man: 12783075Sru build manual pages. 1281638Srgrimes maninstall: 12983075Sru install the manual pages and their links. 13083075Sru manlint: 13183075Sru verify the validity of manual pages. 1321638Srgrimes 1331638SrgrimesIt sets/uses the following variables: 1341638Srgrimes 1351638SrgrimesMANDIR Base path for manual installation. 1361638Srgrimes 1371638SrgrimesMANGRP Manual group. 1381638Srgrimes 1391638SrgrimesMANOWN Manual owner. 1401638Srgrimes 1411638SrgrimesMANMODE Manual mode. 1421638Srgrimes 1431638SrgrimesMANSUBDIR Subdirectory under the manual page section, i.e. "/vax" 1441638Srgrimes or "/tahoe" for machine specific manual pages. 1451638Srgrimes 14674942SruMAN The manual pages to be installed (use a .1 - .9 suffix). 1471638Srgrimes 14858494SruMLINKS List of manual page links (using a .1 - .9 suffix). The 1491638Srgrimes linked-to file must come first, the linked file second, 1501638Srgrimes and there may be multiple pairs. The files are soft-linked. 1511638Srgrimes 15274942SruThe include file <bsd.man.mk> includes a file named "../Makefile.inc" if 15374942Sruit exists. 1541638Srgrimes 1551638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1561638Srgrimes 1571638SrgrimesThe include file <bsd.own.mk> contains the owners, groups, etc. for both 1581638Srgrimesmanual pages and binaries. 1591638Srgrimes 1601638SrgrimesIt has no targets. 1611638Srgrimes 1621638SrgrimesIt sets/uses the following variables: 1631638Srgrimes 1641638SrgrimesBINGRP Binary group. 1651638Srgrimes 1661638SrgrimesBINOWN Binary owner. 1671638Srgrimes 1681638SrgrimesBINMODE Binary mode. 1691638Srgrimes 1701638SrgrimesMANDIR Base path for manual installation. 1711638Srgrimes 1721638SrgrimesMANGRP Manual group. 1731638Srgrimes 1741638SrgrimesMANOWN Manual owner. 1751638Srgrimes 1761638SrgrimesMANMODE Manual mode. 1771638Srgrimes 1781638SrgrimesThis file is generally useful when building your own Makefiles so that 1791638Srgrimesthey use the same default owners etc. as the rest of the tree. 1801638Srgrimes 1811638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 1821638Srgrimes 1831638SrgrimesThe include file <bsd.prog.mk> handles building programs from one or 1841638Srgrimesmore source files, along with their manual pages. It has a limited number 1851638Srgrimesof suffixes, consistent with the current needs of the BSD tree. 1861638Srgrimes 1871638SrgrimesIt has seven targets: 1881638Srgrimes 1891638Srgrimes all: 1901638Srgrimes build the program and its manual page 1911638Srgrimes clean: 192159721Syar remove the program and any object files. 1931638Srgrimes cleandir: 1941638Srgrimes remove all of the files removed by the target clean, as 1951638Srgrimes well as .depend, tags, and any manual pages. 1961638Srgrimes depend: 1971638Srgrimes make the dependencies for the source files, and store 1981638Srgrimes them in the file .depend. 1991638Srgrimes install: 2001638Srgrimes install the program and its manual pages; if the Makefile 2011638Srgrimes does not itself define the target install, the targets 2021638Srgrimes beforeinstall and afterinstall may also be used to cause 2031638Srgrimes actions immediately before and after the install target 2041638Srgrimes is executed. 2051638Srgrimes lint: 2061638Srgrimes run lint on the source files 2071638Srgrimes tags: 2081638Srgrimes create a tags file for the source files. 2091638Srgrimes 2101638SrgrimesIt sets/uses the following variables: 2111638Srgrimes 2121638SrgrimesBINGRP Binary group. 2131638Srgrimes 2141638SrgrimesBINOWN Binary owner. 2151638Srgrimes 2161638SrgrimesBINMODE Binary mode. 2171638Srgrimes 21816437SphkCLEANFILES Additional files to remove and 21916437SphkCLEANDIRS additional directories to remove during clean and cleandir 22016437Sphk targets. "rm -f" and "rm -rf" used respectively. 2211638Srgrimes 222133653SruCFLAGS Flags to the compiler when creating C objects. 2231638Srgrimes 22488055SruFILES A list of non-executable files. 22588055Sru The installation is controlled by the FILESNAME, FILESOWN, 22688055Sru FILESGRP, FILESMODE, FILESDIR variables that can be 22788055Sru further specialized by FILES<VAR>_<file>. 22888055Sru 2291638SrgrimesLDADD Additional loader objects. Usually used for libraries. 2301638Srgrimes For example, to load with the compatibility and utility 2311638Srgrimes libraries, use: 2321638Srgrimes 233235928Smarcel LDADD=-lutil -lcompat 2341638Srgrimes 2351638SrgrimesLDFLAGS Additional loader flags. 2361638Srgrimes 2371638SrgrimesLINKS The list of binary links; should be full pathnames, the 2381638Srgrimes linked-to file coming first, followed by the linked 2391638Srgrimes file. The files are hard-linked. For example, to link 2401638Srgrimes /bin/test and /bin/[, use: 2411638Srgrimes 2421638Srgrimes LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[ 2431638Srgrimes 24474942SruMAN Manual pages (should end in .1 - .9). If no MAN variable 24574942Sru is defined, "MAN=${PROG}.1" is assumed. 2461638Srgrimes 2471638SrgrimesPROG The name of the program to build. If not supplied, nothing 2481638Srgrimes is built. 2491638Srgrimes 25094424SruPROG_CXX If defined, the name of the program to build. Also 25194424Sru causes <bsd.prog.mk> to link the program with the 25294424Sru standard C++ library. PROG_CXX overrides the value 25394424Sru of PROG if PROG is also set. 25494424Sru 255289052SbdreweryPROGS When used with <bsd.progs.mk>, allow building multiple 256318165SjhbPROGS_CXX PROG and PROG_CXX in one Makefile. To define 257289052Sbdrewery individual variables for each program the VAR.prog 258289052Sbdrewery syntax should be used. For example: 259289052Sbdrewery 260289052Sbdrewery PROGS= foo bar 261289052Sbdrewery SRCS.foo= foo_src.c 262289052Sbdrewery LDADD.foo= -lutil 263289052Sbdrewery SRCS.bar= bar_src.c 264289052Sbdrewery 265298503Sngie The supported variables are: 266298503Sngie - BINDIR 267298503Sngie - BINGRP 268298503Sngie - BINMODE 269298503Sngie - BINOWN 270298503Sngie - CFLAGS 271298503Sngie - CXXFLAGS 272298503Sngie - DEBUG_FLAGS 273298503Sngie - DPADD 274298503Sngie - DPSRCS 275304145Sbdrewery - INTERNALPROG (no installation) 276298503Sngie - LDADD 277298503Sngie - LDFLAGS 278298503Sngie - LINKS 279298503Sngie - MAN 280298503Sngie - MLINKS 281298503Sngie - NO_WERROR 282298503Sngie - PROGNAME 283298503Sngie - SRCS 284298503Sngie - STRIP 285298503Sngie - WARNS 286289052Sbdrewery 28775083SruPROGNAME The name that the above program will be installed as, if 28875083Sru different from ${PROG}. 28975083Sru 29053965SmharoSRCS List of source files to build the program. If SRCS is not 29194424Sru defined, it's assumed to be ${PROG}.c or, if PROG_CXX is 29294424Sru defined, ${PROG_CXX}.cc. 2931638Srgrimes 2941638SrgrimesDPADD Additional dependencies for the program. Usually used for 2951638Srgrimes libraries. For example, to depend on the compatibility and 2961638Srgrimes utility libraries use: 2971638Srgrimes 298235928Smarcel DPADD=${LIBCOMPAT} ${LIBUTIL} 2991638Srgrimes 30014701Sbde There is a predefined identifier for each (non-profiled, 30114701Sbde non-shared) library and object. Library file names are 30214701Sbde transformed to identifiers by removing the extension and 30314701Sbde converting to upper case. 3041638Srgrimes 30514701Sbde There are no special identifiers for profiled or shared 30614701Sbde libraries or objects. The identifiers for the standard 30714701Sbde libraries are used in DPADD. This works correctly iff all 30814701Sbde the libraries are built at the same time. Unfortunately, 30914701Sbde it causes unnecessary relinks to shared libraries when 31014701Sbde only the static libraries have changed. Dependencies on 31114701Sbde shared libraries should be only on the library version 31214701Sbde numbers. 3131638Srgrimes 3141638SrgrimesSTRIP The flag passed to the install program to cause the binary 315125493Sru to be stripped. This is to be used when building your 316125493Sru own install script so that the entire system can be made 317125493Sru stripped/not-stripped using a single nob. 3181638Srgrimes 3191638SrgrimesSUBDIR A list of subdirectories that should be built as well. 3201638Srgrimes Each of the targets will execute the same target in the 3211638Srgrimes subdirectories. 3221638Srgrimes 32375284SruSCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}]. 32475284Sru The installation is controlled by the SCRIPTSNAME, SCRIPTSOWN, 32575284Sru SCRIPTSGRP, SCRIPTSMODE, SCRIPTSDIR variables that can be 32675284Sru further specialized by SCRIPTS<VAR>_<script>. 32775284Sru 32874942SruThe include file <bsd.prog.mk> includes the file named "../Makefile.inc" 32974942Sruif it exists, as well as the include file <bsd.man.mk>. 3301638Srgrimes 3311638SrgrimesSome simple examples: 3321638Srgrimes 3331638SrgrimesTo build foo from foo.c with a manual page foo.1, use: 3341638Srgrimes 3351638Srgrimes PROG= foo 3361638Srgrimes 3371638Srgrimes .include <bsd.prog.mk> 3381638Srgrimes 3391638SrgrimesTo build foo from foo.c with a manual page foo.2, add the line: 3401638Srgrimes 341156743Sru MAN= foo.2 3421638Srgrimes 3431638SrgrimesIf foo does not have a manual page at all, add the line: 3441638Srgrimes 345276486Sngie MAN= 3461638Srgrimes 3471638SrgrimesIf foo has multiple source files, add the line: 3481638Srgrimes 3491638Srgrimes SRCS= a.c b.c c.c d.c 3501638Srgrimes 3511638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 3521638Srgrimes 353313223SngieThe include file, <bsd.snmpmod.mk>, handles building MIB modules for bsnmpd 354313223Sngiefrom one or more source files, along with their manual pages. It has a 355313223Sngielimited number of suffixes, consistent with the current needs of the BSD 356313223Sngietree. 357313223Sngie 358313223Sngiebsd.snmpmod.mk leverages bsd.lib.mk for building MIB modules and 359313223Sngiebsd.files.mk for installing MIB description and definition files. 360313223Sngie 361313223SngieIt implements the following additional targets: 362313223Sngie 363313223Sngie smilint: 364313223Sngie execute smilint on the MIBs defined by BMIBS. 365313223Sngie 366313223Sngie The net-mgmt/libsmi package must be installed before 367313223Sngie executing this target. The net-mgmt/net-snmp package 368313223Sngie should be installed as well to reduce false positives 369313223Sngie from smilint. 370313223Sngie 371313223SngieIt sets/uses the following variables: 372313223Sngie 373313223SngieBMIBS The MIB definitions to install. 374313223Sngie 375313223SngieBMIBSDIR The directory where the MIB definitions are installed. 376313223Sngie This defaults to `${SHAREDIR}/snmp/mibs`. 377313223Sngie 378313223SngieDEFS The MIB description files to install. 379313223Sngie 380313223SngieDEFSDIR The directory where MIB description files are installed. 381313223Sngie This defaults to `${SHAREDIR}/snmp/defs`. 382313223Sngie 383313223SngieEXTRAMIBDEFS Extra MIB description files to use as input when 384313223Sngie generating ${MOD}_oid.h and ${MOD}_tree.[ch]. 385313223Sngie 386313223SngieEXTRAMIBSYMS Extra MIB definition files used only for extracting 387313223Sngie symbols. 388313223Sngie 389313223Sngie EXTRAMIBSYMS are useful when resolving inter-module 390313223Sngie dependencies and are useful with files containing only 391313223Sngie enum-definitions. 392313223Sngie 393313223Sngie See ${MOD}_oid.h for more details. 394313223Sngie 395313223SngieLOCALBASE The package root where smilint and the net-snmp 396313223Sngie definitions can be found 397313223Sngie 398313223SngieMOD The bsnmpd module name. 399313223Sngie 400313223SngieSMILINT smilint binary to use with the smilint make target. 401313223Sngie 402313223SngieSMILINT_FLAGS flags to pass to smilint. 403313223Sngie 404313223SngieSMIPATH A colon-separated directory path where MIBs definitions 405313223Sngie can be found. See "SMIPATH" in smi_config for more 406313223Sngie details. 407313223Sngie 408313223SngieXSYM MIB names to extract symbols for. See ${MOD}_oid.h for 409313223Sngie more details. 410313223Sngie 411313223SngieIt generates the following files: 412313223Sngie 413313223Sngie${MOD}_tree.c A source file and header which programmatically describes 414313223Sngie${MOD}_tree.h the MIB (type, OID name, ACCESS attributes, etc). 415313223Sngie 416313223Sngie The files are generated via "gensnmptree -p". 417313223Sngie 418313223Sngie See gensnmptree(1) for more details. 419313223Sngie 420313223Sngie${MOD}_oid.h A header which programmatically describes the MIB root and 421313223Sngie MIB tables. 422313223Sngie 423313223Sngie The files are generated via "gensnmptree -e". 424313223Sngie 425313223Sngie See gensnmptree(1) for more details. 426313223Sngie 427313223Sngie=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 428313223Sngie 4291638SrgrimesThe include file <bsd.subdir.mk> contains the default targets for building 4301638Srgrimessubdirectories. It has the same seven targets as <bsd.prog.mk>: all, clean, 4311638Srgrimescleandir, depend, install, lint, and tags. For all of the directories 4321638Srgrimeslisted in the variable SUBDIRS, the specified directory will be visited 4331638Srgrimesand the target made. There is also a default target which allows the 4341638Srgrimescommand "make subdir" where subdir is any directory listed in the variable 4351638SrgrimesSUBDIRS. 4361638Srgrimes 4371638Srgrimes=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 4381638Srgrimes 4391638SrgrimesThe include file <bsd.lib.mk> has support for building libraries. It has 4401638Srgrimesthe same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend, 4411638Srgrimesinstall, lint, and tags. It has a limited number of suffixes, consistent 4421638Srgrimeswith the current needs of the BSD tree. 4431638Srgrimes 4441638SrgrimesIt sets/uses the following variables: 4451638Srgrimes 446281056SbdreweryLIB The name of the library to build. 447281056Sbdrewery 448281056SbdreweryLIB_CXX The name of the library to build. It also causes 449281056Sbdrewery <bsd.lib.mk> to link the library with the 450281056Sbdrewery standard C++ library. LIB_CXX overrides the value 451281056Sbdrewery of LIB if LIB is also set. 452281056Sbdrewery 4531638SrgrimesLIBDIR Target directory for libraries. 4541638Srgrimes 4551638SrgrimesLINTLIBDIR Target directory for lint libraries. 4561638Srgrimes 4571638SrgrimesLIBGRP Library group. 4581638Srgrimes 4591638SrgrimesLIBOWN Library owner. 4601638Srgrimes 4611638SrgrimesLIBMODE Library mode. 4621638Srgrimes 4631638SrgrimesLDADD Additional loader objects. 4641638Srgrimes 46574942SruMAN The manual pages to be installed (use a .1 - .9 suffix). 4661638Srgrimes 4671638SrgrimesSRCS List of source files to build the library. Suffix types 4681638Srgrimes .s, .c, and .f are supported. Note, .s files are preferred 4691638Srgrimes to .c files of the same name. (This is not the default for 4701638Srgrimes versions of make.) 4711638Srgrimes 472235122SjlhSHLIB_LDSCRIPT Template file to generate shared library linker script. 473318165Sjhb If not defined, a simple symlink is created to the real 474235122Sjlh shared object. 475235122Sjlh 476245561SbrooksLIBRARIES_ONLY Do not build or install files other than the library. 477245561Sbrooks 47874942SruThe include file <bsd.lib.mk> includes the file named "../Makefile.inc" 47974942Sruif it exists, as well as the include file <bsd.man.mk>. 4801638Srgrimes 4811638SrgrimesIt has rules for building profiled objects; profiled libraries are 4821638Srgrimesbuilt by default. 4831638Srgrimes 4841638SrgrimesLibraries are ranlib'd before installation. 485264483Sjmmv 486264483Sjmmv=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 487264483Sjmmv 488264483SjmmvThe include file <bsd.test.mk> handles building one or more test programs 489264483Sjmmvintended to be used in the FreeBSD Test Suite under /usr/tests/. 490264483Sjmmv 491264483SjmmvIt has seven targets: 492264483Sjmmv 493264483Sjmmv all: 494264483Sjmmv build the test programs. 495313790Sngie check: 496313790Sngie runs the test programs from CHECKDIR with kyua test. 497313790Sngie 498313790Sngie The beforecheck and aftercheck targets will be invoked, if 499313790Sngie defined, to execute commands before and after the realcheck 500313790Sngie target has been executed, respectively. 501313790Sngie 502313790Sngie The devel/kyua package must be installed before invoking this 503313790Sngie target. 504313790Sngie 505313790Sngie See CHECKDIR for more details. 506264483Sjmmv clean: 507264483Sjmmv remove the test programs and any object files. 508264483Sjmmv cleandir: 509264483Sjmmv remove all of the files removed by the target clean, as 510264483Sjmmv well as .depend and tags. 511264483Sjmmv depend: 512264483Sjmmv make the dependencies for the source files, and store 513264483Sjmmv them in the file .depend. 514264483Sjmmv install: 515264483Sjmmv install the test programs and their data files; if the 516264483Sjmmv Makefile does not itself define the target install, the 517264483Sjmmv targets beforeinstall and afterinstall may also be used 518264483Sjmmv to cause actions immediately before and after the 519264483Sjmmv install target is executed. 520264483Sjmmv lint: 521264483Sjmmv run lint on the source files. 522264483Sjmmv tags: 523264483Sjmmv create a tags file for the source files. 524264483Sjmmv 525264483SjmmvIt sets/uses the following variables, among many others: 526264483Sjmmv 527292278SngieTESTSBASE Installation prefix for tests. Defaults to /usr/tests 528292278Sngie 529292278SngieTESTSDIR Path to the installed tests. Must be a subdirectory of 530264483Sjmmv TESTSBASE and the subpath should match the relative 531264483Sjmmv location of the tests within the src tree. 532264483Sjmmv 533292278Sngie The value of TESTSDIR defaults to 534292278Sngie ${TESTSBASE}/${RELDIR:H} , e.g. /usr/tests/bin/ls when 535292278Sngie included from bin/ls/tests . 536292278Sngie 537313790SngieCHECKDIR The directory that 'make check' executes tests from. 538313790Sngie 539313790Sngie The value of CHECKDIR defaults to .OBJDIR. 540313790Sngie 541264483SjmmvKYUAFILE If 'auto' (the default), generate a Kyuafile out of the 542264483Sjmmv test programs defined in the Makefile. If 'yes', then a 543264483Sjmmv manually-crafted Kyuafile must be supplied with the 544264483Sjmmv sources. If 'no', no Kyuafile is installed (useful for 545264483Sjmmv subdirectories providing helper programs or data files 546264483Sjmmv only). 547264483Sjmmv 548292812SngieLOCALBASE The --prefix for the kyua package. 549292812Sngie 550292812Sngie The value of LOCALBASE defaults to /usr/local . 551292812Sngie 552264483SjmmvATF_TESTS_C The names of the ATF C test programs to build. 553264483Sjmmv 554264483SjmmvATF_TESTS_CXX The names of the ATF C++ test programs to build. 555264483Sjmmv 556264483SjmmvATF_TESTS_SH The names of the ATF sh test programs to build. 557264483Sjmmv 558264483SjmmvPLAIN_TESTS_C The names of the plain (legacy) programs to build. 559264483Sjmmv 560264483SjmmvPLAIN_TESTS_CXX The names of the plain (legacy) test programs to build. 561264483Sjmmv 562264483SjmmvPLAIN_TESTS_SH The names of the plain (legacy) test programs to build. 563264483Sjmmv 564264483SjmmvTAP_PERL_INTERPRETER 565264483Sjmmv Path to the Perl interpreter to be used for 566264483Sjmmv TAP-compliant test programs that are written in Perl. 567264483Sjmmv Refer to TAP_TESTS_PERL for details. 568264483Sjmmv 569264483SjmmvTAP_TESTS_C The names of the TAP-compliant C test programs to build. 570264483Sjmmv 571264483SjmmvTAP_TESTS_CXX The names of the TAP-compliant C++ test programs to 572264483Sjmmv build. 573264483Sjmmv 574264483SjmmvTAP_TESTS_PERL The names of the TAP-compliant Perl test programs to 575264483Sjmmv build. The corresponding source files should end with 576264483Sjmmv the .pl extension; the test program is marked as 577264483Sjmmv requiring Perl; and TAP_PERL_INTERPRETER is used in the 578264483Sjmmv built scripts as the interpreter of choice. 579264483Sjmmv 580264483SjmmvTAP_TESTS_SH The names of the TAP-compliant sh test programs to 581264483Sjmmv build. 582264483Sjmmv 583264483SjmmvTESTS_SUBDIRS List of subdirectories containing tests into which to 584264483Sjmmv recurse. Differs from SUBDIR in that these directories 585264483Sjmmv get registered into the automatically-generated 586264483Sjmmv Kyuafile (if any). 587264483Sjmmv 588264483SjmmvNOT_FOR_TEST_SUITE 589264483Sjmmv If defined, none of the built test programs get 590264483Sjmmv installed under /usr/tests/ and no Kyuafile is 591264483Sjmmv automatically generated. Should not be used within the 592264483Sjmmv FreeBSD source tree but is provided for the benefit of 593264483Sjmmv third-parties. 594264483Sjmmv 595264483SjmmvThe actual building of the test programs is performed by <bsd.prog.mk>. 596264483SjmmvPlease see the documentation above for this other file for additional 597264483Sjmmvdetails on the behavior of <bsd.test.mk>. 598