# ColorMake
A fast, lightweight tool to colorize make output for better readability.
## Installation
### Using Cargo Install
```sh
cargo install colormake
```
### Manual Installation
```sh
cargo build --release
install -m 755 target/release/colormake /usr/local/bin/
```
Or using the Makefile:
```sh
make build
make install
```
## Uninstallation
### Using Cargo Uninstall
```sh
cargo uninstall colormake
```
### Manual Uninstallation
```sh
rm /usr/local/bin/colormake
```
Or using the Makefile:
```sh
make uninstall
```
## Usage
### As a Make Wrapper (Recommended)
Use `colormake` as a drop-in replacement for `make`:
```bash
# Basic usage - runs 'make' with colored output
colormake
# Pass arguments to make
colormake clean
colormake install
colormake -j4
# Use a different make command
colormake --make-cmd gmake
# Custom make arguments
colormake -- -j8 CFLAGS="-O2"
```
### As a Pipe Filter
Pipe make output through colormake:
```bash
```
### Options
- `--help`: Show help message
- `--version`: Show version information
- `--no-color`: Disable color output (overrides automatic terminal detection)
- `--cols N`: Set output width (columns). Long lines are truncated with " .. "
separator
- `--lines N`: Number of lines to display (reserved for future use)
- `--show-config`: Display color scheme configuration
- `--make-cmd CMD`: Specify make command to execute (default: "make")
- Trailing arguments: Passed directly to make command
### Automatic Features
- **Terminal Detection**: Colors are automatically enabled when output is to a
terminal (TTY) and `TERM` is not "dumb" or "unknown"
- **stdout/stderr Merging**: Both standard output and error streams are merged
and colorized together
- **Whitespace Normalization**: Multiple spaces are collapsed to single spaces
for cleaner output
### Examples
```bash
# Standard build with colors
colormake
# Parallel build
colormake -j8
# Build with custom flags
colormake -- CFLAGS="-g -O2"
# Disable colors
colormake --no-color
# Show color scheme
colormake --show-config
# Use with gmake
colormake --make-cmd gmake
```
## Features
- **Fast**: Uses regex-lite and buffered I/O for performance
- **Type-safe**: Uses enums instead of string matching
- **Error handling**: Proper error propagation
- **Zero dependencies**: Only uses regex-lite and clap
- **Multi-compiler Support**: Recognizes gcc, g++, clang, rustc, cargo, CC, CXX,
and libtool prefixes
- **Smart Line Truncation**: Long lines are intelligently truncated with prefix
and suffix preservation
- **Automatic Terminal Detection**: Enables colors only when appropriate
## Color Scheme
- **Make commands**: Cyan
- **Compiler commands**: Magenta (bright) - supports gcc, g++, clang, rustc,
cargo, CC, CXX, and libtool
- **Filenames**: Yellow
- **Line numbers**: Cyan
- **Errors**: Yellow (bright) with highlighting
- **Warnings**: Green
- **Notes**: Yellow
## Development
The project includes a Makefile for common development tasks:
```bash
# Run tests
make test
# Build release binary (runs tests first)
make build
# Install to /usr/local/bin (requires sudo)
make install
# Uninstall from /usr/local/bin (requires sudo)
make uninstall
# Clean build artifacts
make clean
```
## Acknowledgments
This initiative expands on the efforts of:
- [colormake](https://github.com/pagekite/Colormake)
- [make](https://www.gnu.org/software/make/)
## License
This project is licensed under the GPL-3.0 license. See the [LICENSE](LICENSE)
file for details.