
INSTALL_DIR := ${DESTDIR}/sbin

all: pam_auth_helper

pam_auth_helper: pam_auth.c
	$(CC) -o pam_auth_helper pam_auth.c -lpam -ldl
	
install: pam_auth_helper
	/usr/bin/install -o root -g root ./pam_auth_helper ${INSTALL_DIR}/
	@echo
	@echo "PAM helper installed, but if you want to use authentication with shadow passwords, "
	@echo "you must make it SUID root. *This is security risk*. To do it run: make suid "

suid:
	@echo "Making pam_auth_helper SUID root"
	chmod +s ${INSTALL_DIR}/pam_auth_helper

uninstall:
	rm -f ${INSTALL_DIR}/pam_auth_helper
	
clean:
	rm -f pam_auth_helper 

