Boxberry: A build system which scales down
Boxberry is a build system which aims to be usable for tiny projects,
all the way down to single source files.
Not all projects need a big Makefile or a huge CMakeLists.txt.
However, almost all projects grow to the size where they need some library,
or some compiler flag, maybe an optimization option.
Boxberry aims to make the path from running cc file.c to running
cc -lpthread file.c to cc file.c $(pkg-config --libs --cflags libfoo) -lpthread
as easy as possible.
- Source files are automatically discovered (by default).
- Dependencies can be specified in the source file:
//#bx pkgs := libfoo
- Linker and compiler flags can be specified in the source file:
//#bx ldlibs := -lpthread ldflags := -fsanitize=address cflags := -fsanitize=address
- A source file is automatically recompiled if it has changed, or if any
included header files have changed.
- If your project grows, you can put global configs in a
build.bx file.
Each directory can have a build.bx file, and each directory inherits the
configuration of its parent.
- Files can be specified instead of discovered automatically by setting the
files variable in a build.bx file.
Building
This project can be built by running either make or box.
The only dependency is pthreads.
TODO
Add --print-compile-commands
Consider changing the config file format name from BBB to BB
- Support different build configurations (requires conditionals in the parser)
Re-work the command-line interface
Save build configuration in the output dir
Support one “main” build.bx file which specifies things like the target name
- Support creating shared/static libraries too, not just binaries
- Implement recursive mkdir in C++ instead of shelling out to mkdir
- Support subprojects
Look into saving the result of $(CC) -MM to make recompiles faster when
little has changed