logo

skeud

Simple and portable utilities to deal with user accounts (su, login)
commit: df0380e16d47a5bae448a14fcd93f755ca53f55c
parent a4d0c370bca7621cb11c25a57716da7d83d7f07c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  8 Oct 2022 11:15:28 +0200

Makefile: Add install target

Diffstat:

MMakefile17++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -4,9 +4,13 @@ CC ?= cc CFLAGS ?= -O2 -g -Wall -Wextra -Werror=implicit-function-declaration -EXE = login su +PREFIX ?= /usr +SYS_BINDIR ?= /bin +BINDIR ?= $(PREFIX)/bin -all: $(EXE) +SYS_EXE = login su + +all: $(SYS_EXE) .c: $(CC) -std=c11 $(CFLAGS) -o $@ $< $(LDFLAGS) @@ -21,6 +25,13 @@ su_SRC = su.c common.c su: $(su_SRC) Makefile $(CC) -std=c11 $(CFLAGS) -o $@ $(su_SRC) -lcrypt $(LDFLAGS) +.PHONY: install +install: all + mkdir -p $(DESTDIR)$(SYS_BINDIR)/ + cp $(SYS_EXE) $(DESTDIR)$(SYS_BINDIR)/ + chmod 0755 $(DESTDIR)$(SYS_BINDIR)/login + chmod 4755 $(DESTDIR)$(SYS_BINDIR)/su + C_SOURCES = *.c *.h .PHONY: format format: @@ -28,4 +39,4 @@ format: .PHONY: clean clean: - rm $(EXE) + rm $(SYS_EXE)