Added make file

This commit is contained in:
Dionysus 2024-12-07 12:11:43 -05:00
parent 5f8bee0592
commit 445b6dcf26
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
2 changed files with 42 additions and 1 deletions

27
Makefile Normal file
View File

@ -0,0 +1,27 @@
# Compiler settings
CC = gcc
CFLAGS = -Wall -Wextra -O2
PREFIX = /usr/local
# Files
PROG = shardz
SOURCES = shardz.c
OBJECTS = $(SOURCES:.c=.o)
# Targets
all: $(PROG)
$(PROG): $(OBJECTS)
$(CC) $(OBJECTS) $(CFLAGS) -o $(PROG)
install: $(PROG)
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 $(PROG) $(DESTDIR)$(PREFIX)/bin/$(PROG)
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(PROG)
clean:
rm -f $(PROG) $(OBJECTS)
.PHONY: all install uninstall clean

View File

@ -11,11 +11,25 @@ Shardz is a lightweight C utility that shards *(splits)* the output of any proce
- Load balancing input streams - Load balancing input streams
- Splitting any line-based input for distributed processing - Splitting any line-based input for distributed processing
## Building ## Building & Installation
### Quick Build
```bash ```bash
gcc -o shardz shardz.c gcc -o shardz shardz.c
``` ```
### Using Make
```bash
# Build only
make
# Build and install system-wide (requires root/sudo)
sudo make install
# To uninstall
sudo make uninstall
```
## Usage ## Usage
```bash ```bash
some_command | shardz INDEX/TOTAL some_command | shardz INDEX/TOTAL