pam-eid/Makefile

49 lines
1.6 KiB
Makefile

# This software is licensed under GPL-3, as shown in the file COPYRIGHT
# Author: Linux Gruppe IRB
# Copyright: Linux Gruppe IRB, 2024
ARCH := $(shell gcc -dumpmachine)
EXEC_OBJS := authorized_eid.o client.o add-eid.o
PAM_OBJS := pam_eid.o auth.o authorized_eid.o client.o
CURL_CFLAGS := $(shell /usr/bin/pkg-config --cflags libcurl)
CURL_LDFLAGS := $(shell /usr/bin/pkg-config --libs libcurl)
PAM_CFLAGS := $(shell /usr/bin/pkg-config --cflags pam)
PAM_LDFLAGS := $(shell /usr/bin/pkg-config --libs pam)
GLIB_CFLAGS := $(shell /usr/bin/pkg-config --cflags glib-2.0)
GLIB_LDFLAGS := $(shell /usr/bin/pkg-config --libs glib-2.0)
CFLAGS := -O2 -Wall -Werror -g -fPIC $(CURL_CFLAGS) $(PAM_CFLAGS) $(GLIB_CFLAGS)
EXEC_LDFLAGS := $(CURL_LDFLAGS) $(GLIB_LDFLAGS)
PAM_LDFLAGS := $(CURL_LDFLAGS) $(PAM_LDFLAGS) $(GLIB_LDFLAGS)
all: pam_eid.so add-eid
pam_eid.so: $(PAM_OBJS)
gcc -shared -o pam_eid.so $(PAM_OBJS) $(PAM_LDFLAGS)
add-eid: $(EXEC_OBJS)
gcc -o add-eid $(EXEC_OBJS) $(EXEC_LDFLAGS)
pam_eid.o: auth.h pam_eid.h
auth.o: authorized_eid.h client.h auth.h pam_eid.h
add-eid.o: authorized_eid.h client.h
authorized_eid.o: authorized_eid.h
client.o: client.h
install: all
install -m 755 -d $(DESTDIR)/usr/lib/$(ARCH)/security
install -m 644 pam_eid.so $(DESTDIR)/usr/lib/$(ARCH)/security/
install -m 755 -d $(DESTDIR)/usr/share/pam-configs
install -m 644 pam-config-eid $(DESTDIR)/usr/share/pam-configs/eid
install -m 755 -d $(DESTDIR)/usr/share/man/man8
install -m 644 pam_eid.8 $(DESTDIR)/usr/share/man/man8/
install -m 755 -d $(DESTDIR)/usr/bin
install -m 755 add-eid $(DESTDIR)/usr/bin/
clean:
rm -f pam_eid.so add-eid *.o