tsoding / nob.h
- воскресенье, 17 августа 2025 г. в 00:00:01
Header only library for writing build recipes in C.
This library is the next generation of the NoBuild idea. "nob" stands for "nobuild", but it's shorter and more suitable as a prefix for a library.
For my previous iteration on this idea see https://github.com/tsoding/nobuild, but I do not recommend to use it.
The idea is that you should not need anything but a C compiler to build a C project. No make, no cmake, no shell, no cmd, no PowerShell etc. Only C compiler. So with the C compiler you bootstrap your build system and then you use the build system to build everything else.
I'm not sure if this is even a good idea myself. This is why I'm implementing it. This is a research project. I'm not making any claims about suitability of this approach to any project.
Right now I'm actively using nob in a variety of my C projects at https://github.com/tsoding/. It works quite well for me there.
If you are using cmake with tons of modules to manage and find tons of dependencies you probably don't want to use this tool. (But in that case I personally think you have much bigger problem than a build system). NoBuild is more like writting shell scripts but in C.
You know all these BS movements that supposedly remove the root cause of your problems? Things like NoSQL, No-code, Serverless, etc. This is the same logic. I had too many problems with the process of building C projects. So there is nobuild anymore.
The only file you need from here is nob.h. Just copy-paste it to your project and start using it. See how_to/ folder for examples.
This is obviously applicable not only to C. You can implement the same kind of approach for other languages (apart from the languages that support this natively, of course). Here is few examples in the wild:
Feel free to contribute more