fmake

make any project just by typing `fmake`

commit 1a3efd728daef82de7eaa80ff308e110e0170d72
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Fri, 25 Nov 2022 21:44:34 +0530

Brave new world
4 files changed, 61 insertions(+), 0 deletions(-)
A
Makefile
|
11
+++++++++++
A
README
|
8
++++++++
A
config.h
|
10
++++++++++
A
fatmake.c
|
32
++++++++++++++++++++++++++++++++
diff --git a/Makefile b/Makefile
@@ -0,0 +1,11 @@
+SRC = fatmake.c
+
+all: fatmake
+
+fatmake: $(SRC)
+
+clean:
+	rm fatmake
+
+test:
+	./fatmake ENABLE_DEBUG=1
diff --git a/README b/README
@@ -0,0 +1,8 @@
+fatmake
+-------
+
+An attempt at saving developers time.
+
+fatmake is a program that brings `make`s interface to almost any build system.
+
+See this |list.txt| for the number of build systems available.
diff --git a/config.h b/config.h
@@ -0,0 +1,10 @@
+#include <stdint.h>
+
+static int8_t *detected_indices = 0;
+static char* maker = 0;
+
+static const char* filenames[] = {
+	"Makefile",
+	"makefile"
+};
+
diff --git a/fatmake.c b/fatmake.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "config.h"
+
+// Two things to do
+// scan directory and pick out the maker
+// process the input string and convert it for the `maker`
+// output the full commands
+
+char* process_string() {
+	char* s = (char*)malloc(256);
+	strcpy(s, "hello, wold");
+	struct stat st = {0};
+	for (int i = 0; i < sizeof(filenames); i++) {
+		if (!stat(filenames[i], &st)) {
+			printf("File detected %s", filenames[i]);
+			break;
+		}
+	}
+	return s;
+}
+
+// support -- arguments for cmake and other stuff
+// fmake -- --preset x86-64-apple-darwin
+
+int main(int argc, char* argv[]) {
+	printf("%s\n", process_string());
+	return -1;
+}