Add quickstart

This commit is contained in:
kamkow1
2025-06-01 02:07:40 +02:00
parent 6a10cb2847
commit 5a1fe0521f

45
gebs.h
View File

@ -25,6 +25,51 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org/>
*/
/* QUICKSTART
// Put into mybuild.c
// Building: cc -o mybuild mybuild.c
// Rebuilding: ./mybuild # will auto-recompile
#define GEBS_NO_PREFIX // strips the GEBS_ and gebs_ prefixes (optional)
#define GEBS_IMPLEMENTATION // include function definitions, not just declarations
#include "../gebs.h" // include gebs
int main(int argc, char ** argv)
{
// A gebs executable can recompile itself. We must supply a compiler commandline
// for recompiling. This means we can also put additional flags here.
rebuild_self(argc, argv, "cc", "-o", "self_rebuild", __FILE__);
// create a build directory
if (!exists1("build")) {
mkdir1("build");
}
// Create a dependecy:
//
// build/myapp
// (target)
// |
// / \
// / \
// / \
// myapp.c gebs.h
//
// This means that if files myapp.c or gebs.h change, build/myapp will be recompiled.
RULE("build/myapp", "myapp.c", "gebs.h") {
// commandline for building target build/myapp
// We can also check the error code of CMD(), but this is just an example.
CMD("cc", "-ggdb", "-o", "build/myapp", "myapp.c");
}
return 0;
}
*/
#ifndef GEBS_H_
#define GEBS_H_