rd.git

Makefile

espurr
# rd - privilege elevator
# Copyright (C) 2022-2023 ArcNyxx <me@arcnyxx.net>
# see LICENCE file for licensing information

.POSIX:

include config.mk

SRC = rd.c
OBJ = $(SRC:.c=.o)

all: rd

$(OBJ): config.mk

.c.o:
	$(CC) $(CFLAGS) -c $<

rd: $(OBJ)
	$(CC) $(OBJ) -o $@ $(LDFLAGS)

clean:
	rm -f rd $(OBJ)

install: all
	mkdir -p $(PREFIX)/bin $(MANPREFIX)/man1
	cp -f rd $(PREFIX)/bin
	chown root:$(GROUP) $(PREFIX)/bin/rd
	chmod 4754 $(PREFIX)/bin/rd
	sed 's/VERSION/$(VERSION)/g;s/GROUP/$(GROUP)/g' \
		< rd.1 > $(MANPREFIX)/man1/rd.1
	chmod 644 $(MANPREFIX)/man1/rd.1
	rm -f /etc/rd

uninstall:
	rm -f $(PREFIX)/bin/rd $(MANPREFIX)/man1/rd.1

.PHONY: all clean install uninstall