-
Notifications
You must be signed in to change notification settings - Fork 80
/
Makefile
75 lines (57 loc) · 2.95 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# Glewlwyd authentication scheme
#
# Makefile used to build the software
#
# Copyright 2016-2019 Nicolas Mora <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation;
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
#
GLWD_SRC=..
DESTDIR=/usr/local
MODULES_TARGET=$(DESTDIR)/lib/glewlwyd/scheme
CC=gcc
CFLAGS+=-c -fPIC -Wall -Werror -Wextra -Wconversion -Wno-unknown-pragmas -Wpedantic -D_REENTRANT -Wno-pragmas -I$(GLWD_SRC) $(shell pkg-config --cflags liborcania) $(shell pkg-config --cflags libyder) $(shell pkg-config --cflags jansson) $(shell pkg-config --cflags libhoel) $(shell pkg-config --cflags librhonabwy) $(shell pkg-config --cflags libiddawc) $(shell pkg-config --cflags libcbor) $(ADDITIONALFLAGS)
LIBS=$(shell pkg-config --libs liborcania) $(shell pkg-config --libs libyder) $(shell pkg-config --libs libhoel) $(shell pkg-config --libs jansson) -ldl
TARGET=libmodemail.so libmodwebauthn.so libmodotp.so libmodpassword.so libmodcertificate.so libmodhttp.so libmodoauth2.so
all: release
%.o: %.c $(GLWD_SRC)/glewlwyd.h
$(CC) $(CFLAGS) $(CPPFLAGS) $<
misc.o: $(GLWD_SRC)/misc.c $(GLWD_SRC)/glewlwyd-common.h
$(CC) $(CFLAGS) $(CPPFLAGS) $(GLWD_SRC)/misc.c
libmodmock.so: mock.o misc.o
$(CC) -shared -Wl,-soname,libmodmock.so -o libmodmock.so mock.o misc.o $(LIBS)
libmodemail.so: email.o misc.o
$(CC) -shared -Wl,-soname,libmodemail.so -o libmodemail.so email.o misc.o $(LIBS)
libmodwebauthn.so: webauthn.o misc.o
$(CC) -shared -Wl,-soname,libmodwebauthn.so -o libmodwebauthn.so webauthn.o misc.o $(LIBS) $(shell pkg-config --libs libcbor) $(shell pkg-config --libs librhonabwy) -lldap
libmodotp.so: otp.o misc.o
$(CC) -shared -Wl,-soname,libmodotp.so -o libmodotp.so otp.o misc.o $(LIBS) $(shell pkg-config --libs liboath)
libmodpassword.so: password.o misc.o
$(CC) -shared -Wl,-soname,libmodpassword.so -o libmodpassword.so password.o misc.o $(LIBS)
libmodcertificate.so: certificate.o misc.o
$(CC) -shared -Wl,-soname,libmodcertificate.so -o libmodcertificate.so certificate.o misc.o $(LIBS)
libmodhttp.so: http.o misc.o
$(CC) -shared -Wl,-soname,libmodhttp.so -o libmodhttp.so http.o misc.o $(LIBS)
libmodoauth2.so: oauth2.o misc.o
$(CC) -shared -Wl,-soname,libmodoauth2.so -o libmodoauth2.so oauth2.o misc.o $(LIBS) $(shell pkg-config --libs libiddawc)
clean:
rm -f *.o *.so
debug: ADDITIONALFLAGS=-DDEBUG -g -O0
debug: libmodmock.so $(TARGET)
release: ADDITIONALFLAGS=-O3
release: $(TARGET)
install:
mkdir -p $(MODULES_TARGET)
cp -f *.so $(MODULES_TARGET)