mkproj/README.md

63 lines
2.4 KiB
Markdown
Raw Normal View History

2024-12-23 15:26:54 +01:00
# proj_tpl
2024-12-23 15:55:44 +01:00
Generic project templates for tools, filters, libraries in C++.
2024-12-23 17:14:52 +01:00
> [!Note]
2024-12-24 10:38:06 +01:00
> Alpha status, INCOMPLETE. Currently work is underway for the Makefile and script.
2024-12-23 17:14:52 +01:00
2024-12-23 15:55:44 +01:00
## Installation
2024-12-23 16:33:08 +01:00
Type `make` to install the `mkproj` script, its man page, and the templates.
2024-12-23 15:55:44 +01:00
The default location is to put everything inside your `~/.local` hierarchy, but
you can change that by defining an environment variable `PREFIX`, giving it your
desired root directory as a value, before typing `make`.
The actual location used will be recorded in a config file:
`~/.config/mkprojrc`, which will be read by the `mkproj` script. It needs to
know where your templates are in order to function.
2024-12-23 15:55:44 +01:00
## Overview
With `mkproj`, you can create a C++ project for a tool or a library.
2024-12-24 10:25:37 +01:00
The project can be:
2024-12-23 15:55:44 +01:00
2024-12-24 10:25:37 +01:00
- a simple tool, to test some idea;
2024-12-23 15:55:44 +01:00
- a more elaborate tool, meant to be distributed;
- a UNIX filter, which processes input files line by line, or reads from
standard input when there are no input files;
- a library, where both a static and a dynamic library will be built.
2024-12-24 10:25:37 +01:00
Apart from the simple tool, all of these can optionally:
2024-12-23 15:55:44 +01:00
- use a precompiled header for the C++ Standard Library;
- implement a plugin architecture, where building and installing plugins is
automatically supported.
At the center is a `Makefile`, which should not be altered. This `Makefile` can
build and install any of these projects. All project-specific additions should
be put in the mandatory `premake.make` (which is included at the start of the
Makefile), and in an optional `postmake.make` (which is included at the end of
the Makefile).
The `premake.make` typically defines some Make variables, whereas the
`postmake.make` typically contains extra Make targets.
2024-12-24 10:40:34 +01:00
The `premake.make` is mandatory, because it defines the *name* of the tool or
library, and its *version*. This is also where you declare external
2024-12-24 10:38:06 +01:00
dependencies.
2024-12-23 15:55:44 +01:00
2024-12-24 10:40:34 +01:00
Available Make targets for your project are:
2024-12-23 15:55:44 +01:00
- `make` will build the tool or library;
2024-12-24 10:40:34 +01:00
- `make test` will build and run tests, using the Boost Unit Test Framework;
2024-12-23 15:55:44 +01:00
- `sudo make install` will install it, and all of its accompanying files;
- `make clean` will remove compiled object files, but will keep a previously
built tool or library, and the precompiled header;
- `make dist-clean` will bring the project to a pristine state.
- `sudo make uninstall` will remove all installed files.
## Documentation
`man mkproj`