50 lines
1.1 KiB
Makefile
50 lines
1.1 KiB
Makefile
# Linux Hello PAM Module Makefile
|
|
#
|
|
# Build the PAM shared library for face authentication
|
|
|
|
CC = gcc
|
|
# Strictest warnings + static analysis flags
|
|
CFLAGS = -Wall -Wextra -Werror -Wpedantic -Wstrict-prototypes \
|
|
-Wmissing-prototypes -Wunreachable-code -Wcast-qual \
|
|
-Wconversion -Wshadow -Wundef -Wformat=2 -fPIC -O2 \
|
|
-D_FORTIFY_SOURCE=2
|
|
LDFLAGS = -shared -lpam
|
|
|
|
TARGET = pam_linux_hello.so
|
|
SOURCES = pam_linux_hello.c
|
|
OBJECTS = $(SOURCES:.c=.o)
|
|
|
|
# Installation paths
|
|
DESTDIR ?=
|
|
PAM_DIR = $(DESTDIR)/lib/security
|
|
ifeq ($(shell uname -m),x86_64)
|
|
PAM_DIR = $(DESTDIR)/lib/x86_64-linux-gnu/security
|
|
endif
|
|
|
|
.PHONY: all clean install uninstall test
|
|
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): $(OBJECTS)
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
clean:
|
|
rm -f $(OBJECTS) $(TARGET)
|
|
|
|
install: $(TARGET)
|
|
@echo "Installing $(TARGET) to $(PAM_DIR)"
|
|
install -d $(PAM_DIR)
|
|
install -m 755 $(TARGET) $(PAM_DIR)/
|
|
|
|
uninstall:
|
|
rm -f $(PAM_DIR)/$(TARGET)
|
|
|
|
# Basic compilation test
|
|
test: $(TARGET)
|
|
@echo "PAM module compiled successfully"
|
|
@file $(TARGET)
|
|
@nm -D $(TARGET) | grep pam_sm
|