hachem.wtf
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-08 00:12:14 +0200
committerhachem <im@hachem.wtf>2026-09-08 00:12:14 +0200
commit11863e3b26124f96595e416952f4d676ccbe62fe (patch)
treebe5da5189741d18a21b4f1ab34b087d457d7ed8e
parenta8e40175eac1d7e1cdf89554d10c9b087fd92fb3 (diff)
docs: update README+LICENSE and add `man` page
-rw-r--r--LICENSE22
-rw-r--r--README.md67
-rw-r--r--mkproj.1152
3 files changed, 241 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..b6c3c6f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2026 hachem
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index dd9d25d..ab3d0ae 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,68 @@
# mkproj
+Just a dumb bullshit utility that generates build system boilerplate and gets the fuck out of your way.
+
+Like, imagine you want to start a new project. Maybe it's something scalable, maybe it's just some stupid scratch program to test an idea. Either way, before you've written a single line of the thing you actually want to make, you have to pick a build system, because project management in C is fucking cancer. Then you have to go out of your way to write a `Makefile`, or a `CMakeLists.txt`, or whatever other configuration file your build system decided it needed, instead of just actually writing whatever the fuck it is you wanted to write.
+
+`mkproj` fixes that. It makes a directory, generates the boilerplate for the build system you picked — currently `make`, `cmake`, `meson`, and `premake` — and that's it. You get a project you can immediately build, and you never use `mkproj` again.
+
+There are a couple of things you can customize: whether it initializes a git repository, the language (`c`, `cpp`, or, god forbid, `objc`), the language standard, where your build output goes, and whether you want a separate intermediate directory for object files. But most of the time, you shouldn't have to think about any of that.
+
+```sh
+$ mkproj hello
+```
+
+That's a C project using `make`. `cd hello && make` and you're off.
+
+## Usage
+```text
+$ mkproj --help
+mkproj 0.1.0 - dumb project generator
+
+generates boilerplate for make, cmake, meson or premake so you can stop
+writing the same fucking build files every time you start a project.
+
+usage: mkproj [-l lang] [-s std] [-b system] [--no-git] [--intermediate]
+ [--bin dir] [--bin-int dir] [--no-clangd] <name>
+ mkproj [-v | -h]
+
+options:
+ -l, --lang LANG language: c, cpp, objc (default c)
+ -s, --std STD language standard (default per language)
+ -b, --build SYSTEM build system: make, cmake, meson, premake (default make)
+ --no-git don't initialize a git repository
+ --intermediate use a separate intermediate object directory
+ --bin DIR build directory (default per build system)
+ --bin-int DIR separate object dir for make/premake; implies --intermediate
+ --no-clangd don't ignore clangd files in .gitignore
+ -v, --version print version and bail
+ -h, --help print this and bail
+
+by hachem <im@hachem.wtf>
+```
+
+```sh
+$ mkproj hello # C + make, the default
+$ mkproj -l cpp -s c++20 -b cmake app # C++20 + cmake
+$ mkproj -l objc -b meson gui # Objective-C + meson
+$ mkproj -b make --bin-int obj tool # objects in obj/, binary in bin/
+$ mkproj --no-git scratch # don't bother with git
+```
+
+## Build
+
+Needs a C compiler. Nothing else.
+
+```sh
+$ sudo make install # -> /usr/local/bin + man page
+$ make install PREFIX=~/.local # or somewhere without sudo
+```
+
+It really is one file, so if you don't want the Makefile:
+
+```sh
+$ cc -O2 mkproj.c -o mkproj
+```
+
+## License
+
+`mkproj` is licensed under the MIT License. See [LICENSE](LICENSE) for more.
diff --git a/mkproj.1 b/mkproj.1
new file mode 100644
index 0000000..145f73e
--- /dev/null
+++ b/mkproj.1
@@ -0,0 +1,152 @@
+.TH MKPROJ 1 "2026-09-07" "mkproj 0.1.0" "User Commands"
+.SH NAME
+mkproj \- dumb project generator
+.SH SYNOPSIS
+.B mkproj
+.RI [ options ]
+.I name
+.br
+.B mkproj
+.BR \-v | \-h
+.SH DESCRIPTION
+.B mkproj
+generates boilerplate for
+.BR make ,
+.BR cmake ,
+.B meson
+or
+.B premake5
+so you do not have to keep writing build files for small projects.
+.PP
+It creates a directory
+.I name
+containing a
+.B src
+directory with a stub
+.IR main ,
+a build file for the chosen build system, a
+.B .gitignore
+and, unless disabled, an initialized git repository. The stub compiles
+cleanly under a strict set of warnings with address and undefined
+sanitizers enabled by default.
+.SH OPTIONS
+.TP
+.BR \-l ", " \-\-lang " " \fIlang\fR
+Source language:
+.BR c ", " cpp " or " objc .
+Default
+.BR c .
+.TP
+.BR \-s ", " \-\-std " " \fIstd\fR
+Language standard passed to the compiler as
+.BI \-std= std\fR,
+for example
+.B c17
+or
+.BR c++23 .
+Must be valid for the chosen language. Defaults to
+.B c17
+for
+.B c
+and
+.BR objc ,
+and
+.B c++23
+for
+.BR cpp .
+.TP
+.BR \-b ", " \-\-build " " \fIsystem\fR
+Build system to generate:
+.BR make ", " cmake ", " meson " or " premake .
+Default
+.BR make .
+.TP
+.B \-\-no\-git
+Do not initialize a git repository.
+.TP
+.B \-\-intermediate
+Compile objects into a separate directory (see
+.BR \-\-bin\-int ).
+Only meaningful for
+.B make
+and
+.BR premake .
+.TP
+.BR \-\-bin " " \fIdir\fR
+Build directory. The default depends on the build system:
+.B bin
+for
+.B make
+and
+.BR premake ,
+.B build
+for
+.BR cmake ,
+and
+.B builddir
+for
+.BR meson .
+The final executable is written here.
+.TP
+.BR \-\-bin\-int " " \fIdir\fR
+Separate directory for intermediate object files. Implies
+.BR \-\-intermediate ,
+and applies only to
+.B make
+and
+.BR premake .
+Default
+.BR bin\-int .
+.TP
+.B \-\-no\-clangd
+Do not add clangd files
+.RB ( .clangd ", " compile_flags.txt ", " compile_commands.json )
+to
+.BR .gitignore .
+.TP
+.BR \-v ", " \-\-version
+Print version and exit.
+.TP
+.BR \-h ", " \-\-help
+Print a usage summary and exit.
+.SH "BUILD SYSTEMS"
+.B make
+and
+.B premake
+build objects and the executable into
+.BR \-\-bin ,
+or split objects into
+.B \-\-bin\-int
+when
+.B \-\-intermediate
+is given.
+.B cmake
+and
+.B meson
+use a single out\-of\-source build directory named by
+.BR \-\-bin ,
+so
+.B \-\-intermediate
+and
+.B \-\-bin\-int
+do not apply to them and are rejected if combined with either.
+.SH EXAMPLES
+.TP
+.B mkproj hello
+A C project built with make.
+.TP
+.B mkproj \-l cpp \-s c++20 \-b cmake app
+A C++20 project built with cmake.
+.TP
+.B mkproj \-b make \-\-bin\-int obj tool
+A make project with objects compiled into
+.BR obj/ .
+.SH "EXIT STATUS"
+.TP
+.B 0
+The project was generated.
+.TP
+.B 1
+A usage error, or a file or directory could not be created.
+.SH AUTHOR
+hachem <im@hachem.wtf>