Skip to content

minys/minymake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# minymake

 Small non-recursive build enginge inspired by Robert Miller's "Recursive Make
 Considered Harmful".

 minymake goals is to provide a simple mechanism to build and link programs and
 libraries. Secondary goals are speed and robustness, which means non-recursive
 implementation using some tricks to detect changes to parameters affecting the
 process of compiling and linking programs and libraries. If you are looking
 for something with more bells and whistles I would recommend CMake or
 something similar.

 To start using minymake, copy build.mk into your project directory structure
 and add module files (make fragments). See the test/project for an example
 deployment.


## Modules

 A module is a make fragment that is responsible for declaring dependencies for
 one target. A target is either a program or a library. Modules cannot include
 other modules, so a bigger project needs to include all modules from one top
 level makefile (or several separate ones).

 Modules are listed in a top level makefile in the MODULES variable.

 A module *must* declare either of the following variables:

     bin      : Name of the executable that this module is responsible for.

     sbin     : Name of the system executable that this module is responsible for.

     lib      : Name of the library that this module is responsible for.

 A module *must* declare the following varables

and

     src      : Whitespace separated list of source files used to build
                'target'. Mandatory if 'target' is defined.

     cflags   : Target specific CFLAGS.

     cxxflags : Target specific CXXFLAGS.

     ldflags  : Target specific LDFLAGS.

 Note that targets, source files etc should be referenced through a relative
 path preferable from a module file reciding in the same location as the source
 or target file(s).

 Project wide configuration can be done in a top level makefile (see
 test/project for an example). Header files needs to be handled through
 cflags, cxxflags and ldflags, there is no mechanism to automatically export
 header files to the rest of the project. Include directives should use SRCDIR
 as base directory, paths to libraries during linking should use BUILDDIR as
 base.


## Configuration

 The following variables can be defined before including build.mk, or passed on
 the make command line. They are used to pass options to minymake itself, the
 the compiler or linker.

 Miscellaneous variables:

     PROJECT       : Project name (default: unknown).
     MAJOR_VERSION : Major version (default: 0).
     MINOR_VERSION : Minor version (default: 0).

     VERBOSE       : If defined, echo commands as they are executed.
     BUILDDIR      : If defined, files are generated rooted at BUILDDIR using the
                     same directory structure as they appear in the source tree.

 External tools, override if needed:

     CC       : C compiler
     CXX      : C++ compiler
     INSTALL  : install command
     PRINTF   : printf command

 Compiler and linker variables:

     ARCHIVE_PREFIX   : Object archive (default: lib).
     ARCHIVE_SUFFIX   : Object archive suffix (default: a)
     CC_SUFFIX        : Suffix for C files (default: c).
     CXX_SUFFIX       : Suffix for C++ files (default: cc).
     CFLAGS           : C compiler options, always applied.
     CXXFLAGS         : C++ compiler options, always applied.
     LDFLAGS          : Linker options, always applied.
     LIB_PREFIX       : Library prefix (default: lib).
     LIB_SUFIX        : Library suffix (default: so).
     DEBUG_CFLAGS     : C compiler flags added when 'debug' target is invoked.
     DEBUG_CXXFLAGS   : C++ compiler flags added when 'debug' target is invoked.
     COV_CFLAGS       : C compiler flags added when 'coverage' target is invoked.
     COV_CXXFLAGS     : C++ compiler flags added when 'coverage' target is invoked.
     COV_LDFLAGS      : Linker flags added when 'coverage' target is invoked.
     RELEASE_CFLAGS   : C compiler flags added when 'release' target is invoked.
     RELEASE_CXXFLAGS : C++ compiler flags added when 'release' target is invoked.
     STATIC_CFLAGS    : C compiler flags added when 'static' target is invoked.
     STATIC_CXXFLAGS  : C++ compiler flags added when 'static' target is invoked.
     STATIC_LDFLAGS   : Linker flags added when 'static' target is invoked.

 Installation directories:

     BINDIR         : binaries (default: bin)
     INCLUDEDIR     : header files (default: include)
     LIBDIR         : libraries (default: lib)
     LIBEXECDIR     : libexec (default: libexec)
     
 Permissions used while installing:

     BIN_PERM       : binaries (default: 755)
     LIB_PERM       : libraries (default: 644)

     FORCE_INSTALL  : If defined, 'install' target will install everything even
                      if none or some of the files have not been rebuilt.


## Building

 minymake provides the standard GNU targets with some exceptions/additions:

     release          : Build all using RELEASE_CFLAGS, RELEASE_CXXFLAGS and
                        RELEASE_LDFLAGS.
     debug            : Build all using DEBUG_CFLAGS, RELEASE_CXXFLAGS and
                        DEBUG_LDFLAGS.
     coverage         : Build all using COV_CFLAGS, COV_CXXFLAGS and
                        COV_LDFLAGS.
     static           : Build all using STATIC_CFLAGS, STATIC_CXXFLAGS and
                        STATIC_LDFLAGS.
     clean            : Remove all generated objects.
     install          : Build and install to DESTDIR.
     install-strip    : Install and strip binaries.
     uninstall        : Uninstall project.

## Example

 Please see the project located in the test directory, it uses all features
 that minymake provides and offers a pretty good starting point.

About

Non-recursive, make based build system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published