ropipe/Makefile

49 lines
998 B
Makefile
Raw Normal View History

2024-07-07 15:40:42 +02:00
CC = cc
CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99
UNAME := $(shell uname)
2021-10-11 11:24:13 +02:00
all:
2024-07-07 15:40:42 +02:00
@echo "Compiling"
$(CC) $(CFLAGS) -o ropipe ropipe.c
@echo "Done"
2021-10-11 11:24:13 +02:00
install:
2024-07-07 15:40:42 +02:00
ifneq ($(UNAME), Linux)
@echo "Automatic installation is only supported on Linux"
@echo "Please copy the binary to a directory in your PATH"
@echo "and the manpage to your manpages directory"
@exit
endif
2021-10-11 11:24:13 +02:00
ifeq (,$(wildcard ./ropipe))
make
endif
ifneq ($(shell id -u), 0)
@echo "You must be root to install"
else
mkdir -p /usr/local/share/man/man1/
2024-07-07 15:40:42 +02:00
@echo "Copying man file"
2021-10-11 11:24:13 +02:00
cp ropipe.1 /usr/local/share/man/man1/ropipe.1
2024-07-07 15:40:42 +02:00
@echo "Installing binary"
2021-10-11 11:24:13 +02:00
cp ropipe /usr/bin/ropipe
endif
2024-07-07 15:40:42 +02:00
2021-10-11 11:24:13 +02:00
uninstall:
2024-07-07 15:40:42 +02:00
ifneq ($(UNAME), Linux)
@echo "Automatic uninstalling is only supported on Linux"
@exit
endif
2021-10-11 11:24:13 +02:00
ifneq ($(shell id -u), 0)
2022-10-04 15:48:54 +02:00
@echo "You must be root to uninstall"
2021-10-11 11:24:13 +02:00
else
2024-07-07 15:40:42 +02:00
@echo "Removing man file"
2021-10-11 11:24:13 +02:00
rm -rf /usr/local/share/man/man1/ropipe.1
2024-07-07 15:40:42 +02:00
@echo "Uninstalling binary"
2021-10-11 11:24:13 +02:00
rm -rf /usr/bin/ropipe
endif
2024-07-07 15:40:42 +02:00
2021-10-13 12:10:42 +02:00
update:
git pull
make install
2022-10-04 15:48:54 +02:00