Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

make.h

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!

What can it do?

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() and END())
  • 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.

Notes

  • This "build system" isn't the best, so don't use it in big projects, just use CMake or Makefiles.
  • A .make directory is produced which contains the hashes of the files.
  • You should add a .gitignore for .make in online repositories for .make if you are using -S.
  • -S will put the .make file in the source directory.

All the options you can use

  • -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

About

A build system you work with directly in C.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages