From a1bcfa5a946129c3f1b1a0dedc11b935bc6284b3 Mon Sep 17 00:00:00 2001 From: Noah Swerhun Date: Sun, 17 Sep 2023 21:50:16 -0500 Subject: [PATCH] initial commit --- .gitignore | 5 +++++ Cargo.toml | 8 ++++++++ README.md | 14 +++++++++++++- src/main.rs | 15 +++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore index 3ca43ae..193d30e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb + + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..cf61e08 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "mgen" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/README.md b/README.md index 238712c..f04d321 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ # mgen -Makefile generator for C projects \ No newline at end of file +Makefile generator for C projects. + +`mgen` automatically generates build rules for all source files (extension `.c`) +it finds in a recursive search of the directory in which it is run. It reads the +varibles from your existing Makefile and uses them when generating the new +targets. + +The following varibles are supported: + - CC -> C compiler + - CFLAGS -> compilation flags + - LDLIBS -> linker libraries + - LDFLAGS -> linker flags + - TARGET -> name of final executable/library diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..0bc6add --- /dev/null +++ b/src/main.rs @@ -0,0 +1,15 @@ +use std::fs; + +fn main() { + let files = fs::read_dir("./").unwrap(); + + for file in files { + let file = file.unwrap(); + + let is_dir = file.metadata().unwrap().is_dir(); + + if is_dir { + println!("{}", file.path().to_str().unwrap()); + } + } +}