BSDBuild Logo

BSDBuild Manual

(Printable Version)
build.prog.mk(5)

SYNOPSIS

include <build.prog.mk>

DESCRIPTION

The build.prog.mk module compiles a set of source files and links the resulting object files with any required libraries into a target executable or compiled code.

It supports source in the following languages:
  • Ada (*.adb, *.ads)
  • Assembler (*.asm)
  • C (*.c)
  • C++ (*.cc or *.cpp)
  • Lex (*.l)
  • Objective C (*.m)
  • Yacc (*.y)

TARGETS

${PROG} Compile/link the ${PROG} executable from the specified source files.
clean-prog Clean up object and executable files.
cleandir-prog Clean up for packaging.
install-prog Install program to the target installation directory (see build.common.mk(5)).
deinstall-prog Uninstall program from the installation directory.

VARIABLES

SRCS List of source files to compile into the target executable.
SRCS_GENERATED List of source files (subset of ${SRCS}) which are auto-generated. Files in this list will be processed before anything else is compiled.
PROG Filename of target executable. Platform-specific transforms may be applied to the name.

If cross-compiling to WebAssembly (using "emscripten" target), ${PROG} is expected to have the extension ".html", ".js", ".mjs" or ".wasm".
PROG_LINKER_TYPE Select the type of linker. It can be one of:
CThe C linker (e.g. CC and CFLAGS). The default if SRCS only contains *.c files.
CXXThe C++ linker (e.g. CXX and CXXFLAGS). The default if SRCS contains at least one *.cpp file.
CL65The cc65 linker. Default if HAVE_CC65 is set.
ADAThe Ada binder / linker. Default if SRCS contains *.ad[bs] files exclusively.
PROG_TYPE Platform-specific program type. Set to "CLI" (command-line utility), "GUI" (graphical user interface) or "DAEMON" (server program). Defaults to "CLI".
PROG_INSTALL Program can be installed. Defaults to "Yes". Setting this to "No" makes the install target a no-op.
PROG_PREFIX Prepend this string to installed executable name.
PROG_SUFFIX Append this string to installed executable name.
PROG_TRANSFORM Apply this sed(1) expression to installed executable name.
PROG_GUID An optional Global Unique Identifier (GUID).
ADA Compiler for Ada sources. Defaults to "ada" or "gcc".
ADABIND Ada binder. Defaults to "gnatbind".
CC Compiler for C, C++ and Objective C sources. Defaults to "cc", "clang" or "gcc".
PROG_PROFILE Set "Yes" to compile with profiling instrumentation.
ADAFLAGS Compiler flags for Ada sources.
ADABFLAGS Flags to pass to the Ada binder.
CFLAGS Compiler flags for C sources. Defaults to "-O2 -g".
CXXFLAGS Compiler flags for C++ sources. Defaults to "".
OBJCFLAGS Compiler flags for Objective C sources. Defaults to "${CFLAGS}".
CPPFLAGS C preprocessor flags. Defaults to "".
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 (win32) Path to the windres(1) utility.
WINRES (win32) Windows resource files for windres(1).
DATAFILES List of data files to install into ${DATADIR}. The files must exist in the build directory (which may be separate from the source directory if configure --srcdir was used).
DATAFILES_SRC Files to install into ${DATADIR}. This variable is handled similarly to DATAFILES,except that the specified files must exist in the source directory.
BINDIR Target installation directory for executables.
CONFDIR System-wide configuration files will be installed into this directory. Typically set to "${SYSCONFDIR}" or "${SYSCONFDIR}/MyApplication".
CONF List of configuration files to install into ${CONFDIR}. Note that the install target will not override existing configuration files, instead it will output a The following configuration files have been preserved message.
CONF_OVERWRITE Overwrite any existing configuration file on installation. Default is "No".
CLEANFILES Any extra files that the clean target should remove.
CLEANDIRFILES Any extra files that the cleandir target should remove.

SEE ALSO


HISTORY

build.prog.mk first appeared in BSDBuild 1.0.

BSDBuild is based on the 4.4BSD build system.

Csoft.net ElectronTubeStore