Provided by: mk-configure_0.25.0-1_all
NAME
mk-configure - lightweight replacement for GNU autotools
DESCRIPTION
mk-configure is a collection of include files for bmake (portable version of NetBSD make) and a number of executables. It is intended to simplify crossplatform development and software building. To get system-specific configuration parameters, mkc.*.mk include files try to include the file specified by the "MAKECONF" variable. If MAKECONF is not set, or no such file exists, the system make configuration file, /etc/mk.conf or /etc/mk.conf, is included. Unless SRCTOP variable is set, "../Makefile.inc" is also included if exists. These files may define any of the variables described below. Below in square brackets the default value for variables are specified. In triangle brackets -- typical way of use, where I means "Initialized by mk-configure", Iu means "Initialized by mk-configure but may be overriden by user", Im means "Initialized by mk-configure but may be set in Makefile", U means "Usually set by user", M means "May be set or changed in project's Makefile" and Mu means "May be set in project's Makefile but may be initialized or overriden by user". Targets mkc.prog.mk, mkc.lib.mk, mkc.files.mk, mkc.subdir.mk, and mkc.subprj.mk include files provide the following targets: all build everything. clean clean temporary files and directories created while building with a help of ${CLEANFILES_CMD} and ${CLEANDIRS_CMD} commands. cleandir remove all of the files removed by the target clean, as well as cache files created by mkc.configure.mk. distclean synonym for target "cleandir". installdirs create target directories. install install programs, libraries, files, include files, manual pages etc. to the target directories with a help of ${INSTALL} program. uninstall remove installed files with a help of ${UNINSTALL} command. errorcheck check for MKC_ERR_MSG variable and fails if it set printing an error message depend create .depend file containing list of dependencies (see mkdep(1)). filelist output a list of destination files of the project, one per line, e.g. /usr/local/bin/hello /usr/local/man/man1/hello.1 obj if MKOBJDIR is "yes", creates object directories (${.OBJDIR}) according to MAKEOBJDIR and MAKEOBJPREFIX variables. Current umask is used for this. bin_tar, bin_targz, bin_tarbz2, bin_zip, bin_deb build software, install it to a temporary directory (using DESTDIR) and create .tar/.tar.gz/.tar.bz2/.zip/.deb archive containing all installed files. The target bin_deb expects debian control files in DEBIAN subdirectory, see examples/hello_files for the sample. <subdir> and <subdir:T> <subdir> is a subdirectory listed in SUBDIR or SUBPRJ. This target is equivalent to all-<subdir> and is provided by mkc.subdir.mk and mkc.subprj.mk only. For details see mkc.subdir.mk or mkc.subprj.mk sections below. <subdir:T> means the last component of the directory. This target is created if ${SHORTPRJNAME} is "yes". <target>-<subdir> runs the specified <target> for the specified <subdir>. This target is provided by mkc.subdir.mk and mkc.subprj.mk only. For details see mkc.subdir.mk or mkc.subprj.mk sections below. The target <target>-<subdir:T> is also provided if ${SHORTPRJNAME} is "yes". subdir-<target>-<subdir> and nodeps-<target>-<subdir> runs the specified <target> for the specified <subdir> without dependencies. These targets are provided by mkc.subprj.mk only. For details see mkc.subprj.mk section below. Targets subdir-<target>-<subdir:T> and nodeps-<target>-<subdir:T> are also provided if ${SHORTPRJNAME} is "yes". NOTE: Commands associated with targets all, install, clean, cleandir, depend, test, installdirs, uninstall, errorcheck and filelist in Makefile override the standard behaviour. Common variables The following variables control how various files are compiled/built. AR Create, modify, and extract from archives. <Iu> [ar] ARFLAGS Options to ${AR}. <Iu> [rl] AS Assembler. <Iu> [as] AFLAGS Options to ${CC} when compiling or linking .s or .S assembly source files. [] CC C compiler. <Iu> [cc] CC_PREFIX Prefix command for ${CC}, for example, distcc or ccache. <Iu> [] CFLAGS Additional flags to the compiler when creating C objects. <IM> CFLAGS_<project> Similar to CFLAGS but for project ${PROJECTNAME}. <U> CLEANFILES_CMD Command for removing files used by targets "clean" and "cleandir". <Iu> [${RM} -f] CLEANDIRS_CMD Command for removing directories used by targets "clean" and "cleandir". <Iu> [${RM} -rf] COPTS Additional flags to the compiler when creating C objects. <U> COPTS_<project> Similar to COPTS but for project ${PROJECTNAME}. <U> CXX C++ compiler. <Iu> [c++] CXX_PREFIX Prefix command for ${CXX}, for example, distcc or ccache. <Iu> [] CXXFLAGS Additional flags to the compiler when creating C++ objects. <Iu> [${CFLAGS}] CXXFLAGS_<project> Similar to CXXFLAGS but for project ${PROJECTNAME}. <U> CPP C Pre-Processor. <Iu> [cpp] CPPFLAGS Additional flags to the C pre-processor. <Iu> CPPFLAGS_<project> Similar to CPPFLAGS but for project ${PROJECTNAME}. <U> FC Fortran compiler. <Iu> [f77] FFLAGS Options to {$FC}. <Iu> [-O] FFLAGS_<project> Similar to FFLAGS but for project ${PROJECTNAME}. <U> INSTALL install(1) command. <Iu> [install or mkc_install] LEX Lexical analyzer. <Iu> [lex] LFLAGS Options to ${LEX}. <Iu> [] LN ln(1) tool. <Iu> [ln] LN_S Tool equivalent to ln -s. <Iu> [${LN} -s] LPREFIX Symbol prefix for ${LEX} (see -P option in lex(1)). <Iu> [yy] <Iu> [yy] LEXLIB Object file for lex. <Iu> [-ll] LD Linker. <Iu> [ld] LORDER List dependencies for object files. <Iu> [lorder] MAKE bmake(1). [bmake or make on NetBSD] MAKEDEPEND makedepend(1) tool. <Iu> MKDIR mkdir(1) tool. <Iu> [mkdir] MKDEP mkdep(1) tool. <Iu> NM List symbols from object files. <Iu> [nm] PC Pascal compiler. <Iu> [pc] PFLAGS Options to ${PC}. <Iu> [] OBJCOPY Copy and translate object files. <Iu> [objcopy] OBJDUMP Display information from object files. <Iu> [objdump] RANLIB Generate index to archive. <Iu> [ranlib] RM rm(1) tool. <Iu> [rm] SIZE List section sizes and total size. <Iu> [size] STRIP Discard symbols from object files. <Iu> [strip] STRIPFLAG The flag passed to the install program to cause the binary to be stripped. <Iu> TSORT Topological sort of a directed graph. <Iu> [tsort -q] UNINSTALL Command for removing files used by target "uninstall". <Iu> [${RM} -f] YACC LALR(1) parser generator. <Iu> [yacc] TAR tar archiver. <Iu> [tar] GZIP gzip copression tool. <Iu> [gzip] BZIP2 bzip2 copression tool. <Iu> [bzip2] ZIP zip copression tool. <Iu> [zip] YFLAGS Options to ${YACC}. <Iu> [] YHEADER If defined, add "-d" to YFLAGS, and add dependencies from <file>.y to <file>.h and <file>.c, and add <foo>.h to CLEANFILES. YPREFIX If defined, add "-p ${YPREFIX}" to YFLAGS. WARNERR If "yes", force warnings to be reported as errors. At the moment this is supported for GCC, Intel C/C++ and Sun's C/C++ compilers. <Iu> [yes if WARNS=4, no otherwise ] WARNS Crank up warning options; the distinct levels are (the higher the more strict): WARNS=0 WARNS=1 WARNS=2 WARNS=3 WARNS=4 At the moment WARNS is supported for GCC and HP-UX C/C++ only. WARNS=0 means disabling all warnings if such feature is provided by compiler and mk-configure. <Mu> [0] PREFIX Target directory. <U> [/usr/local] BINDIR Target directory for utilities. <Iu Mu> [${PREFIX}/bin] SBINDIR Target directory for administration utilities. <Iu> [${PREFIX}/sbin] LIBDIR Target directory for libraries. <Iu> [${PREFIX}/lib] LIBEXECDIR Target directory for system utilities. <Iu> [${PREFIX}/libexec] DATADIR Target directory for architecture-independent text files. <Iu> [${PREFIX}/share] SYSCONFDIR Target directory for configuration files. <Iu> [${PREFIX}/etc] INFODIR Target directory for .info files. <Iu> [${PREFIX}/info] DESTDIR Installation prefix. <U> [] MKC_ERR_MSG If set, keep an error message. <I M> [] MKINSTALL If not "yes", build everything but do not install. This option is useful for e.g. internal libraries. <Mu> [yes] MKINSTALLDIRS If "yes", install target directories (target installdirs) before installing files (target install). <Iu> [yes] MKOBJDIR If "yes", the target "obj" creates object directories, if "auto", object directories are created automatically. Otherwise object directories are not created. <Iu> [auto] BMAKE_REQD Minimal required version of bmake. If it is older, mkcmake exits with error. <Im> MKC_REQD Minimal required version of mk-configure. If required version is not found, the target errorcheck fails. <M> MKC_VERSION Version of mk-configure. This variable is always set to non-empty value when mkc.*.mk include files are used, so you can use it to initialize mk-c variables in mk.conf. For example: /etc/mk.conf: ... .ifdef MKC_VERSION COPTS?= -O2 -Werror SHRTOUT= yes .endif # MKC_VERSION <I> PROJECTNAME The name of a project. By default it is set to ${PROG}, ${LIB} or ${.CURDIR:T}. For a top-level project using either mkc.subdir.mk or mkc.subprj.mk it makes sense to set this variable explicitely in project's Makefile. This variable is initialized before including mk.conf, so you can use it to change build options, e.g. during development process. /etc/mk.conf: ... .ifdef MKC_VERSION ... .if ${PROJECTNAME} == "foo" SHRTOUT= yes PROG.gcc= /usr/bin/gcc CC_TYPE= gcc COPTS= -O0 -g .endif .endif # MKC_VERSION <Im> CC_TYPE C compiler type. This variable is set by mk-configure and can be overriden by user. It can get the following values: Value Description ---------------------- gcc GNU C/C++ compiler pcc Portable C compiler icc Intel C/C++ compiler msc Microsoft C/C++ compiler hpc HP-UX C/C++ compiler sunpro SUNWspro C/C++ compiler ibmc IBM C/C++ compiler (Visual Age for C/C++?) bcc Borland C/C++ compiler watcom Watcom C/C++ compiler como COMO C/C++ compiler decc DEC C mipspro MIPSpro C compiler <Iu> CXX_TYPE C++ compiler type. This variable is set by mk-configure and can be overriden by user. It can get the same values as CC_TYPE variable. <Iu> LD_TYPE Linker type. This variable is set by mk-configure and can be overriden by user. It can get the following values: Value Description ---------------------- aixld AIX linker darwinld Darwin linker (MacOS-X) gnuld GNU linker hpld HP-UX linker interixld Interix linker scold SCO linker sunld SunOS linker osf1ld OSF1 linker (Tru64) irixld IRIX linker <Iu> SHRTOUT If not "no", output messages about compiling, linking and creating libraries are shortened and formatted. <Iu> [no] CFLAGS.warns.<cctype>.<warn-level>, CXXFLAGS.warns.<cxxtype>.<warn-level> These variables are set by mk-configure and enable warning messages for C or C++ compilers according to their types (CC_TYPE and CXX_TYPE) and warning level (WARNS). <Iu> CFLAGS.dflt.<cctype>, CXXFLAGS.dflt.<cxxtype> Additional flags passed to C or C++ compilers according to their types (CC_TYPE and CXX_TYPE). <Iu> CFLAGS.pic, CXXFLAGS.pic Options for C and C++ compilers for generating position independent code. On some platforms it makes sense to override these variables (initialized by mk-configure) for better performance, for example, one may use -fpic instead of -fPIC with GNU C/C++ compilers. See SHLIB_MAJOR, MKPIE etc. variables for more information. <Iu> CFLAGS.pie, CXXFLAGS.pie Options for C and C++ compilers for generating position independent executables. On some platforms it makes sense to override these variables (initialized by mk- configure) for better performance, for example, one may use -fpic instead of -fPIC with GNU C/C++ compilers. See MKPIE variable for more information. <Iu> CFLAGS.ssp, CXXFLAGS.ssp Options for C and C++ compilers for generating stack protection code. See USE_SSP variable for more information. <Iu> USE_SSP If "yes", enables stack protection code, which detects stack overflows and aborts the program. This enhances security but imposes some performance penalty. <U> [no] SRCTOP Top-level project's directory which defaults to ${.CURDIR} if ${.MAKE.LEVEL} is 0. If set, "../Makefile.inc" is not included. Also, the following command mkcmake -C subproject target will be translated to cd ${SRCTOP}; mkcmake target-subproject <Iu> OBJTOP Top-level object directory which defaults to ${.OBJDIR} if ${.MAKE.LEVEL} is 0. <I> mkc.init.mk This file sets most important mk-configure variables, for example, OPSYS, PREFIX, CC_TYPE etc. and is included automatically by mkc.files.mk, mkc.lib.mk, mkc.prog.mk, mkc.subdir.mk and mkc.subprj.mk mkc.files.mk The include file mkc.files.mk handles the FILES variables and is included from mkc.lib.mk and mkc.prog.mk. mkc_imp.files.mk List of supported variables: FILES The list of files to install. <M> FILESDIR The location to install the files. <Mu> [${PREFIX}/bin] FILESDIR_<fn> The location to install the specific file <fn>. <Mu> FILESOWN File owner. If bmake is run with root privileges, it defaults to ${BINOWN} or to `id -u` otherwise. <Mu> FILESOWN_<fn> File owner of the specific file <fn>. <Mu> FILESGRP File group. If bmake is run with root privileges, it defaults to <Mu> ${BINGRP} or to `id -g` otherwise. <Mu> FILESGRP_<fn> File group of the specific file <fn>. <Mu> FILESMODE File mode. <Mu> [${NONBINMODE}] FILESMODE_<fn> File mode of the specific file <fn>. <Mu> FILESNAME Optional name to install each file as. <Mu> FILESNAME_<fn> Optional name to install <fn> as. <Mu> CLEANFILES Additional files to remove for the clean, cleandir and distclean targets. <I M> DISTCLEANFILES Additional files to remove for the cleandir and distclean targets. <I M> CLEANDIRS Additional directories to remove (recursively) for the clean, cleandir and distclean targets. <I M> DISTCLEANDIRS Additional directories to remove (recursively) for the cleandir and distclean targets. <I M> mkc.prog.mk The include file mkc.prog.mk handles building program from one or more source files, along with their manual pages. It has a limited number of suffixes. List of supported variables: PROG The name of the program to build. PROGS The names of the programs to build. If neither PROG nor PROGS is not supplied, nothing is built. <M> PROGNAME The name that the above program will be installed as, if different from ${PROG}. <M> SRCS List of source files to build the program. If SRCS is not defined, it's assumed to be ${PROG}.c. <M> SRCS.<prog> List of source files to build the program prog listed in PROGS. If SRCS.<prog> is not defined, it's assumed to be prog.c. <M> LDADD Additional objects. Usually used for libraries. For example, to link with the compatibility and utility libraries, use: LDADD+= -lutil -lcompat <U> LDADD_<project> Similar to LDADD but for project ${PROJECTNAME}. LDFLAGS Additional linker flags. Often used for specifying library directories. LDFLAGS+= -L/opt/company/software/lib <Mu I> LDFLAGS_<project> Similar to LDFLAGS but for project ${PROJECTNAME}. BINDIR, BINMODE, BINOWN and BINGRP See Common variables and mkc.files.mk sections. MKSHARE If "no", act as "MKHTML=no MKINFO=no MKCATPAGES=no MKMAN=no". I.e, don't build catman pages, man pages, info documentation,... <Iu> [yes] MKPIE If "yes", create Position Independent Executable (PIE), otherwise create a regular executable. <Mu> [no] USE_RELRO If "yes", enables a technique to harden the data sections of an ELF binary/process. For security reasons it makes sense to set it to YES, it may slow down application startup, though. <Iu> [no] EXPORT_DYNAMIC If "yes", add all symbols to the dynamic symbol table, that is make all symbols visible from dynamic objects at run time (e.g. dlopen-ed objects), otherwise only symbols referenced by some object file will be exported. <M> [no] mkc.prog.mk includes mkc.files.mk and therefore supports all variables supported by it. mkc.lib.mk The include file mkc.lib.mk has support for building a static or dynanic library. It has a limited number of suffixes. mkc.lib.mk uses the following variables: LIB The name of the library to build. <M> LIBDIR See Common variables and mkc.files.mk sections. SHLIB_MAJOR Major shared library number. If unset, shared library is not built. <M> SHLIB_MINOR Minor shared library number. <M> [0] SHLIB_TEENY Minor shared library number. <M> [] LIBOWN Library owner. If bmake is run by an unprivileged user, it defaults to `id -u`. <Iu> LIBGRP Library group. If bmake is run by an unprivileged user, it defaults to `id -g`. <Iu> LIBMODE Library mode. <Iu> [${NONBINMODE}] SHLIBMODE Shared library mode. <Iu> LDADD LDADD_<project> Additional objects. See mkc.prog.mk LDFLAGS LDFLAGS_<project> Additional linker flags. See mkc.prog.mk MAN The manual pages to be installed (use a .1 - .9 suffix). <M> SRCS List of source files to build the library. Suffix types .s, .c, and .f are supported. Note, .s files are preferred to .c files of the same name. <M> LDCOMPILER If "yes", ${CC} is used for linking instead of ${LD}. For C++ sources ${CXX} is used for linking. <Iu> [yes] MKSHLIB If not "no", build and install shared library provided that SHLIB_MAJOR is defined. <IMu> [yes] (for MACHINE_ARCHs that support it) MKSTATICLIB If not "no", build and install static library. <IMu> [yes] MKPICLIB If not "no", build and install *_pic.a library. <IMu> [no] MKPROFILELIB If "no", don't build or install the profiling (*_p.a) libraries. <Iu> [no] MKDLL If "yes", build and install the dynamically loaded library (<lib>.so) instead of shared library. If "only", do not make static library. <M> [no] EXPORT_SYMBOLS Only symbols listed in a specified file (one symbol per line) are exported. This variable has no effect on some platforms. By default all symbols are exported. <M> [] Libraries are ranlib'd when made. mkc.lib.mk includes mkc.files.mk and therefore supports all variables supported by it. mkc.subprj.mk The include file mkc.subprj.mk handles subprojects (subdirectories) organized as a dependency graph. It provides all targets provided by mkc.prog.mk. Variable SUBPRJ contains a list of pairs depdir:dir which mean that subproject dir depends on depdir. mkcmake all command will build all subprojects listed in SUBPRJ in a correct order (starting with subprojects having no dependencies and so on). There is also a target which allows the command bmake <subdir> where <subdir> is any directory listed in the variable SUBPRJ. The following targets are also provided: <target>-<subdir> where <target> is either of the following: all, clean, cleandir, depend, installdirs, install, uninstall and filelist. Also provided are: targets nodeps-<target>-<subdir> and subdir-<target>-<subdir>. Difference between <target>-<subdir> and nodeps-<target>-<subdir> is that mkcmake <target>-<subdir> runs the specified <target> for <subdir> and all its dependencies while mkcmake nodeps-<target>-<subdir> -- only for <subdir>. A target subdir-<target>-<subdir> is a synonym for nodeps-<target>-<subdir> See examples/hello_dictd subdirectory for the sample of use. SUBPRJ List of subprojects (subdirectories) and dependencies. If the subdirectory doesn't exist the subproject becomes "virtual" and may be used to group several subprojects into a new virtual one. <M> SUBPRJ_DFLT List of projects built and installed by default. The default is all projects listed in SUBPRJ. <IMu> EXPORT_VARNAMES List of variables to export before running make for subdirectories. By default MKC_CACHEDIR variable is exported. As a result cache files for subprojects are created in a top-level directory. <Mu> [MKC_CACHEDIR] NOEXPORT_VARNAMES List of variables excluded from EXPORT_VARNAMES. <Mu> [] NODEPS This variable specifies a list of patterns that describes edges from dependency graph in targdep-prjdep:targ-prj or targ-prj:targ formats to be excluded from dependency graph. <M> [] NOSUBDIR If for some reason you want to exclude some subdirectories from build, list them in this variable. <U> [] OBJDIR_<dir> Value of ${.OBJDIR} inside dir subdirectory. Slash symbols inside <dir> are replaced with underlines. In addition, OBJDIR_<dir:T> variable is set to ${OBJDIR_<dir>} if ${SHORTPRJNAME} is "yes". TARGETS List of recursive targets supported by the project and all its subprojects. <Im> [all, install, installdirs, uninstall, clean, cleandir, depends, test, errorcheck, filelist] By setting this variable in the Makefile one can add new targets for special purposes, for example, static code analysis, partial builds etc. SHORTPRJNAME If "yes", special targets with last component of the subprojects are provided. <Im> [yes] MKRELOBJDIR If "yes", object directories ${TOPOBJ}/dir are used. Unlike MAKEOBJDIRPREFIX object directories do not contain top-level ${.CURDIR} in paths. <Iu> [no] mkc.subdir.mk The include file mkc.subdir.mk contains the default targets for building subdirectories. It provides the same targets as mkc.prog.mk. For all of the directories listed in the variable SUBDIR, the specified directory will be visited and the target made. There is also a default target which allows the command bmake <subdir> where <subdir> is any directory listed in the variable SUBDIR. As a special case, the use of a token .WAIT as an entry in SUBDIR acts as a synchronization barrier when multiple make jobs are run; subdirs before the .WAIT must complete before any subdirs after .WAIT are started. See bmake(1) for some caveats on use of .WAIT and other special sources. SUBDIR variable is provided as well as all variables provided by mkc.subprj.mk except SUBPRJ. SUBDIR List of subdirectories <M> mkc.subprj.mk mkc.configure.mk mkc.configure.mk is an auxiliary include file for checking platform's features like headers, function or variable declarations, function implementation in a particular libraries, data types sizes etc. This include file is included by mkc.prog.mk and mkc.lib.mk automatically but in some cases it makes sense to include it explicitly. mkc.configure.mk supports the following variables. MKCHECKS If "no", none of the checks are performed. It is set to "yes" unless target is "clean", "cleandir or distclean". MKC_CHECK_HEADERS List of headers to be checked. As a result of the check bmake's variable HAVE_HEADER.<header> is set to either 0 or 1. <header>: tr|./|__|g Also -DHAVE_HEADER_<HEADER>=(0 or 1) is added to CFLAGS unless MKC_NOAUTO is set to 1. <HEADER>: tr|a-z./|A-Z__|g Ex: MKC_CHECK_HEADERS += sys/time.h fcntl.h execinfo.h Res: HAVE_HEADER.sys_time_h = 1 HAVE_HEADER.fcntl_h = 1 HAVE_HEADER.execinfo_h = 1 CFLAGS += -DHAVE_HEADER_SYS_TIME_H=1 -DHAVE_HEADER_FCNTL=1 MKC_REQUIRE_HEADERS The same as MKC_CHECK_HEADERS, but absense of header is treated as a fatal error (See errorcheck target. MKC_CHECK_FUNCLIBS List of <function>:<library> pairs to be checked, <library> part is optional. If <library> is present, presense of <function> in libc is also checked automatically. As a result of the check bmake's variable HAVE_FUNCLIB.<function>.<library> (or HAVE_FUNCLIB.<function>) is set to either 0 or 1. By default, if <function> is found in <library> but not in libc, "-l<library>" is automatically added to LDADD unless <function>:<library> is listed in MKC_NOAUTO_FUNCLIBS or MKC_NOAUTO_FUNCLIBS is equal to 1 or MKC_NOAUTO is set to 1 Ex: MKC_CHECK_FUNCLIBS += strlcat fgetln getline getopt_long MKC_CHECK_FUNCLIBS += crypt:crypt dlopen:dl nanosleep:rt MKC_CHECK_FUNCLIBS += ftime:compat gettimeofday MKC_NOAUTO_FUNCLIBS += ftime:compat Res: HAVE_FUNCLIB.strlcat = 1 HAVE_FUNCLIB.fgetln = 1 HAVE_FUNCLIB.getline = 0 HAVE_FUNCLIB.getopt_long = 1 HAVE_FUNCLIB.crypt = 0 HAVE_FUNCLIB.crypt.crypt = 1 HAVE_FUNCLIB.dlopen = 1 HAVE_FUNCLIB.dlopen.dl = 0 HAVE_FUNCLIB.nanosleep = 1 HAVE_FUNCLIB.nanosleep.rt = 1 HAVE_FUNCLIB.ftime = 0 HAVE_FUNCLIB.ftime.compat = 1 HAVE_FUNCLIB.gettimeofday = 1 LDADD += -lcrypt MKC_REQUIRE_FUNCLIBS The same as MKC_CHECK_FUNCLIBS, but absense of funclib is treated as a fatal error (See errorcheck target. MKC_SOURCE_FUNCLIBS The same as MKC_CHECK_FUNCLIBS, but if <function> is absent both in the specified <library> and in libc, function.c is added to SRCS unless MKC_NOAUTO=1. Ex: MKC_SOURCE_FUNCLIBS+= getline Res: SRCS+= getline.c HAVE_FUNCLIB.getline= 0 MKC_CHECK_DEFINES List of define:header to check. <header> part is optional. As a result of the check bmake's variable HAVE_DEFINE.<define>.<header> (or HAVE_DEFINE.<define>) is set to either 0 or 1. <header>: tr|./|__|g Also -DHAVE_DEFINE_<DEFINE>_<HEADER>=1 or -DHAVE_DEFINE_<DEFINE>=1 is added to CFLAGS if the specified define was detected unless MKC_NOAUTO is set to 1. <HEADER>: tr|a-z./|A-Z__|g <DEFINE>: tr|a-z|A-Z|g Ex: MKC_CHECK_DEFINES += RTLD_LAZY:dlfcn.h __GNUC__ _MSC_VER_ Res: HAVE_DEFINE.RTLD_LAZY.dlfcn_h = 1 HAVE_DEFINE.__GNUC__ = 1 HAVE_DEFINE._MSC_VER_ = 0 CFLAGS += -DHAVE_DEFINE_RTLD_LAZY_DLFCN_H=1 \ -DHAVE_DEFINE___GNUC__=1 MKC_REQUIRE_DEFINES The same as MKC_CHECK_DEFINES, but absense of the define is treated as a fatal error (See errorcheck target. MKC_CHECK_TYPES List of type:header to check. <header> part is optional. As a result of the check bmake's variable HAVE_TYPE.<type>.<header> (or HAVE_TYPE.<type>) is set to either 0 or 1. <header>: tr|./|__|g Also -DHAVE_TYPE_<TYPE>_<HEADER>=1 (or -DHAVE_TYPE_<TYPE>=1) is added to CFLAGS if the specified type was detected unless MKC_NOAUTO is set to 1. <HEADER>: tr|a-z./|A-Z__|g <TYPE>: tr|a-z|A-Z|g Ex: MKC_CHECK_TYPES += size_t:string.h Res: HAVE_TYPE.size_t.string_h = 1 CFLAGS += -DHAVE_TYPE_SIZE_T_STRING_H=1 MKC_REQUIRE_TYPES The same as MKC_CHECK_TYPES, but absense of the type declaration is treated as a fatal error (See errorcheck target. MKC_CHECK_VARS List of variable:header to check. <header> part is optional. As a result of the check bmake's variable HAVE_DEFINE.<variable>.<header> (or HAVE_DEFINE.<variable>) is set to either 0 or 1 <header>: tr|./|__|g Also -DHAVE_DEFINE_<VARIABLE>_<HEADER>=1 (or -DHAVE_DEFINE_<VARIABLE>=1) is added to CFLAGS if the specified variable was detected unless MKC_NOAUTO is set to 1. <HEADER>: tr|a-z./|A-Z__|g Ex: MKC_CHECK_VARS += sys_errlist:errno.h Res: HAVE_VAR.sys_errlist.errno_h = 1 CFLAGS += -DHAVE_VAR_SYS_ERRLIST_ERRNO_H MKC_REQUIRE_VARS The same as MKC_CHECK_VARS, but absense of the variable declaration is treated as a fatal error (See errorcheck target. MKC_CHECK_MEMBERS List of <type>.<member>:<header> to check. <header> part is optional. As a result of the check bmake's variable HAVE_MEMBER.<type>_<member>.<header> (or HAVE_MEMBER.<type>_<member>) is set to either 0 or 1 depending on the result. <header>: tr|./|__|g Also -DHAVE_MEMBER_<TYPE>_<MEMBER>_<HEADER>=1 (or -DHAVE_MEMBER_<TYPE>_<MEMBER>=1) is added to CFLAGS if the specified member was found in appropriate type unless MKC_NOAUTO is set to 1. <HEADER>: tr|a-z./|A-Z__|g <TYPE>: tr|a-z./|A-Z__|g <MEMBER>: tr|a-z./|A-Z__|g Ex: MKC_CHECK_VARS += struct-ifreq.ifr_ifrn.ifrn_name:net/if.h MKC_CHECK_VARS += struct-tm.tm_isdst:time.h Res: HAVE_MEMBER.struct_ifreq_ifr_ifrn_ifrn_name.net_if_h=1 HAVE_MEMBER.struct_tm_tm_isdst.time_h=1 CFLAGS += -DHAVE_MEMBER_STRUCT_IFREQ_IFR_IFRN_IFRN_NAME_NET_IF_H=1 CFLAGS += -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1 MKC_REQUIRE_MEMBERS The same as MKC_CHECK_MEMBERS, but absense of the member is treated as a fatal error (See errorcheck target. MKC_CHECK_FUNCS<N> List of <func>:<header> to be check. <header> part is optional. As a result of the check bmake's variable HAVE_FUNC<N>.<func>.<header> (or HAVE_FUNC<N>.<func>) is set to either 0 or 1. <header>: tr|./|__|g Also -DHAVE_FUNC<N>_<FUNC>_<HEADER>=(0 or 1) (or -DHAVE_FUNC<N>_<FUNC>=(0 or 1)) is added to CFLAGS if the specified function was detected unless MKC_NOAUTO is set to 1. <HEADER>: tr|a-z./|A-Z__|g Ex: MKC_CHECK_FUNCS2 += fgetln:stdio.h MKC_CHECK_FUNCS6 += pselect:sys/select.h Res: HAVE_FUNC2.fgetln.stdio_h = 1 HAVE_FUNC6.pselect.sys.select_h = 1 CFLAGS += -DHAVE_FUNC2_FGETLN_STDIO_H=1 \ += -DHAVE_FUNC6_PSELECT_SYS_SELECT_H=1 MKC_REQUIRE_FUNCS<N> The same as MKC_CHECK_FUNCS<N>, but absense of the function declaration is treated as a fatal error (See errorcheck target. MKC_CHECK_CUSTOM A list of custom checks (list of names). MKC_CUSTOM_FN.<custom_check_name> is a "C", "C++" or "Fortran" source filename or an executable program for your custom check, e.g., filename.c, filename.cc, subdir/filename.cxx, filename.C, filename.cpp, mychecks/filename.f or subdir/executable_script. mk-configure tries to compile or run the specified file and sets CUSTOM.<custom_check_name> variable to 1, 0 or other value. If MKC_CUSTOM_FN.<custom_check_name> is unset, it defaults to custom_check_name.c Also -DCUSTOM_<CUSTOM_CHECK_NAME>=1 is added to CFLAGS if the specified check succeeded unless MKC_NOAUTO is set to 1. <CUSTOM_CHECK_NAME>: tr|a-z|A-Z|g Ex. MKC_CHECK_CUSTOM+= nested_funcs MKC_CUSTOM_FN.nested_funcs= nested_funcs.c MKC_CUSTOM_FN.script_check= checks/script_check Res. CUSTOM.nested_funcs= 1 CUSTOM.script_check= 0 CFLAGS+= -DCUSTOM_NESTED_FUNCS=1 Note that script for the check should be an executable file. MKC_REQUIRE_CUSTOM The same as MKC_CHECK_CUSTOM, but failure is treated as a fatal error (See errorcheck target. 0 and empty value of CUSTOM.xxx means failure. MKC_CUSTOM_DIR Directory with custom checks source files. See MKC_CHECK_CUSTOM. It defaults to ${.CURDIR}. MKC_CHECK_BUILTINS mk-configure provides a number of built-in custom checks, that is, source files to compile or scripts to run in order to check for something. Checks listed in MKC_CHECK_BUILTINS will be run. Avalable values: prog_flex, prog_bison, prog_gawk, prog_gm4 Find flex, bison, GNU awk or GNU m4 by analysing program's help and/or version messages. If found, BUILTIN.prog_<progname> is set to a path, otherwise it is set to an empty string. Note that gawk may be found as awk, bison as yacc, gm4 as m4 and flex as lex. prog_mkdep, prog_nbmkdep Find traditional BSD mkdep(1) or recent NetBSD version of it respectively. endianess BUILTIN.endianess variable is set to either little, big or unknown depending on a hardware. MKC_CHECK_PROGS List of <progname>s to check. As a result of the check bmake's variable HAVE_PROG.<progname> is set to either 1 (true) or 0 (false). Also PROG.<progname> is set to a full path of a program or to an empty string. Ex: MKC_CHECK_PROGS += lua ruby gawk runawk Res: HAVE_PROG.lua = 1 PROG.lua = /usr/pkg/bin/lua HAVE_PROG.ruby = 0 HAVE_PROG.gawk = 1 PROG.gawk = /usr/bin/gawk HAVE_PROG.runawk = 1 PROG.runawk = /usr/pkg/bin/runawk If MKC_PROG.id.<progname> is set to, e.g, <prog_id>, then HAVE_PROG.<prog_id> and PROG.<prog_id> are set. MKC_PROG.id.<progname> also changes cache file names. MKC_REQUIRE_PROGS The same as MKC_CHECK_PROGS, but absense of program is treated as a fatal error (See errorcheck target). MKC_CHECK_SIZEOF List of <type>:<header> to check. <header> part is optional. As a result of the check bmake's variable SIZEOF.<type>.<header> (or SIZEOF.<type>) is set to the data type size or string "failed". <type>: tr|*-|P_|g <header>: tr|/.|__|g Also -DSIZEOF_<TYPE>_<HEADER>=<failed|1|2|...> (or -DSIZEOF_<TYPE>=<failed|1|2|...>) is added to CFLAGS if sizeof() check was successful unless MKC_NOAUTO is set to 1 <TYPE>: tr|a-z*-|A-ZP_|g <HEADER>: tr|a-z/.|A-Z__|g Ex: MKC_CHECK_SIZEOF += void* MKC_CHECK_SIZEOF += long-long off_t:sys/types.h Res: SIZEOF.voidP = 4 SIZEOF.long_long = 4 SIZEOF.off_t.sys_types_h = 8 CFLAGS += -DSIZEOF_VOIDP=4 \ -DSIZEOF_LONG_LONG=4 \ -DSIZEOF_OFF_T_SYS_TYPES_H=8 MKC_NOAUTO_FUNCLIBS See MKC_CHECK_FUNCLIBS MKC_NOAUTO See MKC_CHECK_{HEADERS,FUNCLIBS,FUNCS,VARS,DEFINES,SIZEOF}. MKC_COMMON_HEADERS List of header files always #include'd to the test .c file in MKC_CHECK_{DEFINES,VARS,FUNCS<N>,SIZEOF} checks. The default value is an empty list. Ex: MKC_COMMON_HEADERS += unistd.h stdlib stdio.h string.h MKC_CHECK_SIZEOF += offs_t size_t ssize_t MKC_COMMON_DEFINES List of defines always passed to compiler in MKC_CHECK_{DEFINES,VARS,FUNCS<N>,SIZEOF} checks. Ex: MKC_COMMON_DEFINES += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 # Linux MKC_COMMON_DEFINES += -D_ALL_SOURCE # Interix MKC_COMMON_DEFINES.<OPSYS> The same as MKC_COMMON_DEFINES but only for OPSYS (uname -s). Ex: MKC_COMMON_DEFINES.Linux += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 MKC_COMMON_DEFINES.Interix += -D_ALL_SOURCE MKC_CACHEDIR Directory where intermediate and cache files are created. It defaults to ${.OBJDIR}. MKC_SHOW_CACHED Setting it to 0 will hide Checking ... (cached) ... messages, that is, messages about fetching results from cache files. MKC_DELETE_TMPFILES If set to 1, temporary files are removed. MKC_NOCACHE All results are cached unless MKC_NOCACHE variable is set non-empty value mkc_imp.scripts.mk mkc_imp.scripts.mk is internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly! It provides installing and uninstalling the scripts. The following variables are provided: SCRIPTS A list of interpreter scripts (written in shell, awk, lua etc). These are installed like programs. <M> SCRIPTSNAME The name that the above program will be installed as, if different from ${SCRIPTS}. <Mu> SCRIPTSNAME_<script> Optional name to install <script> as. If <script> has a form <subdir>/<filename>, SCRIPTSNAME_<subdir>_<filename> is used. <Mu> SCRIPTSDIR Target directory for scripts. <Iu> [${BINDIR}] SCRIPTSDIR_<script> Optional directory to install <script> to. If <script> has a form <subdir>/<filename>, SCRIPTSDIR_<subdir>_<filename> is used. <Mu> SCRIPTSOWN Script files owner. <Iu> [${BINOWN}] SCRIPTSGRP Script file group. <Iu> [${BINGRP}] SCRIPTSMODE Script file mode. <Iu> [${BINMODE}] mkc_imp.lua.mk mkc_imp.lua.mk is internal include file which is included from mkc.prog.mk and mkc.lib.mk. Do not use it directly. It provides support for Lua programming language, i.e. building and installing Lua- and/or C-based modules. The following variables are provided: LUA_MODULES List of Lua modules to build and install. Dot in the module name separates a dirname from basename. That is, actual .lua file names are made of LUA_MODULES with dots replaced with undeline symbol. At installation time dots are replaced with slash. For example, if LUA_MODULES=socket.foo, then socket_foo.lua will be installed to ${LUA_LMODDIR}/socket/foo.lua <M> LUA_LMODULES Deprecated. Filenames of Lua modules. Use LUA_MODULES instead. <M> LUA_CMODULE Compiled Lua module written in, e.g., C or C++. Dot in the module name separates a dirname from basename. That is, actual .c file names are made of LUA_MODULES with dots replaced with undeline symbol. At installation time dots are replaced with slash. For example, if LUA_CMODULES=socket.foo, then socket_foo.c will be used for compiling a module and will be installed to ${LUA_CMODDIR}/socket/foo.so. <M> SRCS List of source files to build the LUA_CMODULE. SRCS defaults to ${LUA_CMODULE:S|.|_|g}.c. <M> LUA_LMODDIR Directory for Lua modules written in Lua. It is assigned with a help of pkg-config --variable=INSTALL_LMOD lua command and can be overriden by user. <Iu> LUA_CMODDIR Directory for compiled Lua modules written in, e.g., C or C++. It is assigned with a help of pkg-config --variable=INSTALL_CMOD lua command and can be overriden by user. <Iu> mkc_imp.intexts.mk mkc_imp.intexts.mk is internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly. It provides conversion of <fn>.in files to <fn> by expanding the following @@ patterns: Pattern Result ---------------------- /usr ${PREFIX} /usr/bin ${BINDIR} /usr/share/man ${MANDIR} /usr/sbin ${SBINDIR} /usr/lib ${LIBDIR} /usr/libexec ${LIBEXECDIR} /usr/share ${DATADIR} /etc ${SYSCONFDIR} /usr/include ${INCSDIR} The following variables are provided: INFILES List of files to generate. <M> INSCRIPTS List of scripts to generate. <M> INTEXTS_REPLS List of Pattern/Replacement pairs separated by space, e.g. INTEXTS_REPLS+= version ${VERSION} INTEXTS_REPLS+= author_email ${AUTHOR_EMAIL} <M> INTEXTS_SED List of additional sed(1) expressions for expanding, e.g. INTEXTS_SED+= -e 's,0.25.0,${VERSION},g' <M> mkc_imp.info.mk mkc_imp.info.mk is internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly! This module provides creation of .info files from .txi, .texi and .texinfo sources and provides the following variables: MKINFO If "no", don't build or install Info documentation from Texinfo source files. <Iu> [yes] TEXINFO List of Texinfo source files. Info documentation will consist of single files with the extension replaced by .info. <M> INFOFLAGS Flags to pass to makeinfo. [] <Iu> mkc_imp.man.mk mkc_imp.man.mk is internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly! This module provides installation of manual pages and creation of catpages and HTML pages and provides the following variables: MANDIR Target directory for man pages. <Iu> [${PREFIX}/man] USETBL If not "no", preprocess man pages using tbl(1) while generating cat pages. <IM> [no] MANZ If not "no", compress manual pages at installation time. <Iu> [no] MAN Manual pages (should end in .1 - .9). If no MAN variable is defined, "MAN=${PROG}.1" is assumed if it exists. <M> MKMAN If "no", don't build or install the man pages, and also acts as "MKCATPAGES=no MKHTML=no". <Iu> [yes] MKCATPAGES If "no", don't build or install the catman pages. <Iu> [no] MKHTML If "no", don't build or install the HTML man pages. <Iu> [no] HTMLDIR Target directory for html pages generated from man pages. <Iu> [${MANDIR}] MLINKS List of manual page links (using a .1 - .9 suffix). The linked-to file must come first, the linked file second, and there may be multiple pairs. The files are hard-linked. <M> mkc_imp.links.mk mkc_imp.links.mk is internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly! This module provides creation of hard and symbolic links and provides the following variables: LINKS The list of binary links; should be full pathnames, the linked-to file coming first, followed by the linked file. The files are hard-linked. For example, to link ${BINDIR}/gzip and ${BINDIR}/gunzip, use: LINKS= ${DESTDIR}/bin/gzip ${DESTDIR}${BINDIR}/gunzip <M> SYMLINKS The list of symbolic links; should be full pathnames. Syntax is identical to LINKS. Note that DESTDIR is not automatically included in the link. <M> mkc_imp.inc.mk mkc_imp.inc.mk is internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly! This module provides installation of header files and provides the following variables: INCSDIR Target directory for includes. <Iu> [${PREFIX}/include] INCS The list of include files. <M> INCSNAME Target name of the include file, if only one; same as FILESNAME, but for include files. <M> INCSNAME_<file> The name file <file> should be installed as, if not <file>, same as FILESNAME_<file>, but for include files. <Mu> INCSSRCDIR Source directory for include files. This variable have an influence on CPPFLAGS (-I${INCSSRCDIR} is added) and on an installation of include files (paths in ${INCS} are relative to ${INCSSRCDIR}). <M> [.] mkc.minitest.mk mkc.minitest.mk is an auxiliary include file that implement simple framework for unit tests. Idea: application provides the target test_output and expect.out file that contains ideal output. "bmake test" runs "bmake test_output" and compare generated output with expect.out. TEST_PREREQS Prerequisites for target "test". <Iu> [all] mkc_imp.pkg-config.mk mkc_imp.pkg-config.mk is internal include file which is included from mkc.prog.mk and mkc.lib.mk. Do not use it directly! This module supports dependencies controlled by pkg- config program. As a result CPPFLAGS and LDADD variables are modified according to "pkg- config --cflags ..." and "pkg-config --libs ...". The following variables are provided: PKG_CONFIG_DEPS List of dependency libraries. Spaces around <=, >=, =, < and > are not allowed. <M> PKG_CONFIG.exists.<lib> If "1", <lib> exists, "0" otherwise. Inside <lib> <=, >=, =, < and > and replaced with _le_, _ge_, _eq_, _lt_ and _gt_ respectively. <Iu> PKG_CONFIG_VARS.<lib> List of variables to check for library <lib>. <M> PKG_CONFIG.var.<lib>.<var> Variable value (pkg-config --variable=<var> <lib>). <Iu> PCNAME.<lib> On some systems several versions of the same library may be installed to differet directories (for example liblua for Lua 5.1 and 5.2). In order to avoid conflicts between them pc name is changed (for example, lua5.1 and lua5.2 instead of lua). This variable is a map from library name to pc name. <Iu> [${lib}] mkc_imp.pod.mk mkc_imp.pod.mk is internal include file which is included from mkc.prog.mk and mkc.lib.mk. Do not use it directly! It provides support for POD (Plain Old Documentation) markup language, i.e. convertion of POD documents to MAN pages (suffix rules: .pod.1, ... , .pod.9) and HTMLs (.pod.html). The following variables are provided: POD2MAN Path to POD to MAN conversion utility <Iu> [pod2man]. POD2MAN_FLAGS Flags passed to ${POD2MAN} <Iu> [-r '' -n '${.TARGET:T:R}' -c '']. POD2HTML Path to POD to HTML conversion utility <Iu> [pod2html]. POD2HTML_FLAGS Flags passed to ${POD2HTML} <Iu> []. mkc_imp.dep.mk mkc_imp.dep.mk is internal include file which is included from mkc.prog.mk and mkc.lib.mk. Do not use it directly! This include file contains the default targets for building .depend files. It creates .d files from entries in SRCS and DPSRCS that are C, C++, or Objective C source files, and builds .depend from the .d files. All other files in SRCS and all of DPSRCS will be used as dependencies for the .d files. The following variables are provided: SRCS The same as in mkc.prog.mk and mkc.lib.mk. DPSRCS List of source files which are needed for generating dependencies, but are not needed in ${SRCS}.
CROSS COMPILATION
The following variables are used for compiling software using cross-rools. SYSROOT Root directory for headers and libraries. If set, the following variables are set to ${TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}<toolname>: AR, AS, CXX, CPP, CC, INSTALL, LD, NM, OBJCOPY, OBJDUMP, RANLIB, SIZE and STRIP. <U> []. TOOLCHAIN_DIR Directory that contains cross-toolchain. <U> [${TOOLDIR}/bin]. TOOLCHAIN_PREFIX See SYSROOT. <U> [${MACHINE_GNU_PLATFORM}-].
ENVIRONMENT VARIABLES
MAKECONF Path to mk.conf file .include-ed by mkc.*.mk files
FILES
/etc/mk.conf .include-ed by mkc.*.mk if exists /etc/mk.conf .include-ed by mkc.*.mk if exists
BUGS
Target errorcheck (configure) doesn't support parallel builds. In order to build project in parallel, run it like the following mkcmake errorcheck mkcmake -j4 all
SEE ALSO
mkc_check_header(1), mkc_check_prog(1), mkc_check_decl(1), mkc_check_funclib(1), mkc_check_sizeof(1), mkc_check_custom(1), bmake(1), mkdep(1),
AUTHOR
Aleksey Cheusov <vle@gmx.net> Dec 1, 2013 MK-CONFIGURE(7)