mavescripts | ||
LICENSE | ||
mave | ||
README.md |
mave
O accursed C++ build system
Why?
make
made me very angry and cmake
couldn't find FLTK
Usage
Create a project like this:
git clone https://git.tobskep.com/tobskep/mave
cd mave
rm -r .git # there's probably a better way to do that
Then, edit this and stick it in ./mavescripts/config
.
PRODUCT="./my-app" # output binary
CXXFLAGS=`pkg-config --cflags my-lib` # C++ compiler flags
LDFLAGS=`pkg-config --libs my-lib` # linker flags
Under this config, you put your C/C++ source code in ./src
(or subdirectories therein.) Then,
you can compile your project like this:
./mave
Here are descriptions of every mave
config option:
Name | Description | Default |
---|---|---|
SRC_DIR | Where to find C++ source code | src |
OBJ_DIR | Where to place compiled objects | obj |
PRODUCT | Name of final binary to link | ./a.out |
SRC_TYPES | File extensions (without dot) to search for in $SRC_DIR |
cc|c|cpp |
HDR_TYPES | File extensions (without dot) to search for in source | hh|h|hpp |
CC | C/C++ compiler to use | cpp |
LD | Linker to use | $CC |
NO_OBJCHECK | A bad idea. |
Setting NO_OBJCHECK
to any value will bite you later. It disables a check that ensures that
there are no 'spare' object files floating around in $OBJ_DIR
, which may be from previous
builds of code that no longer exists. If you define a symbol in a source file, compile, delete
that source file and define the symbol again in another, this will cause a linker error and
it will be impossible to diagnose. This setting exists out of kindness and should not be
used in reasonable codebases.
mave
, however cursed it is, is fairly smart and checks whether an object file is newer or
older than your source code. It can also tell when headers that source code references are
changed and can rebuild object files correspondingly.
It is not a scripting language (a-la GNU make
) but rather a simple, rigid build system that
does one thing and does it well enough.
To delete object files and output binaries, you can do this:
./mave clean
This deletes the object dump and the binary it linked. It doesn't do anything else.
You can also force mave to rebuild the entire project:
./mave force
Which effectively does the same thing, only it cleans and rebuilds in one go.
Moving ./mavescripts
If you don't want to put the build modules in ./mavescripts
, you can rename the folder
and edit the following line at the top of the main mave
script:
export MAVE_DIR=./mavescripts
Known Limitations
- It can only compile C++ source code. It might be able to compile C source too, but I haven't tried it.
- It can't compile libraries (as far as I know). You'll likely have to edit the
link
script for that. (Please let me know if you do! My email istobskep@aol.com
.) - More to be found, probably!
- You can't change which compiler/linker it uses without editing the compile and link scripts respectively. I should fix that.
"mave"?
Microwave. AAGaming said I should release it on the condition that I give it
a stupid name. It also sounds like make
!
Reuse
License information can be found in LICENSE
. It's the MIT license, if you don't feel
like checking (I understand.)
You can credit me however you like (so long as you do) but I'd just like a mention in
your README and maybe a link to my website (tobskep.com
).