commit 0a97400c9e6771c9174f4b102668ca79f6bba2b6
parent c6f0fbb6f0cebee1b38a6a8cac9c470e5159b90d
Author: Bharatvaj Hemanth <bharatvaj@getsh.org>
Date: Sat, 26 Nov 2022 01:29:51 +0530
Pretty basic support for cmake default build
Diffstat:
5 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -11,6 +11,9 @@ $(PROGRAM): $(SRC) config.h
clean:
rm $(PROGRAM)
+install: $(PROGRAM)
+ cp $(PROGRAM) $(DESTDIR)/$(PREFIX)
+
test:
@./$(PROGRAM) ENABLE_DEBUG=1
diff --git a/README b/README
@@ -21,3 +21,12 @@ mapper files
------------
`fmake` has the analogy of mapper files which can be used to make a project.
+
+USAGE
+-----
+
+To avoid complexity, fmake does not fork any process to run the commands. It just prints out the right command.
+
+`make='$(fmake)'` This should be added in your .bash_profile, .zshrc for fmake to work.
+
+When none is found, it just defaults to the `make` in $PATH
diff --git a/config.h b/config.h
@@ -24,11 +24,11 @@ static const char* cmdlists[] = {
ARG, cmdlists[ARG]
static const maker_config_t makers[] = {
- { "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" },
+ { "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/" },
};
static int8_t *detected_indices = 0;
diff --git a/config.mk b/config.mk
@@ -1,3 +1,4 @@
VERSION := 0.1.0
CFLAGS := -DFMAKE_VERSION=$(VERSION)
+PREFIX ?= usr/local/bin
diff --git a/fmake.c b/fmake.c
@@ -11,7 +11,7 @@
// output the full commands
void process_build() {
- printf("%s", maker.cmd);
+ printf("%s %s", maker.cmd, maker.args);
}
char* process_string() {
@@ -32,6 +32,6 @@ char* process_string() {
// fmake -- --preset x86-64-apple-darwin
int main(int argc, char* argv[]) {
- printf("%s\n", process_string());
+ process_string();
return -1;
}