Simple (to use), one-file build tool for C/C++ projects.
- It's a simple build tool for C/C++ projects
- Its instructions on what to build are directly stored within the source code itself (included as a header file), making it compact
- You can choose between four different build types
- It makes sure to recompile a file if their dependency (either header file or library) was modified
- Clone this repository into a folder
- Add that folder to your PATH (what's that?)
- (Optional) In your project, create a
bd.conf
(see configuration) - Run
bd
in your project
To see a list of all available commands and their description, run ./bd -h
. Most important commands:
build
build the projects (providing no arguments defaults to this)clean
clean the messclean build
basically rebuild
Following colors were picked depending on the action:
- blue = compiling
- yellow = linking
- green = up to date
- magenta = cleaning
Have a bd.conf
file in your root project, where you would normally put your Makefiles.
- This file should / will be included in
bd.c
asCONFIG
. - If you use
bd.bat (Windows)
orbd (Linux etc.)
the above is handled automatically.
BUILD_APP
builds an executableBUILD_STATIC
builds a static libraryBUILD_SHARED
builds a shared libraryBUILD_EXAMPLES
same as app, but it links each specified file
String of your output file (without extension).
- If you're building a library, precede the name with
lib
- If you're building examples, the name is treated as a folder name instead
- For applications, if it's
null
it defaults toa
In this folder all the object (.o
) and dependency (.d
) files will be dumped.
String-array of source files necessary to successfully compile and link the project together. It's recommended to only use *
and ?
when pattern matching to support all operating systems.
String with your own flags. It's recommended to always at least include -Wall
.
String with your own linker options.
String with your own linker libraries.
- Precede paths with the
-L=
flag. (make sure to include the equals sign) - precede names with the
-l=
flag. (make sure to include the equals sign)
String specifying C compiler to use.
- If it's
null
it defaults togcc
String specifying C++ compiler to use.
- If it's
null
it defaults tog++
/* file: `bd.conf` */
{
.type = BUILD_APP,
.name = "app_name",
.objd = "obj",
.srcf = D("src/*.c"),
.cflgs = "-Wall -O2",
}
/* file: `bd.conf` */
{
.type = BUILD_APP,
.name = "app_name",
.objd = "obj",
.srcf = D("src/*.cpp"), /* .cpp or .cc both work */
.cflgs = "-Wall -O2",
}
See https://github.com/rphii/Rlib where I created a library and used it to link with examples.
{.srcf = D("*.c")}
- Windows
- Cygwin
- Linux
- (...missing verification for the rest...)
- Don't have any spaces in any of the files having any business with this build tool
- If you use subfolders in the config, always use
/
and not\
, even on Windows - Among others,
Prj::name
andPrj::obj
can be a sequence of subfolders
- maybe multithreading
- verify if it works other platforms