A build system you work with directly in C. Like, literally. You just include make.h, use the macros (procrastinating on documentation), and you can use it to build!
A basic build.c:
#include "make.h"
#define CFLAGS "-std=c11 -Wall -Werror -Wextra"
START()
TARGET(main)
DEPS()
DEP("main.o")
DEPS_END()
OUTPUT(main)
COMMAND(CC" -o main main.o")
TARGET_END()
TARGET(main.o)
DEPS()
DEP_FILE("main.c")
DEPS_END()
OUTPUT(main.o)
COMMAND(CC" -c -o main.o main.c "CFLAGS)
TARGET_END()
TARGET(clean)
COMMAND(RM" main.o main")
TARGET_END()
END()Inspired by tsoding/nob.h!
make.h supports the following:
- selecting a target using the build output
- options, such as -t (lists commands) or -S (changes source directory, you should put one in your build.c)
- literally anything (it's just C macros, you can use C code inside of a
START()andEND()) - bootstrapping (the build script can rebuild itself)
- recursive dependencies
Also, instead of using time, make-h hashes files in 4096-byte chunks to determine the modification of a file.
- This "build system" isn't the best, so don't use it in big projects, just use CMake or Makefiles.
- A
.makedirectory is produced which contains the hashes of the files. - You should add a .gitignore for
.makein online repositories for .make if you are using -S. - -S will put the .make file in the source directory.
- -v for verbose mode
- -S [src_dir] to change the source directory
- -B [build_dir] to change the build directory (where target
OUTPUT()files are moved) - -s to silently build
- --help for a usage message