From 25ecc7f4c0b4a24ac9db349bb17fd2260a273b64 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sun, 9 Feb 2025 15:51:28 -0600 Subject: add prefix option to make and make install --- Makefile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a2b542d..918f075 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,27 @@ CC = gcc -CFLAGS = -Wall -Ofast +CFLAGS = -Wall -O2 LDFLAGS = -lpulse - TARGET = pavolctld -SOURCES = pavolctld.c +SRCS = pavolctld.c +PREFIX = /usr/local all: $(TARGET) -$(TARGET): $(SOURCES) - $(CC) $(CFLAGS) -o $(TARGET) $(SOURCES) $(LDFLAGS) +$(TARGET): $(SRCS) + $(CC) $(CFLAGS) -o $@ $(SRCS) $(LDFLAGS) clean: rm -f $(TARGET) +install: all + mkdir -p $(PREFIX)/bin + cp pavolctld $(PREFIX)/bin/pavolctld + chmod 755 $(PREFIX)/bin/pavolctld + mkdir -p $(PREFIX)/share/man/man1 + cp pavolctld.1 $(PREFIX)/share/man/man1/pavolctld.1 + chmod 644 $(PREFIX)/share/man/man1/pavolctld.1 + +uninstall: + rm -f $(PREFIX)/bin/pavolctld $(PREFIX)/share/man/man1/pavolctld.1 + +.PHONY: all clean -- cgit v1.2.3