~elly/emkay unlisted

build tool?
4b45357e — Elly Fong-Jones 4 months ago
add explanatory comment
0ebf0221 — Elly Fong-Jones 4 months ago
start explaining & adding tests
c96947fd — Elly Fong-Jones 4 months ago
initial, hacky prototype!


browse  log 



You can also use your local clone with git send-email.

Emkay is an opinionated build system for C & C++ programs.

Specifically, emkay is designed for building a very specific style of program,
composed of separate modules, each with their own adjacent test code.

A module is composed of:
* A root directory, which is the directory in which the module's code and spec
* A name, derived from the filesystem path to the root directory
* A set of common source files, derived implicitly (see below)
* A set of test source files, derived implicitly (see below)
* A set of dependencies, which are modules that this module must be built after
* A type, which is one of:
  * binary: this module's contents & dependencies can be linked into an
            executable binary
  * static: this module's contents & dependencies can be linked into a
            static library
  * none (the default): this module's contents can't be independently linked

A module's sets of common source files and test source files are determined
implicitly - they are the set of every source file in the module's directory
that are not contained in another module with a longer name. A source file is
considered a test source file if its name contains '_test.'. When compiling
a test source file, Emkay defines the macro 'IN_TEST'.

Since all of these properties either have defaults or are computed implicitly,
any directory is an allowable module. A module's root directory may contain
a file named '.emkay', which contains explicit settings of these properties.
Modules whose root directory does contain such a file are called
'explicit modules', and other modules are called 'implicit modules'.

Emkay itself takes parameters:
* A "working directory" ($in), by default "."
* An "out directory" ($out), by default "./out"
* A set of targets ($targets), by default {}

It then does these steps:
1. Locate modules within $in but not within $out that are either:
  1a. Explicit modules, or
  1b. In $targets
2. Compute an ordering in which those modules should be built, such that no
   module is built before a module it depends on
3. Build the modules in that ordering
  3a. For binary modules, this produces a binary in $out
  3b. For static modules, this produces a static library in $out
  3c. For all modules, this produces object files in $out

Some notes on the implementation:

While this is not good practice in general, Emkay is a single source file to
make it easy to incorporate into other programs as a stand-alone program. It
has no external dependencies other than the standard C++ library.