BUILD.PROG.MK(5)

πŸ“¦ version 3.1, in nixos 26.05, nixpkgs unstable

✨ BUILD.PROG.MK(5) ✨

okay so bestie, welcome to build.prog.mk β€” the bsdbuild module, and it's literally the one that compiles executables for you πŸ’… (this is the build.prog.mk(5) page, File Formats Manual, in case you were wondering πŸŽ€)


🌸 SYNOPSIS 🌸

.include <bsd.prog.mk>

that's it. that's the whole vibe. one line and you're in 🫢


πŸ’– DESCRIPTION πŸ’–

So the build.prog.mk module is what you use to compile an executable program out of a bunch of source files. Iconic. And it comes with built-in support for sources in all of these languages, no cap:

  • C (*.c)
  • C++ (*.cc or *.cpp)
  • Objective C (*.m)
  • Assembler (*.asm)
  • Lex (*.l)
  • Yacc (*.y)

like it just knows. main character energy tbh πŸ‘‘


πŸ”₯ TARGETS πŸ”₯

  • ${PROG} β€” compiles/links the ${PROG} executable from the source files you specified. the whole point, honestly.
  • ${GMONOUT} β€” compiles/links a profiled version of ${PROG}. fancy.
  • clean-prog β€” cleans up the object files and executable files. self care ✨
  • cleandir-prog β€” cleans up for packaging.
  • install-prog β€” installs the program into the target installation directory (peep csoft.common.mk(5) for that one).
  • deinstall-prog β€” uninstalls the program from the installation directory. we love a reversible decision πŸ’€

πŸ¦‹ VARIABLES πŸ¦‹

  • PROG β€” filename of the target executable. heads up: platform-specific transforms may get applied to the name, so it might not come out exactly as you typed it πŸ‘€
  • PROG_TYPE β€” the type of application. set it to β€˜CLI’ for a command-line utility, β€˜GUI’ for a graphical interface, or β€˜DAEMON’ for a server program. defaults to β€˜CLI’. what this setting actually means is platform-specific β€” and on the Windows platform, it tells the compiler to pick the appropriate PE header subsystem πŸͺŸ
  • BINDIR β€” target installation directory for executables (usually set by configure).
  • PROG_INSTALL β€” if you set it to β€˜Yes’, the install target will install the program, otherwise it's a no-op. defaults to β€˜Yes’.
  • PROG_GUID β€” a Global Unique Identifier (GUID) for the program. exact interpretation is platform-specific 🀷
  • GMONOUT β€” output filename for the profiled version of the program.
  • CC β€” compiler for C, C++ and Objective C sources. defaults to β€˜cc’.
  • CFLAGS β€” compiler flags for C sources. defaults to β€˜-O2 -g’.
  • CXXFLAGS β€” compiler flags for C++ sources. defaults to β€˜β€™ (yes, empty, it's giving minimalism).
  • OBJCFLAGS β€” compiler flags for Objective C sources. defaults to β€˜${CFLAGS}’.
  • CPPFLAGS β€” compiler preprocessor flags, for sources in all languages that feature a C preprocessor.
  • ASM β€” compiler for assembler sources. defaults to β€˜nasm’.
  • ASMFLAGS β€” compiler flags for assembler. defaults to β€˜-g -w-orphan-labels’.
  • LEX β€” path to the lex(1) lexical analyzer generator.
  • YACC β€” path to the yacc(1) parser generator.
  • LFLAGS β€” options for lex(1), defaults to β€˜β€™.
  • YFLAGS β€” options for yacc(1), defaults to β€˜-d’.
  • LIBL β€” libraries to use for Lex lexers. defaults to β€˜-ll’.
  • WINDRES β€” (specific to the win32 platform) path to the windres(1) utility, which generates windows resource files.
  • WINRES β€” (specific to the win32 platform) resource file to use with windres(1).
  • DATAFILES β€” list of data files to install into ${DATADIR}. important: these files must have been generated from the build process β€” meaning if you're using a separate build with --srcdir, the files you specify must exist in the build directory. don't come for me, that's just how it is 😭
  • DATAFILES_SRC β€” files to install into ${DATADIR}. handled similarly to DATAFILES, except these specified files must exist in the source directory. see the difference? iconic.
  • CONFDIR β€” system-wide configuration files get installed into this directory. it's usually set relative to β€˜${SYSCONFDIR}’, for example β€˜${SYSCONFDIR}/MyApplication’.
  • CONF β€” list of configuration files to install into ${CONFDIR}. but bestie, listen β€” the install target will not override existing configuration files. instead it prints a β€œThe following configuration files have been preserved” message. respectful king behavior honestly 🫢
  • CONF_OVERWRITE β€” overwrite any existing configuration file on installation. default is "No".
⚠️ note the difference between DATAFILES (lives in the build directory) and DATAFILES_SRC (lives in the source directory) β€” mixing them up is a whole mood killer.

🌈 SEE ALSO 🌈


πŸ’œ HISTORY πŸ’œ

build.prog.mk first appeared in BSDBuild 1.0 ✨

BSDBuild is based on the 4.4BSD build system. heritage! legacy! we stan πŸ‘‘


that's the whole page bestie, go compile something cute πŸŽ€πŸ’–

Debian Β· July 18, 2007 Β· BUILD.PROG.MK(5) β€” mwah, that's the source and the date, signin' off πŸ’…βœ¨

πŸ“¦ where this page comes from