1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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.3.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.
|