From 5a1fe0521f0b11c565a9a921a8e0748fdd98b82c Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 1 Jun 2025 02:07:40 +0200 Subject: [PATCH] Add quickstart --- gebs.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gebs.h b/gebs.h index 5bedf5b..1b3c13e 100644 --- a/gebs.h +++ b/gebs.h @@ -25,6 +25,51 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ +/* 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_