fmake

make any project just by typing `fmake`
git clone git@getsh.org:fmake.git
Log | Files | Refs | README | LICENSE

commit b980866e759a9f0741d02fc1c8de5632bd9c9f8d
parent 0a97400c9e6771c9174f4b102668ca79f6bba2b6
Author: Bharatvaj Hemanth <bharatvaj@getsh.org>
Date:   Sat, 26 Nov 2022 01:51:41 +0530

Default to `make` when project maker not found

Add basic support for nodejs

Diffstat:
MREADME | 3+++
Mconfig.h | 4++++
Mfmake.c | 10+++++++---
3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/README b/README @@ -17,11 +17,14 @@ make - 2 fmake "intelligently" knows what targets to build + mapper files ------------ `fmake` has the analogy of mapper files which can be used to make a project. +These can be configured in the config.h file. + USAGE ----- diff --git a/config.h b/config.h @@ -4,6 +4,8 @@ typedef enum { FMAKE_POSIX_MAKEFILE, FMAKE_GNU_MAKEFILE, FMAKE_BSD_MAKEFILE, + FMAKE_AUTOCONF, + FMAKE_CONFIGURE, FMAKE_CMAKE, } maker_t; @@ -24,11 +26,13 @@ static const char* cmdlists[] = { ARG, cmdlists[ARG] static const maker_config_t makers[] = { + { "configure", FMAKE_CMAKE, "sh", "configure" }, { "Makefile", FMAKE_POSIX_MAKEFILE, "make", "" }, { "makefile", FMAKE_POSIX_MAKEFILE, "make", "" }, { "GNUMakefile", FMAKE_GNU_MAKEFILE, "gmake", "" }, { "BSDMakefile", FMAKE_BSD_MAKEFILE, "bmake", "" }, { "CMakeLists.txt", FMAKE_CMAKE, "cmake", "-B out/" }, + { "package.json", FMAKE_CMAKE, "npm", "install" }, }; static int8_t *detected_indices = 0; diff --git a/fmake.c b/fmake.c @@ -14,18 +14,22 @@ void process_build() { printf("%s %s", maker.cmd, maker.args); } -char* process_string() { - char* s = (char*)malloc(256); +void process_string() { struct stat st = {0}; + short maker_found = 0; for (int i = 0; i < sizeof(makers); i++) { const char* filename = makers[i].filename; if (!stat(filename, &st)) { maker = makers[i]; + maker_found = 1; process_build(); break; } } - return s; + if (maker_found == 0) { + maker = makers[FMAKE_POSIX_MAKEFILE]; + process_build(); + } } // support -- arguments for cmake and other stuff