MK-CONFIGURE(7)
β¨ NAME β¨
MK-CONFIGURE(7) β hi bestie, this is the page for mk-configure, the lightweight replacement for GNU autotools. That's the whole name section, short and iconic. π
πΈ DESCRIPTION πΈ
Okay so picture this: mk-configure is a collection of include files for bmake (that's the portable version of NetBSD make, iykyk) plus a whole bunch of executables. Its whole personality? Making crossplatform development and software building so much simpler for you. π
There are only a few top-level makefiles, and they are: mkc.init.mk, mkc.mk, mkc.configure.mk, mkc.minitest.mk. Everything else (the mkc_imp.*.mk files) gets included implicitely. Do not use mkc_imp.*.mk files directly! Like, genuinely don't. If you do, I cannot guarantee backward compatibility. π
mkc.configure.mk is included automatically by mkc.mk, but can be included explicitely. mkc.minitest.mk provides a trivial support for regression tests and should be included explicitely.
Usually mk-c makefiles consist of variables assignments and inclusion of mkc.mk in the and. β¨
You can also use mkc.prog.mk, mkc.lib.mk, mkc.files.mk, mkc.subdir.mk and mkc.subprj.mk instead of mkc.mk. Here's the tea on how the latter picks: it activates mkc.lib.mk if variable LIB is set, mkc.prog.mk if variables PROG or PROGS are set, mkc.subprj.mk if variable SUBPRJ is set, mkc.subdir.mk if variable SUBDIR is set, and mkc.files.mk otherwise.
To get system-wide configuration parameters, mkc.init.mk loads "${MAKECONF}" file if it exists. Otherwise, it loads /etc/mkcmake.conf if it exists. If neither ${MAKECONF} nor /etc/mkcmake.conf exist, it tries to load /etc/mk.conf file. If "${SRCTOP}/Makefile.common" file exists it is also included by all subprojects. Unless SRCTOP variable is set, "../Makefile.inc" is also included if exists. These files may define any of the variables described below. Compiler-specific defaults are also loaded from "~/.mkcmake" or system directories. This compiler-specific defaults are determined at build time or with the help of mkc_compiler_settings utility. π§
Below in square brackets the default value for variables are specified. In triangle brackets β the typical way of use, where:
Imeans "Initialized by mk-configure"Iumeans "Initialized by mk-configure but may be overriden by user"Immeans "Initialized by mk-configure but may be set in Makefile"Umeans "Usually set by user"Mmeans "May be set or changed in project's Makefile"Mumeans "May be set in project's Makefile but may be initialized or overriden by user"
Variable MKCMAKE is always 1 in mkcmake. No cap. π«Ά
π― Targets
Mk-configure provides the following targets:
allβ build everything. ποΈcleanβ clean temporary files and directories with the help of${CLEANFILES_CMD}and${CLEANDIRS_CMD}commands.cleandirβ remove all of the files removed by the targetclean, as well as cache files created bymkc.configure.mk.installdirsβ create target directories.installβ install programs, libraries, files, include files, manual pages etc. to the target directories with the help of${INSTALL}program.uninstallβ remove installed files with the help of${UNINSTALL}command.configureβ check forMKC_ERR_MSGvariable and fails if it set printing an error messagedependβ create.depend_${.CURDIR:T}file containing list of dependencies (seemkdep(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β ifMKOBJDIRis"yes", creates object directories (${.OBJDIR}) according toMAKEOBJDIRandMAKEOBJPREFIXvariables. Current umask is used for this.mkgenβ Seemkc_imp.foreign_autotools.mk.bin_tar,bin_targz,bin_tarbz2,bin_zip,bin_debβ build software, install it to a temporary directory (usingDESTDIR) and create.tar/.tar.gz/.tar.bz2/.zip/.debarchive containing all installed files. The targetbin_debexpects debian control files inDEBIANsubdirectory, seeexamples/filesfor the sample.
NOTE: Commands associated with targetsall,install,clean,cleandir,depend,test,installdirs,uninstall,configureandfilelistin Makefile override the standard behaviour.
NOTE: All targets in this list havepre_*,do_*andpost_*counterparts. SeeALLTARGETSfor details.
π§ mkc.init.mk
This file is included by mkc.mk and mkc.configure.mk automatically but can be used by users directly. mkc.init.mk uses the following variables. π
AFLAGSβ Options to${CC}when compiling or linking.sor.Sassembly source files.[]ARβ Create, modify, and extract from archives.<Iu>[ar]ARFLAGSβ Options to${AR}.<Iu>[rl]ASβ Assembler.<Iu>[as]BINDIRβ Target directory for utilities.<Iu Mu>[${PREFIX}/bin]BMAKE_REQDβ Minimal required version ofbmake. If it is older,mkcmakeexits with error.<Im>BZIP2βbzip2copression tool.<Iu>[bzip2]CCβ C compiler.<Iu>[cc]CC_PREFIXβ Prefix command for${CC}, for example,distccorccache.<Iu>[]CC_TYPEβ C compiler type. This variable is set by mk-configure and can be overriden by user. It can get the following values:gccβ GNU C/C++ compilerpccβ Portable C compilericcβ Intel C/C++ compilermscβ Microsoft C/C++ compilerarmccβ ARM C/C++ compilerhpcβ HP-UX C/C++ compilersunproβ SUNWspro C/C++ compileribmcβ IBM C/C++ compiler (Visual Age for C/C++?)bccβ Borland C/C++ compilerwatcomβ Watcom C/C++ compilercomoβ COMO C/C++ compilerdeccβ DEC Cmipsproβ MIPSpro C compiler
<Iu> [no]
CC_VERSIONβ C compiler version.<I>CCSTDβ Add C language standard command line option to the compiler. Supported options:c89,gnu89(C89 with GNU extensions),c99,gnu99(C99 with GNU extensions),c11,gnu11(C89 with GNU extensions),c17,gnu17(C17 with GNU extensions). If compiler is not known for mk-configure or does not support appropriate option, no additional options are applied.<M>[]CFLAGSβ Additional flags to the compiler when creating C objects.<IM>CFLAGS0β The same asCFLAGSbutCFLAGS0is passed to the compiler beforeCFLAGS. Normally,CFLAGS0should be modified in makefiles and should not be set from environment by user.<M>CFLAGS.checkβ Same asCFLAGSbut every option is checked whether it is a valid one for C compiler. Double underline in the flag is considered as a single space character.<M>[unset]CFLAGS.dflt,CXXFLAGS.dfltβ Additional flags passed to C or C++ compilers.<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-fpicinstead of-fPICwith GNU C/C++ compilers. SeeSHLIB_MAJOR,MKPIEetc. 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-fpicinstead of-fPICwith GNU C/C++ compilers. SeeMKPIEvariable for more information.<Iu>CFLAGS.ssp,CXXFLAGS.sspβ Options for C and C++ compilers for generating stack protection code. SeeUSE_SSPvariable for more information.<Iu>CFLAGS.warns.<warn-level>,CXXFLAGS.warns.<warn-level>β These variables are set by mk-configure and enable warnings for C or C++ compilers according to warning level (WARNS).<Iu>CFLAGS_<project>β Similar toCFLAGSbut for project${PROJECTNAME}.<U>CFLAGS_<source>β Similar toCFLAGSbut for the specified source file. Basename of the source file is used.<Mu>CLEANDIRS_CMDβ Command for removing directories used by targets"clean"and"cleandir".<Iu>[${RM} -rf]CLEANFILES_CMDβ Command for removing files used by targets"clean"and"cleandir".<Iu>[${RM} -f]COPTSβ Additional flags to the compiler when creating C objects.<U>COPTS_<project>β Similar toCOPTSbut for project${PROJECTNAME}.<U>CPPβ C Pre-Processor.<Iu>[cpp]CPPFLAGSβ Additional flags to the C/C++ pre-processor.<Iu>CPPFLAGS0β The same asCPPFLAGSbutCPPFLAGS0is passed to the compiler beforeCPPFLAGS. Normally,CPPFLAGS0should be modified in makefiles and should not be set from environment by user.<M>CPPFLAGS_<project>β Similar toCPPFLAGSbut for project${PROJECTNAME}.<U>CPPFLAGS_<source>β Similar toCPPFLAGSbut for the specified source file. Basename of the source file is used.<Mu>CXXβ C++ compiler.<Iu>[c++]CXX_PREFIXβ Prefix command for${CXX}, for example,distccorccache.<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 asCC_TYPEvariable.<Iu>CXX_VERSIONβ C++ compiler version.<I>CXXFLAGSβ Additional flags to the compiler when creating C++ objects.<Iu>[]CXXFLAGS0β The same asCXXFLAGSbutCXXFLAGS0is passed to the compiler beforeCXXFLAGS. Normally,CXXFLAGS0should be modified in makefiles and should not be set from environment by user.<M>CXXFLAGS.checkβ Same asCXXFLAGSbut every option is checked whether it is a valid one for C++ compiler.<M>[unset]CXXFLAGS_<project>β Similar toCXXFLAGSbut for project${PROJECTNAME}.<U>CXXFLAGS_<source>β Similar toCXXFLAGSbut for the specified source file. Basename of the source file is used.<Mu>CXXOPTSβ Additional flags to the compiler when creating C++ objects.<U>CXXOPTS_<project>β Similar toCXXOPTSbut for project${PROJECTNAME}.<U>CXXSTDβ bestie, this one tells the compiler and the linker which C++ standard to live by.<M>[]
The supported values are c++98, gnu++98 (C++98 with GNU extensions), c++11, gnu++11 (C++11 with GNU extensions), c++14, gnu++14 (C++14 with GNU extensions), c++17, gnu++17 (C++17 with GNU extensions).
If the compiler isn't one mk-configure knows about, or it just doesn't support the option you asked for, then no additional options get applied. Like, nothing happens. No drama, no flags. π
DATADIRβ where architecture-independent text files go.<Iu>${PREFIX}/shareDESTDIRβ the installation prefix.<U>[]GZIPβ the gzip compression tool.<Iu>gzipINCSDIRβ target directory for header files.<Iu>${PREFIX}/includeINFODIRβ target directory for.infofiles.<Iu>${PREFIX}/infoINSTALLβ theinstall(1)command.<Iu>installormkc_installINSTALL_FLAGSβ flags passed to the${INSTALL}program.<Iu>-cLDβ the linker.<Iu>ldLD_TYPEβ the linker type. mk-configure sets this one for you, but you're fully allowed to override it. It can be any of these icons β¨:aixldβ AIX linkerdarwinldβ Darwin linker (MacOS-X)gnuldβ GNU linkerhpldβ HP-UX linkerinterixldβ Interix linkerscoldβ SCO linkersunldβ SunOS linkerosf1ldβ OSF1 linker (Tru64)irixldβ IRIX linker
<Iu>
LEXβ the lexical analyzer.<Iu>lexLEXLIBβ object file for lex.<Iu>-llLFLAGSβ options to${LEX}.<Iu>[]LIBDIRβ target directory for libraries.<Iu>${PREFIX}/libLIBEXECDIRβ target directory for system utilities.<Iu>${PREFIX}/libexecLNβ theln(1)tool.<Iu>lnLN_Sβ a tool equivalent toln -s.<Iu>${LN} -sLORDERβ lists dependencies for object files.<Iu>lorderLPREFIXβ symbol prefix for${LEX}(peep the-Poption inlex(1)).<Iu>yy<Iu>yyβ yeah, the default is listed twice in the original and we're preserving that energy fr fr πMAKEβbmake(1).bmake, ormakeon NetBSD.MAKEDEPENDβ themakedepend(1)tool.<Iu>MKC_ERR_MSGβ if it's set, keep an error message.<I M>[]MKC_REQDβ the minimal required version of mk-configure. If that required version isn't found,mkcmakefails π. Set this variable beforemkc.init.mkgets included, whether directly or indirectly.<M>MKC_VERSIONβ the version of mk-configure. This one is always set to a non-empty value whenever themkc.*.mkinclude files are used, so you can absolutely use it to initialize your mk-c variables inmk.conf. Obsessed, honestly. Example:
/etc/mk.conf:
...
.ifdef MKC_VERSION
COPTS?= -O2 -Werror
SHRTOUT= yes
.endif # MKC_VERSION
<I>
MKCOMPILERSETTINGSβ okay so here's the lore π«Ά. At build time, mk-configure sniffs out some compiler capabilities and saves them into system-wide files:mkc_imp.cc_${CC_TYPE}-${CC_VERSION}-${CC_TRIPLET}.mk(for the C compiler) andmkc_imp.cxx_${CXX_TYPE}-${CXX_VERSION}-${CXX_TRIPLET}.mk(for the C++ compiler). At run time, mk-configure loads those files whenever it needs them. If they're absent β meaning you're using compilers mk-configure has never met β it exits with an error. To fix that, you have to run themkc_compiler_setting(1)utility manually, which generates similar files in the${HOME}/.mkcmakedirectory.
But here's the slay: if MKCOMPILERSETTINGS is set to yes, then mkc_compiler_setting(1) is run automatically and mk-configure loads the freshly generated files. And if MKCOMPILERSETTINGS is set to force, the compiler configuration file is always regenerated. Also note: the triplet component of the compiler configuration file name may be absent for some compilers. <Iu> no
MKDEPβ themkdep(1)tool.<Iu>MKDEPENDβ if you set this toyesand the compiler supports the-MMDor-MDoptions, those options get applied and.ddependency files get generated. Those.dfiles are automatically loaded bymkcmake, so you can keep developing continuously without ever explicitly calling thedependtarget. Iconic.<U>[]MKDIRβ themkdir(1)tool.<Iu>mkdirMKINSTALLβ if it's notyes, build everything but don't install anything. Super useful for, like, internal libraries.<Mu>yesMKINSTALLDIRSβ ifyes, install the target directories (that's theinstalldirstarget) before installing files (theinstalltarget).<Iu>yesMKOBJDIRβ ifyes, theobjtarget creates object directories; ifauto, object directories get created automatically; otherwise object directories are simply not created at all.<Iu>autoNMβ list symbols from object files.<Iu>nmOBJCOPYβ copy and translate object files.<Iu>objcopyOBJDUMPβ display information from object files.<Iu>objdumpOBJTOPβ top-level object directory, which defaults to${.OBJDIR}if${.MAKE.LEVEL}is0.<I>PREFIXβ the target directory.<U>/usr/localPROJECTNAMEβ the name of a project. By default it's set to${PROG},${LIB}or${.CURDIR:T}. For a top-level project using eithermkc.subdir.mkormkc.subprj.mk, it genuinely makes sense to set this variable explicitly in the project'sMakefile. This variable is initialized beforemk.confis included, so you can use it to change build options β like, say, during the development process. Cheat code vibes:
/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>
RANLIBβ generate an index to an archive.<Iu>ranlibRMβ therm(1)tool.<Iu>rmSBINDIRβ target directory for administration utilities.<Iu>${PREFIX}/sbinSHAREDSTATEDIRβ target directory for modifiable architecture-independent data files.<Iu>${PREFIX}/comSHRTOUTβ if it's notno, the messages about compiling, linking and creating libraries get shortened and formatted.<Iu>noSIZEβ list section sizes and total size.<Iu>sizeSRC_PATHADDβ a list of directories added to.PATH.<Im>[]SRCTOPβ top-level project's directory, which defaults to${.CURDIR}if${.MAKE.LEVEL}is0. If it's set,"../Makefile.inc"is not included. Also, this command:
mkcmake -C subproject target
gets translated into:
cd ${SRCTOP}; mkcmake target-subproject
<Iu>
STRIPβ discard symbols from object files.<Iu>stripSTRIPFLAGβ the flag passed to the install program to make the binary get stripped.<Iu>SYSCONFDIRβ target directory for configuration files.<Iu>${PREFIX}/etcTARβ the tar archiver.<Iu>tarTSORTβ topological sort of a directed graph.<Iu>tsort -qUNINSTALLβ the command used for removing files, used by the"uninstall"target.<Iu>${RM} -fUSE_SSPβ ifyes, enables stack protection code, which detects stack overflows and aborts the program. This enhances security but imposes some performance penalty.<U>VARDIRβ target directory for modifiable single-machine data files.<Iu>${PREFIX}/varWARNERRβ ifyes, force warnings to be reported as errors. At the moment this is supported for GCC, clang, Intel C/C++ and Sun's C/C++ compilers.<Iu>yes if WARNS=4, no otherwiseWARNSβ crank up those warning options, bestie; the distinct levels go like this (the higher the number, 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 a feature is provided by the compiler and by mk-configure. <Mu> 0
YACCβ LALR(1) parser generator.<Iu>yaccYFLAGSβ options to${YACC}.<Iu>[]YHEADERβ if it's defined,"-d"gets added toYFLAGS, dependencies from<file>.yto<file>.hand<file>.cget added, and<foo>.hgets added toCLEANFILES.YPREFIXβ if it's defined,"-p ${YPREFIX}"gets added toYFLAGS.ZIPβ the zip compression tool.<Iu>zip
π mkc.files.mk
The include file mkc.files.mk handles the FILES variable, and it gets included from mkc.lib.mk and mkc.prog.mk. Here's the list of supported variables, cutie π«Ά:
CLEANDIRDIRSβ additional directories to remove (recursively) for thecleandirtarget.<I M>CLEANDIRFILESβ additional files to remove for thecleandirtarget.<I M>CLEANDIRSβ additional directories to remove (recursively) for thecleanandcleandirtargets.<I M>CLEANFILESβ additional files to remove for thecleanandcleandirtargets.<I M>FILESβ the list of files to install.<M>FILESDIRβ the location to install the files.<Mu>${PREFIX}/binFILESDIR_<fn>β the location to install the specific file <fn>.<Mu>FILESGRPβ file group. Ifbmakeis run with root privileges, it defaults to<Mu>FILESGRP_<fn>β file group of the specific file <fn>.<Mu>${BINGRP}or to`id -g`otherwise.<Mu>FILESMODEβ file mode.<Mu>${NONBINMODE}FILESMODE_<fn>β file mode of the specific file <fn>.<Mu>FILESNAMEβ an optional name to install each file as.<Mu>FILESNAME_<fn>β an optional name to install <fn> as.<Mu>FILESOWNβ file owner. Ifbmakeis run with root privileges, it defaults to${BINOWN}, or to`id -u`otherwise.<Mu>FILESOWN_<fn>β file owner of the specific file <fn>.<Mu>
π mkc.prog.mk
The include file mkc.prog.mk handles building a program from one or more source files, along with their manual pages. It has a limited number of suffixes. List of supported variables, let's gooo:
DPINCDIRSβ seeLIBDEPSin sectionmk.subprj.mk.DPLDADDβ seeLIBDEPSin sectionmk.subprj.mk.DPLIBDIRSβ seeLIBDEPSin sectionmk.subprj.mk.EXPORT_DYNAMICβ ifyes, add all symbols to the dynamic symbol table β that is, make all symbols visible from dynamic objects at run time (think dlopen-ed objects). Otherwise only symbols referenced by some object file will be exported.<M>noLDADDβ extra objects to link in, and yeah bestie, nine times outta ten this is where your libraries go π«Ά like if you wanna link the compat and util libs, you literally just:
LDADD+= -lutil -lcompat
<U>
LDADD0β same energy asLDADD, exceptLDFLAGS0andLDADD0get yeeted at the linker beforeLDFLAGSandLDADD.<M>LDADD_<project>β basicallyLDADDbut scoped to project${PROJECTNAME}πLDFLAGSβ extra linker flags, and the classic use case is pointing at library directories:
LDFLAGS+= -L/opt/company/software/lib
<Mu I>
LDFLAGS0β same asLDFLAGS, butLDFLAGS0andLDADD0are passed to the linker beforeLDFLAGSandLDADD. Normally you'd modifyLDFLAGS0andLDADD0inside makefiles β a user should not be setting these from the environment.<M>LDFLAGS_<project>β likeLDFLAGSbut for project${PROJECTNAME}β¨MKPIEβ if it's"yes", you get a Position Independent Executable (PIE); otherwise a regular executable.<Mu>[no]MKSHAREβ if it's"no", it acts asMKHTML=no MKINFO=no MKCATPAGES=no MKMAN=no. Translation: no catman pages, no man pages, no info documentation, none of it π«<Iu>[yes]PROGβ the name of the program you're building.PROGNAMEβ the name that program gets installed as, if it's different from${PROG}.<M>PROGSβ the names of the programs to build. If neitherPROGnorPROGSis supplied, nothing gets built.<M>SRCSβ the list of source files that build the program. IfSRCSisn't defined, it's assumed to be${PROG}.c.<M>SRCS.<prog>β the list of source files for the program prog listed inPROGS. IfSRCS.<prog>isn't defined, it's assumed to beprog.c.<M>USE_RELROβ if"yes", it enables a technique that hardens the data sections of an ELF binary/process π₯ For security reasons it makes sense to set it toYES, though it may slow down application startup.<Iu>[no]
And a lil note: mkc.prog.mk includes mkc.files.mk, so it supports every variable that file supports too π
The order of options passed to the C compiler is:
CPPFLAGS0, CPPFLAGS, CPPFLAGS_<project>, CFLAGS.ssp, CFLAGS.pie, CFLAGS.warns, CFLAGS, CFLAGS_<project>, CFLAGS.pic (for shared objects), COPTS, COPTS_<project>
The order of options passed to the C++ compiler is:
CPPFLAGS0, CPPFLAGS, CPPFLAGS_<project>, CXXFLAGS.ssp, CXXFLAGS.pie, CXXFLAGS.warns, CXXFLAGS, CXXFLAGS_<project>, CXXFLAGS.pic (for shared objects), COPTS, COPTS_<project>
π mkc.lib.mk π
The include file mkc.lib.mk has support for building a static and dynamic library or DLL π¦ It uses the following variables:
DPINCDIRSβ seeLIBDEPSin sectionmk.subprj.mk.DPLDADDβ seeLIBDEPSin sectionmk.subprj.mk.DPLIBDIRSβ seeLIBDEPSin sectionmk.subprj.mk.EXPORT_SYMBOLSβ only symbols listed in a specified file (one symbol per line) get exported. Empty lines and comments started with the#symbol are ignored. This variable has no effect on some platforms. By default, all symbols are exported.<M>[]LDADD,LDADD_<project>β additional objects. Seemkc.prog.mk.LDFLAGS,LDFLAGS_<project>β additional linker flags. Seemkc.prog.mk.LIBβ the name of the library to build.<M>LIBDIRβ see the Common variables andmkc.files.mksections.LIBGRPβ library group. Ifbmakeis run by an unprivileged user, it defaults toid -g.<Iu>LIBMODEβ library mode.<Iu>[${NONBINMODE}]LIBOWNβ library owner. Ifbmakeis run by an unprivileged user, it defaults toid -u.<Iu>MANβ the manual pages to be installed (use a.1-.9suffix).<M>MKDLLβ if"yes", build and install the dynamically loaded library (<lib>.so) instead of a shared library. If"only", do not make the static library.<M>[no]MKSHLIBβ if not"no", build and install the shared library, provided thatSHLIB_MAJORis defined.<IMu>[yes] (for MACHINE_ARCHs that support it)MKSTATICLIBβ if not"no", build and install the static library.<IMu>[yes]MKPICLIBβ if not"no", build and install the*_pic.alibrary.<IMu>[no]MKPROFILELIBβ if"no", don't build or install the profiling (*_p.a) libraries.<Iu>[no]SHLIBMODEβ shared library mode.<Iu>SHLIB_MAJORβ major shared library number. If it's unset, the shared library is not built π¨<M>SHLIB_MINORβ minor shared library number.<M>[0]SHLIB_TEENYβ minor shared library number.<M>[] (yep, the page says "Minor" again and I'm not gonna gaslight you about it π)SRCSβ the list of source files to build the library. Suffix types.s,.c, and.fare supported. Heads up:.sfiles are preferred over.cfiles of the same name.<M>
Static libraries get ranlib'd when they're made π mkc.lib.mk includes mkc.files.mk, so it supports all of its variables as well. After the libraries are created, a ${.CURDIR:T}.done file is created and used for handling inter-project (see the LIBDEPS variable) dependencies.
The order of options passed to the C and C++ compilers is the same as in mkc.prog.mk π
π¦ mkc.subprj.mk π¦
The include file mkc.subprj.mk handles subprojects (subdirectories) organized as a dependency graph πΈοΈ It provides every target that mkc.prog.mk provides.
The variable SUBPRJ holds a list of pairs depdir:dir, which means subproject dir depends on depdir. Running mkcmake all will build every subproject listed in SUBPRJ in the correct order (starting with the subprojects that have no dependencies, and so on β¨). There's also a target that lets you run bmake <subdir>, where <subdir> is any directory listed in the SUBPRJ variable.
You also get these targets: <target>-<subdir>, where <target> is any of: all, clean, cleandir, depend, installdirs, install, uninstall and filelist. Also provided: nodeps-<target>-<subdir> and subdir-<target>-<subdir> targets π
The difference? mkcmake <target>-<subdir> runs the specified <target> for <subdir> and all its dependencies, while mkcmake nodeps-<target>-<subdir> runs it only for <subdir>. And a subdir-<target>-<subdir> target is just a synonym for nodeps-<target>-<subdir>. See the examples/hello_dictd subdirectory for a sample of how to use it π«Ά
mkc.subprj.mk provides the following variables:
ALLTARGETSβ a list of targets that havepre_*,do_*andpost_*counterparts, likepre_all,do_allandpost_all. Thepre_*target runs before thedo_*target, which in turn runs beforepost_*. Unless an action is provided fordo_*targets, they implement the standard behaviour of mk-configure. No action is provided forpre_*andpost_*targets, so those are for your extensions π The standard behaviour for${ALLTARGETS}may also be extended by adding new prerequisites todo_*targets.COMPATLIBβ subproject's basename for the compatibility library. If this variable is set,MKC_SOURCE_FUNCLIBSandFEATURESdo not changeSRCSfor subprojects other than${COMPATLIB}.<M>[]EXPORT_VARNAMESβ list of variables to export before running make for subdirectories.<Mu>[MKC_CACHEDIRSRCTOPOBJTOPSTATICLIBSCOMPATLIB]INTERNALLIBSβ a list of subprojects (basenames) with internal libraries. These libraries are static and are not installed by the"install"target.<M>[]LIBDEPSβ a list of library dependencies π Each token is a colon-separated pair. Its first component is a library subproject (the dependency), the second one is the subproject for the library or executable. The value of this variable is automatically added toSUBPRJ. Library dependencies listed inLIBDEPSautomatically changeCPPFLAGS0,LDFLAGS0andLDADD0of the appropriate subprojects.<M>Suppose we have a<library:program>pair inLIBDEPS, and also suppose that the variablelibraryis set to the"library"subdirectory and the variableprogramis set to the"program"subdirectory. Then${SRCDIR_library}/linkme.mkis automatically included from${SRCDIR_program}/Makefileif it exists. In this fileDPLDADD[${library:T:S/^lib//}],DPLIBDIRS[${OBJDIR_${library:S,/,_,g}}] andDPINCDIRS[${SRCDIR_${library:S,/,_,g}}${OBJDIR_${library:S,/,_,g}}], may be set to non-default values. These three variables then changeLDADD0,LDFLAGS0andCPPFLAGS0respectively in subproject"program". The dependency graph specified by the variableLIBDEPSis available to all subprojects via the environment.MKRELOBJDIRβ if"yes", object directories${OBJTOP}/dirare used. UnlikeMAKEOBJDIRPREFIX, object directories do not contain the top-level${.CURDIR}in paths.<Iu>[no]NODEPSβ this variable specifies a list of patterns that describe edges from the dependency graph intargdep-prjdep:targ-prjortarg-prj:targformats, to be excluded from the dependency graph.<M>[]NOEXPORT_VARNAMESβ list of variables excluded fromEXPORT_VARNAMES.<Mu>[]NOSUBDIRβ if for some reason you wanna exclude some subdirectories from the build, list them in this variable.<U>[]OBJDIR_<dir>β value of${.OBJDIR}inside thedirsubdirectory. Slash symbols inside<dir>are replaced with underlines. In addition, theOBJDIR_<dir:T>variable is set to${OBJDIR_<dir>}if${SHORTPRJNAME}is"yes".SHORTPRJNAMEβ if"yes", special targets with the last component of the subprojects are provided.<Im>[yes]SRCDIR_<dir>β value of${.CURDIR}inside thedirsubdirectory. Slash symbols inside<dir>are replaced with underlines. In addition, theSRCDIR_<dir:T>variable is set to${SRCDIR_<dir>}if${SHORTPRJNAME}is"yes".STATICLIBSβ a list of subprojects (basenames) with static libraries. If a dependency is mentioned in this variable, the suffix_picis automatically added for PIE-executables or shared libraries that depend on this library. This variable is automatically passed to subprojects via the environment.<Mu>[]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 inSUBPRJ.<IMu>SUBPRJSRCTOPβ this variable contains the${.CURDIR}directory and is passed to subprojects.<I>[${.CURDIR}]
π― TARGETS π―
ok so TARGETS is a list of recursive targets. and "recursive" here literally means the target gets called for all subprojects recursively (go peek at mkc.subprj.mk and mkc.subdir.mk if you wanna see the receipts).
the default lineup is:
[all, install, installdirs, uninstall, clean, cleandir, depends, test, configure, filelist, obj]
and bestie, setting this variable in the Makefile means you can add brand new targets for special purposes β static code analysis, partial builds, whatever your lil heart desires. main character customisation energy π
π mkc.subprj.mk π
mkc.subprj.mk hands you these targets:
<subdir>and<subdir:T>β<subdir>is a subdirectory listed inSUBDIRorSUBPRJ. this target is literally equivalent toall-<subdir>. and<subdir:T>is the last component of the directory, and it gets created if${SHORTPRJNAME}is"yes". cute naming, no notes β¨<target>-<subdir>β runs the specified<target>for the specified<subdir>. also the target<target>-<subdir:T>is provided if${SHORTPRJNAME}is"yes".subdir-<target>-<subdir>andnodeps-<target>-<subdir>β runs the specified<target>for the specified<subdir>without dependencies. the targetssubdir-<target>-<subdir:T>andnodeps-<target>-<subdir:T>are provided if${SHORTPRJNAME}is"yes".print_depsβ outputs the dependency graph on targets in tsort(1) format, and it takes theNODEPSandNOSUBDIRvariables into account. a whole vibe check for your build order π¦
π mkc.subdir.mk π
the include file mkc.subdir.mk contains the default targets for building subdirectories, and it provides the same targets as mkc.prog.mk.
for all the directories listed in the variable SUBDIR, the specified directory gets visited and the target made. there's also a default target that lets you run bmake <subdir> where <subdir> is any directory listed in the variable SUBDIR. so convenient it's giving luxury π
and as a special lil case: using a token .WAIT as an entry in SUBDIR acts as a synchronization barrier when multiple make jobs are run β the subdirs before the .WAIT must complete before any subdirs after .WAIT are started. love a queen who waits her turn π
heads up though: see bmake(1) for some caveats on use of .WAIT and other special sources. it's not all sunshine, iykyk.
also the 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 the auxiliary include file for checking a platform's features β headers, function or variable declarations, function implementation in a particular libraries, data types sizes, etc. basically it's the detective of the family π
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. and ngl, the include chain is: mkc.configure.mk itself includes mkc.init.mk, then mkc.conf.mk, and finally an internal include file which updates CPPFLAGS, CFLAGS, LDADD and SRCS. iconic pipeline, no cap.
mkc.configure.mk supports these variables:
MKCHECKSβ if"no", none of the checks are performed. it's set to"yes"unless the target is"clean"and"cleandir". so yes, this is your on/off switch β¨MKC_CACHEDIRβ the directory where intermediate and cache files are created. it defaults to${.OBJDIR}. by default theMKC_CACHEDIRvariable is exported for subprojects, which means cache files for subprojects are created in the top-level directory. and if the cache directory doesn't exist, it gets created automatically. self-care πMKC_CHECK_BUILTINSβ mk-configure provides a bunch of built-in custom checks, that is, source files to compile or scripts to run in order to check for something. whatever checks are listed inMKC_CHECK_BUILTINSwill be run. available values:prog_flex,prog_bison,prog_gawk,prog_gm4,prog_gmakeβ find flex, bison, GNU awk, GNU m4 or GNU make respectively, by analysing the program's help and/or version messages. if found,BUILTIN.prog_<progname>is set to the path, otherwise it's set to an empty string. note that gawk may be found as awk, bison as yacc, gm4 as m4, flex as lex and gmake as make. identity crisis but make it useful πprog_mkdep,prog_nbmkdepβ find traditional BSD mkdep(1) or the recent NetBSD version of it, respectively.endiannessβ theBUILTIN.endiannessvariable is set to eitherlittle,bigorunknown, depending on the hardware. slay π
MKC_CHECK_CC_OPTSβ a list of C compiler options to check. if${CC} -csupports the specified option, the variableHAVE_CC_OPT.<option:S/=/_/g>is set to1and0otherwise. a double underline in the option is considered as a single space character. sneaky but valid π«Ά
Ex.
MKC_CHECK_CC_OPTS = -Wall -errwarn=%all --param__ssp-buffer-size=1
Res.
HAVE_CC_OPT.-Wall=1
HAVE_CC_OPT.-errwarn_%all=0
HAVE_CC_OPT.--param__ssp-buffer-size_1=1
MKC_CHECK_CCLD_OPTSβ same asMKC_CHECK_CC_OPTSexcept that the option"-c"is not passed to the compiler, so an executable is created. as a resultHAVE_CCLD_OPT.<option:S/=/_/g>is set to1or0. whole different beast π₯MKC_CHECK_CUSTOMβ a list of custom checks (list of names).MKC_CUSTOM_FN.<custom_check_name>is a "C" or "C++" source filename or an executable program for your custom check, e.g.filename.c,filename.cc,subdir/filename.cxx,filename.C,filename.cpp,filename.c++orsubdir/executable_script. mk-configure tries to compile or run the specified file and sets theCUSTOM.<custom_check_name>variable to1,0or other value. ifMKC_CUSTOM_FN.<custom_check_name>is unset, it defaults tocustom_check_name.c.
also -DCUSTOM_<CUSTOM_CHECK_NAME>=1 is added to CPPFLAGS if the specified check succeeded β unless MKC_NOAUTO is set to 1 and MKC_CUSTOM_NOAUTO.<custom_check_name> is set to "yes". here <CUSTOM_CHECK_NAME> is uppercase for <custom_check_name>. and if MKC_CUSTOM_LINK.<custom_check_name> is "yes", then the C or C++ source file is compiled and linked into an executable.
also, CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LDADD, MKC_CUSTOM_CPPFLAGS.<custom_check_name>, MKC_CUSTOM_CFLAGS.<custom_check_name>, MKC_CUSTOM_CXXFLAGS.<custom_check_name>, MKC_CUSTOM_LDFLAGS.<custom_check_name> and MKC_CUSTOM_LDADD.<custom_check_name> flags are passed to the compiler. normally the cache file name contains <custom_check_name> unless MKC_CUSTOM_CACHE.<custom_check_name> is set to something else. so many knobs, we love options π
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
CPPFLAGS+= -DCUSTOM_NESTED_FUNCS=1
note that the script for the check should be an executable file. no permission, no vibes π
MKC_CHECK_CXX_OPTSβ same asMKC_CHECK_CC_OPTSbut for the C++ compiler. as a resultHAVE_CXX_OPT.<option:S/=/_/g>is set to1or0.MKC_CHECK_CXXLD_OPTSβ same asMKC_CHECK_CCLD_OPTSbut for the C++ compiler. as a resultHAVE_CXXLD_OPT.<option:S/=/_/g>is set to1or0.MKC_CHECK_DEFINESβ list of<define>:<header>to check. the<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 CPPFLAGS 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
CPPFLAGS += -DHAVE_DEFINE_RTLD_LAZY_DLFCN_H=1 \
-DHAVE_DEFINE___GNUC__=1
MKC_CHECK_FUNCLIBSβ list of<function>:<library>pairs to check, the<library>part is optional. if<library>is present, the presence of<function>in libc is also checked automatically. thorough queen π
as a result of the check, bmake's variable HAVE_FUNCLIB.<function>.<library> (or HAVE_FUNCLIB.<function>) is set to either 0 or 1.
if <function> is found in <library> but not in libc, or <function> is "main" and is found in <library>, then -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_CHECK_FUNCS<N>β list of<func>:<header>to check. the<header>part is optional. here<N>means the number of arguments. as a result of the check, bmake's variableHAVE_FUNC<N>.<func>.<header>(orHAVE_FUNC<N>.<func>) is set to either0or1.
<header>: tr|./|__|g
also -DHAVE_FUNC<N>_<FUNC>_<HEADER>=(0 or 1) (or -DHAVE_FUNC<N>_<FUNC>=(0 or 1)) is added to CPPFLAGS if the specified function was detected, unless MKC_NOAUTO is set to 1. and if MKC_FUNC_OR_DEFINE.<func> is "yes", an equivalent define leads to the same results. teamwork makes the dream work β¨
<HEADER>: tr|a-z./|A-Z__|g
Ex: MKC_CHECK_FUNCS2 += fgetln:stdio.h
MKC_CHECK_FUNCS6 += pselect:sys/select.h
MKC_CHECK_FUNCS1 += htobe32:sys/endian.h
MKC_FUNC_OR_DEFINE.htobe32 += yes
Res: HAVE_FUNC2.fgetln.stdio_h = 1
HAVE_FUNC6.pselect.sys_select_h = 1
HAVE_FUNC1.htobe32.sys_endian_h=1
CPPFLAGS += -DHAVE_FUNC2_FGETLN_STDIO_H=1 \
+= -DHAVE_FUNC6_PSELECT_SYS_SELECT_H=1 \
+= -DHAVE_FUNC1_HTOBE32_SYS_ENDIAN_H
π MKC_CHECK_HEADER_FILES
Bestie, this is literally MKC_CHECK_HEADERS's twin π
β same energy, except the check is done with $CC -E instead of $CC -c. And because it's a whole different vibe, it also sets HAVE_HEADER_FILE.<header> variables and HAVE_HEADER_FILE<HEADER> defines. That's it, that's the whole personality.
πΈ MKC_CHECK_HEADERS
Here's where you drop the list of headers you wanna check, with the help of $CC -c. After the check, bmake's variable HAVE_HEADER.<header> is set to either 0 or 1. Obsessed with a clean binary result β¨
<header>:tr|./|__|g
Also, -DHAVE_HEADER_<HEADER>=(0 or 1) gets added to CPPFLAGS unless MKC_NOAUTO is set to 1 π
<HEADER>:tr|a-z./|A-Z__|g
Like, for example:
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
CPPFLAGS += -DHAVE_HEADER_SYS_TIME_H=1 -DHAVE_HEADER_FCNTL=1
π¦ MKC_CHECK_MEMBERS
A list of <type>.<member>:<header> to check. The <header> part is optional β it's giving "bring your own header, or don't, no pressure" π«Ά
After 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) gets added to CPPFLAGS if the specified member was found in the 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
And the receipts:
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
CPPFLAGS += -DHAVE_MEMBER_STRUCT_IFREQ_IFR_IFRN_IFRN_NAME_NET_IF_H=1
CPPFLAGS += -DHAVE_MEMBER_STRUCT_TM_TM_ISDST_TIME_H=1
π MKC_CHECK_PROGS
A list of <progname>s to check. After the check, bmake's variable HAVE_PROG.<progname> is set to either 1 (true) or 0 (false). And PROG.<progname> gets set to the full path of a program, or to an empty string if it's a no-show π«
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. Fun fact: MKC_PROG.id.<progname> also changes cache file names π
π MKC_CHECK_PROTOTYPES
This is a list of checks (a list of names) for C function prototypes. So:
MKC_PROTOTYPE_FUNC.<name>is a C function prototype.MKC_PROTOTYPE_HEADERS.<name>is a list of headers separated by space or comma.
mk-configure verifies that the specified prototype is correct, and if it is, HAVE_PROTOTYPE.<name> bmake variable is set to 1 and -DHAVE_PROTOTYPE_<NAME>=1 is added to CPPFLAGS unless MKC_NOAUTO is set to 1. Otherwise, HAVE_PROTOTYPE.<name> variable is set to 0. Simple as that, no cap π
Ex.
MKC_CHECK_PROTOTYPES = posix_iconv const_iconv
MKC_PROTOTYPE_FUNC.posix_iconv =
size_t iconv(iconv_t,char**,size_t*,char**,size_t*)
MKC_PROTOTYPE_FUNC.const_iconv =
size_t iconv(iconv_t,const char**,size_t*,char**,size_t*)
MKC_PROTOTYPE_HEADERS.posix_iconv = iconv.h
MKC_PROTOTYPE_HEADERS.const_iconv = iconv.h
Res.
HAVE_PROTOTYPE.posix_iconv=0
HAVE_PROTOTYPE.const_iconv=1
CPPFLAGS += -DHAVE_PROTOTYPE_CONST_ICONV=1
β MKC_CHECK_SIZEOF
A list of <type>:<header> to check. The <header> part is optional, because we're chill like that πΈ
After the check, bmake's variable SIZEOF.<type>.<header> (or SIZEOF.<type>) is set to the data type size, or to the string "failed" if it didn't slay π
<type>:tr|*-|P_|g<header>:tr|/.|__|g
Also -DSIZEOF_<TYPE>_<HEADER>=<failed|1|2|...> (or -DSIZEOF_<TYPE>=<failed|1|2|...>) is added to CPPFLAGS if the 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
CPPFLAGS += -DSIZEOF_VOIDP=4 \
-DSIZEOF_LONG_LONG=4 \
-DSIZEOF_OFF_T_SYS_TYPES_H=8
π§ MKC_CHECK_TYPES
A list of type:header to check. The <header> part is optional β see the pattern here, bestie? Consistent icon behaviour π
After 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 CPPFLAGS 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
CPPFLAGS += -DHAVE_TYPE_SIZE_T_STRING_H=1
π MKC_CHECK_VARS
A list of variable:header to check. And yeah β the <header> part is optional πΈ
After 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 CPPFLAGS if the specified variable was detected, unless MKC_NOAUTO is set to 1.
Ex: MKC_CHECK_VARS += sys_errlist:errno.h
Res: HAVE_VAR.sys_errlist.errno_h = 1
CPPFLAGS += -DHAVE_VAR_SYS_ERRLIST_ERRNO_H
π₯ MKC_COMMON_DEFINES
A list of defines that are always passed to the compiler in the MKC_CHECK_{DEFINES,VARS,FUNCS<N>,SIZEOF} checks. Like, every single time. Loyalty π
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). So it's like the VIP version for one specific platform only β¨
Ex: MKC_COMMON_DEFINES.Linux += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
MKC_COMMON_DEFINES.Interix += -D_ALL_SOURCE
π«Ά MKC_COMMON_HEADERS
A list of header files that are always #include'd into the test .c file in the MKC_CHECK_{DEFINES,VARS,FUNCS<N>,SIZEOF} checks. The default value is an empty list β so nothing extra by default, lowkey minimalist π
Ex: MKC_COMMON_HEADERS += unistd.h stdlib stdio.h string.h
MKC_CHECK_SIZEOF += offs_t size_t ssize_t
π MKC_CUSTOM_DIR
The directory with custom checks source files. Peep MKC_CHECK_CUSTOM for the details. It defaults to ${.CURDIR}.
π
MKC_DELETE_TMPFILES
If set to 1, temporary files are removed. Clean girl aesthetic, literally π§Ήβ¨
π MKC_FEATURES
Okay this one's the main character of the whole page, ngl. This is a list of "features" required by the project. In general, a feature is something that has problems with portability. This may be a function name or a header missing on some platforms, for example. What a developer needs to do is add FEATURENAME to the MKC_FEATURES variable and add #include <mkc_FEATURENAME.h> where it's needed. Internally, the system requirements are checked in the automatically included mkc_imp.f_FEATURENAME.mk file, and all required actions (includes, define checks etc.) are made in the mkc_FEATURENAME.h header file. It's giving "do the work once, never think about it again" π¦
Currently the following features are provided:
arc4randomβ this feature providesarc4random(3),arc4random_buf(3)andarc4random_uniform(3)functions available in BSDs. If these functions are absent on your system, installlibbsdlibrary.bswapβ this feature providesbswap16(3),bswap32(3)andbswap64(3)functions available in *BSD.dprintfβ this feature providesdprintf(3).efunβ this feature providesesetfunc(3),efopen(3),ecalloc(3),emalloc(3),erealloc(3),ereallocarr(3),estrdup(3),estrndup(3),estrlcpy(3),estrlcat(3),easprintf(3),estrtoi(3),estrtou(3)andevasprintf(3)functions from NetBSD.errβ this feature provideserr(3),errx(3),verr(3)andverrx(3)BSD-isms.errcβ this feature provideserrc(3)andverrc(3)BSD-isms.fgetlnβ this feature providesfgetln(3)BSD-ism.fparselnβ this feature providesfparseln(3)BSD-ism.ftsβ this feature providesfts_open(3),fts_read(3)etc. functions available on BSDs and Linux. If it is absent on your system, you have to installlibfts(both headers and library).libftsis a part of musl project.getdelimβ this feature providesgetdelim(3)from POSIX.getlineβ this feature corresponds togetline(3)function which is a part of POSIX2008, unavailable on some systems.mkc_imp.f_getline.mkchecks whethergetlinedeclaration is available instdio.hand implementation is available inlibc. If not,getline.cprovided by mk-configure is added toSRCSand declaration is provided inmkc_getline.hheader.humanize_numberβ this feature provideshumanize_number(3)function from NetBSD.libdlβ this feature checks whetherlibdllibrary is available anddlopen(3)is declared indlfcn.h. If yes,-ldlis added toLDADD.mkc_libdl.hprovides declarations fordlopen(3),dlsym(3),dlclose(3)etc.liblβ adds-llor-lfltoLDADDdepending on which one is available. One can use this feature instead ofLIBLEXvariable.libmβ this feature checks whetherlibmis available and if yes, adds-lmtoLDADD. Most UNIX-like systems havelibmbut Haiku, for example, does not.mkc_imp.f_libm.mkchecks whetherlibmlibrary is available and if yes,-lmis added toLDADD.macroβ this feature provides the following macro stolen from NetBSD.__aligned(x)β defined as__attribute__((aligned(x)))if supported by compiler,
__always_inlineβ defined as__attribute__((always_inline))if supported by compiler. β¨__arraycount(a)β defined as(sizeof(__a)/sizeof(__a[0])). π__constfuncβ defined as__attribute__((const))if supported by compiler. πΈ__deadβ defined as__attribute__((noreturn))if supported by compiler. π¦MIN(a,b)andMAX(a,b)β these two are in the macro lineup too, bestie. π__pureβ defined as__attribute__((pure))if supported by compiler. β__printflike(n,m)β defined as__attribute__((format (printf, n, m)))if supported by compiler. π₯__UNCONST(a)β defined as((void *) ((const char *)(p) - (const char *)0)). πposix_getoptβ okay so it's well-known that glibcgetopt(3)does not conform to POSIX by default. This feature provides POSIX-ly correctgetopt. πprognameβ this feature providesgetprogname(3)andsetprogname(3)functions available in *BSD. β¨pwdgrpβ this feature providesuser_from_uid(3),uid_from_user(3),group_from_gid(3),gid_from_group(3)functions from *BSD. π«Άraise_default_signalβ this feature provides functionraise_default_signal(3)from NetBSD. π¦RB,SPLAYβ BSD systems providesys/tree.hheader whereRB_*andSPLAY_*macroses are defined for red-black tree and splay. These features check whethersys/tree.hand appropriate macroses are available. If yes,mkc_RB.handmkc_SPLAY.hinclude system-widesys/tree.h, otherwise NetBSD version ofsys/tree.hprovided by mk-configure is included. πreallocarrβ this feature providesreallocarr(3)function from NetBSD. πreallocarrayβ this feature providesreallocarray(3)from OpenBSD. πshquoteβ this feature providesshquote(3)from NetBSD. πSLIST,SIMPLEQ,STAILQ,LIST,TAILQ,CIRCLEQβ BSD systems providesys/queue.hheader whereSLIST_*etc. macroses are defined for lists and queues. These features check whethersys/queue.hand appropriate macroses are available. If yes,mkc_SLIST.hand others include system-widesys/queue.h, otherwise NetBSD version ofsys/queue.hprovided by mk-configure is included. πstrlcatβ this feature corresponds tostrlcat(3)function available on almost all systems except glibc-based Linux-es.mkc_imp.f_strlcat.mkchecks whetherstrlcatdeclaration is available instring.hand implementation is available inlibc. If not,strlcat.cprovided by mk-configure is added toSRCSand declaration is provided inmkc_strlcat.hheader. π₯strlcpyβ similar tostrlcat. π¦strndupβ this feature providesstrndup(3)from POSIX. πΈstrsepβ this features providesstrsep(3)andstresep(3)functions. πstrtoiβ this feature providesstrtoi(3)function introduced in NetBSD. βstrtouβ this feature providesstrtoi(3)function introduced in NetBSD. βvisβ this feature providesvis(3),nvis(3),svis(3),snvis(3),strvis(3),strnvis(3),strsvis(3),strsnvis(3),strvisx(3),strnvisx(3),strenvisx(3),strsvisx(3),strsnvisx(3),strsenvisx(3),strunvis(3),strnunvis(3),strunvisx(3),strnunvisx(3)andunvis(3)from NetBSD. πwarnβ this feature provideswarn(3),warnx(3),vwarn(3)andvwarnx(3)BSD-isms. π
π MKC_NOAUTO π
See MKC_CHECK_{HEADERS,FUNCLIBS,FUNCS,VARS,DEFINES,SIZEOF}. That's the whole vibe. π
π MKC_NOAUTO_FUNCLIBS π
See MKC_CHECK_FUNCLIBS. β¨
π MKC_NOCACHE π
All results are cached unless the MKC_NOCACHE variable is set to a non-empty value. π«Ά
π MKC_REQUIRE_BUILTINS π
The same as MKC_CHECK_BUILTINS, but failure is treated as a fatal error (see the configure target). π
π MKC_REQUIRE_CUSTOM π
The same as MKC_CHECK_CUSTOM, but failure is treated as a fatal error (see the configure target). 0 and empty value of CUSTOM.xxx means failure. π
π MKC_REQUIRE_DEFINES π
The same as MKC_CHECK_DEFINES, but absence of the define is treated as a fatal error (see the configure target). π¦
π MKC_REQUIRE_FUNCLIBS π
The same as MKC_CHECK_FUNCLIBS, but absence of funclib is treated as a fatal error (see the configure target). πΈ
π MKC_REQUIRE_FUNCS<N> π
The same as MKC_CHECK_FUNCS<N>, but absence of the function declaration is treated as a fatal error (see the configure target). π
π MKC_REQUIRE_HEADER_FILES π
The same as MKC_CHECK_HEADER_FILES, but absence of header is treated as a fatal error (see the configure target). π
π MKC_REQUIRE_HEADERS π
The same as MKC_CHECK_HEADERS, but absence of header is treated as a fatal error (see the configure target). π
π MKC_REQUIRE_MEMBERS π
The same as MKC_CHECK_MEMBERS, but absence of the member is treated as a fatal error (see the configure target). π«Ά
π MKC_REQUIRE_PROGS π
The same as MKC_CHECK_PROGS, but absence of program is treated as a fatal error (see the configure target). π₯
π MKC_REQUIRE_PROTOTYPES π
The same as MKC_CHECK_PROTOTYPES, but incorrect prototype is treated as a fatal error (see the configure target). π
π MKC_REQUIRE_TYPES π
The same as MKC_CHECK_TYPES, but absence of the type declaration is treated as a fatal error (see the configure target). β
π MKC_REQUIRE_VARS π
The same as MKC_CHECK_VARS, but absence of the variable declaration is treated as a fatal error (see the configure target). π
π MKC_SHOW_CACHED π
Setting it to 0 will hide
Checking ... (cached) ...
messages, that is, messages about fetching results from cache files. π«Ά
πΈ MKC_SOURCE_DIR, MKC_SOURCE_DIR.<source> πΈ
Directory with sources for MKC_SOURCE_FUNCLIBS. If MKC_SOURCE_DIR.<source> is unset, MKC_SOURCE_DIR is used that defaults to ${.CURDIR}. β¨
Ex: MKC_SOURCE_FUNCLIBS += getline
MKC_SOURCE_DIR.getline.c = ${.CURDIR}/../missing
Res: SRCS+= ${.CURDIR}/../missing/getline.c
HAVE_FUNCLIB.getline= 0
π 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.conf.mk π§
The same as mkc.configure.mk but mkc.init.mk is not included by mkc.conf.mk in the beginning, and CFLAGS, CPPFLAGS, LDADD and SRCS variables are not modified. Instead, internal variables MKC_CFLAGS, MKC_CPPFLAGS, MKC_LDADD and MKC_SRCS contain all changes and will be applied later. One can use this module for implementing your own "features" similar to MKC_FEATURES. π
π§ mkc_imp.scripts.mk π§
It's an internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk.
β οΈ Do not use it directly! It is internal, bestie.
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>β¨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>π«ΆSCRIPTSGRPβ script file group.<Iu>[${BINGRP}]πΈSCRIPTSMODEβ script file mode.<Iu>[${BINMODE}]π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>π¦SCRIPTSOWNβ script files owner.<Iu>[${BINOWN}]π
π§ mkc_imp.lua.mk π§
mkc_imp.lua.mk is an internal include file which is included from mkc.prog.mk and mkc.lib.mk.
β οΈ Do not use it directly. It's internal, periodt.
It provides support for the Lua programming language, i.e. building and installing Lua- and/or C-based modules. The following variables are provided:
LUA_CMODDIRβ directory for compiled Lua modules written in, e.g., C or C++. It is assigned with the help ofpkg-config --variable=INSTALL_CMOD luacommand and can be overriden by user.<Iu>π₯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.cfile names are made ofLUA_MODULESwith dots replaced with an underscore symbol. At installation time dots are replaced with slash. For example, ifLUA_CMODULES=socket.foo, thensocket_foo.cwill be used for compiling a module and will be installed to${LUA_CMODDIR}/socket/foo.so.<M>πLUA_LMODDIRβ directory for Lua modules written in Lua. It is assigned with the help ofpkg-config --variable=INSTALL_LMOD luacommand and can be overriden by user.<Iu>πLUA_LMODULESβ deprecated. Filenames of Lua modules. UseLUA_MODULESinstead.<M>πLUA_MODULESβ list of Lua modules to build and install. Dot in the module name separates a dirname from basename. That is, actual.luafile names are made ofLUA_MODULESwith dots replaced with an underscore symbol. At installation time dots are replaced with slash. For example, ifLUA_MODULES=socket.foo, thensocket_foo.luawill be installed to${LUA_LMODDIR}/socket/foo.lua.<M>πΈSRCSβ list of source files to build theLUA_CMODULE.SRCSdefaults to${LUA_CMODULE:S|.|_|g}.c.<M>β¨
π§ mkc_imp.intexts.mk π§
mkc_imp.intexts.mk is an internal include file which is included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk.
β οΈ Do not use it directly. It's internal, okay?
It provides conversion of <fn>.in files to <fn> by expanding the following @@ patterns: π¦
okay so these pattern/replacement pairs are literally the matching game, and they map like this:
@prefix@β${PREFIX}@bindir@β${BINDIR}@mandir@β${MANDIR}@sbindir@β${SBINDIR}@libdir@β${LIBDIR}@libexecdir@β${LIBEXECDIR}@datadir@β${DATADIR}@sysconfdir@β${SYSCONFDIR}@incsdir@β${INCSDIR}@vardir@β${VARDIR}@sharedstate@β${SHAREDSTATEDIR}
and here are the variables it hands you, bestie:
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 additionalsed(1)expressions for expanding, e.g.
INTEXTS_SED+= -e 's,0.40.3,${VERSION},g'
<M>
π§ mkc_imp.info.mk π§
okay so mkc_imp.info.mk is an internal include file that gets included from mkc.prog.mk, mkc.lib.mk and mkc.files.mk. Do not use it directly! It's giving backstage-pass energy only. This module provides creation of .info files from .txi, .texi and .texinfo sources and gives you these variables:
INFOFLAGSβ flags to pass tomakeinfo.[]<Iu>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>
π mkc_imp.man.mk π
mkc_imp.man.mk is an internal include file that gets 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 it gives you these variables:
HTMLDIRβ target directory for html pages generated from man pages.<Iu>[${MANDIR}]MANβ manual pages (usually end in.1-.9).<M>MANDIRβ target directory for man pages.<Iu>[${PREFIX}/man]MANZβ if not"no", compress manual pages at installation time.<Iu>[no]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]MKMANβ if"no", don't build or install the man pages, and also acts as"MKCATPAGES=no MKHTML=no".<Iu>[yes]MLINKSβ list of manual page links (using a.1-.9suffix). The linked-to file must come first, the linked file second, and there may be multiple pairs. The files are hard-linked.<M>USETBLβ if not"no", preprocess man pages usingtbl(1)while generating cat pages.<IM>[no]
π¦ mkc_imp.links.mk π¦
mkc_imp.links.mk is an internal include file that gets 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 gives you these 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}/gzipand${BINDIR}/gunzip, use:
LINKS= ${BINDIR}/gzip ${BINDIR}/gunzip
<M>
SYMLINKSβ the list of symbolic links; should be full pathnames. Syntax is identical toLINKS. Note thatDESTDIRis not automatically included in the link.<M>
πΈ mkc_imp.inc.mk πΈ
mkc_imp.inc.mk is an internal include file that gets 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 gives you these variables:
INCSβ the list of include files.<M>INCSDIRβ seemkc.init.mk.INCSNAMEβ target name of the include file, if only one; same asFILESNAME, but for include files.<M>INCSNAME_<file>β the name file<file>should be installed as, if not<file>, same asFILESNAME_<file>, but for include files.<Mu>INCSSRCDIRβ source directory for include files. This variable has an influence onCPPFLAGS(-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 implements a simple framework for unit tests. The idea: the application provides the target test_output and an expect.out file that contains the ideal output. mkcmake test runs mkcmake test_output and compares generated output with expect.out.
MKC_DIFFβdiff(1)command for comparing expected and actual results.<Iu>[diff]TEST_PREREQSβ prerequisites for target"test".<Iu>[all]
π«Ά mkc_imp.pkg-config.mk π«Ά
mkc_imp.pkg-config.mk is an internal include file that gets included from mkc.prog.mk and mkc.lib.mk. Do not use it directly! This module supports dependencies controlled by the 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:
MKC_CHECK_PKGCONFIGβ list of libraries to check, for example,glib-2.0>=2.1. Spaces around<=,>=,=,<and>are not allowed. As a result of the check, bmake's variablePKG_CONFIG.exists.<lib>is set to1for success or0for failure. UnlessMKC_NOAUTOis set to1,-DHAVE_PKGCONFIG_<LIB>=1is also added toCPPFLAGSif<lib>was found.<LIB>istr/a-z+.-/A-ZP__/of<lib>.<M>MKC_REQUIRE_PKGCONFIGβ the same asMKC_REQUIRE_PKGCONFIG, but absence of library is treated as a fatal error (see configure target).PCNAME.<lib>β on some systems several versions of the same library may be installed to different directories (for examplelibluafor Lua 5.1 and 5.2). In order to avoid conflicts between them, pc name is changed (for example,lua5.1andlua5.2instead oflua). This variable is a map from library name to pc name.<Iu>[${lib}]PKG_CONFIG.exists.<lib>β if"1",<lib>exists,"0"otherwise. Inside<lib>the symbols<=,>=,=,<and>are replaced with_le_,_ge_,_eq_,_lt_and_gt_respectively.<Iu>PKG_CONFIG.var.<lib>.<var>β variable value (pkg-config --variable=<var> <lib>).<Iu>PKG_CONFIG_VARS.<lib>β list of variables to check for library<lib>.<M>
π mkc_imp.pod.mk π
mkc_imp.pod.mk is an internal include file that gets 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. conversion of POD documents to MAN pages (suffix rules: .pod.1, ... , .pod.9) and HTMLs (.pod.html). The following variables are provided:
POD2HTMLβ path to POD to HTML conversion utility.<Iu>[pod2html]POD2HTML_FLAGSβ flags passed to${POD2HTML}.<Iu>[]POD2MANβ path to POD to MAN conversion utility.<Iu>[pod2man]POD2MAN_FLAGSβ flags passed to${POD2MAN}.<Iu>[-r '' -n '${.TARGET:T:R}' -c '']
π§ mkc_imp.dep.mk π§
mkc_imp.dep.mk is an internal include file that gets included from mkc.prog.mk and mkc.lib.mk. Do not use it directly! This include file contains the default targets for building .depend_${.CURDIR:T} files. It creates .d files from entries in SRCS and DPSRCS that are C, C++, or Objective C source files, and builds .depend_${PROJECTNAME} 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:
DPSRCSβ list of source files which are needed for generating dependencies, but are not needed in${SRCS}.MKDEP_CCβ compiler passed tomkdep(1).<Iu>[${CC}]SRCSβ the same as inmkc.prog.mkandmkc.lib.mk.
π mkc_imp.foreign_autotools.mk π
This module is activated if variable FOREIGN is set to "autotools" and provides support for building external projects using autotools. It also provides a recursive target mkgen for generating "configure" script, "Makefile.in" file etc. using autoreconf(1) utility. The following variables are provided:
AT_AUTORECONF_ARGSβ arguments passed toautoreconf(1).<U>[-sif]AT_CONFIGURE_ARGSβ extra arguments passed to"configure"script set in addition to standard ones (--prefix,--bindiretc.).<Mu>[]AT_CONFIGURE_ENVβ environment variables for"configure"script set in addition to standard ones (CC,CFLAGSetc.).<Mu>[]AT_MAKEβmake(1)-like utility for the project.<Imu>[${MAKE}]AT_USE_AUTOMAKEβ if"yes",automake(1)is used.<M>[yes]FSRCDIRβ relative (to${.CURDIR}) or absolute directory to autotools-based sources.
π mkc_imp.help.mk π
This mk file implements targets help, help_subprj and help_use.
help_useβ outputs the configuring options available for the project and descriptions for their values. Configuring options should be specified in theUSE_VARIABLESvariable described below.help_subprjβ outputs the list of subprojects (mkc.subprj.mk) and their descriptions. Subprojects are mentioned inSUBPRJandSUBPRJ_DFLTvariables. Descriptions are specified in theHELP_MSG.<subproject>variable.USE_VARIABLESβ a list of configuring variables. Let's assume that the only configuring variable isUSESOMETHINGand the valid values for it are:no(the default) andyes. Then developer may provide the following assignments inMakefile:
USE_VARIABLES += USESOMETHING
USESOMETHING.descr = "Configuring parameter SOMETHING"
USESOMETHING.0 = "no: disable feature SOMETHING"
USESOMETHING.1 = "yes: enable feature SOMETHING"
<M> [unset]
HELP_MSG.<subproject>β description for project<subproject>.<M>[unset]
π CROSS COMPILATION π
The following variables are used for compiling software using cross-tools.
MACHINE_GNU_PLATFORMβ seeTOOLCHAIN_PREFIX.OPSYS_TARGETβOPSYSfor target OS.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,SIZEandSTRIP.<U>[]TOOLDIRβ seeTOOLCHAIN_DIR.TOOLCHAIN_DIRβ directory that contains cross-toolchain.<U>[${TOOLDIR}/bin]TOOLCHAIN_PREFIXβ seeSYSROOT.<U>[${MACHINE_GNU_PLATFORM}-]
π ENVIRONMENT VARIABLES π
MAKECONFβ path tomk.conffile included bymkc.*.mkfiles
okay final stretch bestie, we're in the endgame now β¨
π FILES π
these are the config files mkc.init.mk goes looking for β no cap, it literally peeks at them:
/etc/mkcmake.confβ this one gets included bymkc.init.mkif it exists π/etc/mk.confβ and this one also gets included bymkc.init.mkif it exists π«Ά
both are a "if it's there, we're using it" situation. if it's not there? it's not there, moving on, slay πΈ
π BUGS π
okay so this is the one thing that will lowkey humble you:
theconfiguretarget (that'sconfigure, yes literallyconfigure) does not support parallel builds. nope. not a vibe. it simply refuses. π
so if you want your project built in parallel, you gotta do it in two steps like this β run configure first, all alone, no -j, no friends:
mkcmake configure
mkcmake -j4 all
that's it. configure does its solo main character moment, and then you let -j4 cook π₯
π¦ SEE ALSO π¦
go read these next, bestie β they're the whole friend group π
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 π
this whole iconic situation was brought to you by:
Aleksey Cheusov <vle@gmx.net>
give them their flowers, they earned them πΈπ
and that's a wrap on the whole page, bestie!! π the source/version here is MK-CONFIGURE(7) and it's dated Dec 16, 2023 β so go forth, configure things, and remember: configure first, -j4 after. no cap. periodt πβ¨π
π¦ where this page comes from
- arch rolling: mk-configure 0.40.3-1 Β· BSD
- Copyright (c) 2009-2023 by Aleksey Cheusov (vle@gmx.net)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms