hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ab3d0aee142d76b083da55ca61988e31b838520f (plain)
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.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.