forked from Exhar/otpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
144 lines (114 loc) · 4.83 KB
/
Makefile.in
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Makefile.in for otpd
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_DATE = @PACKAGE_DATE@
TAR = tar
CC = @CC@
LEX = @LEX@
YACC = @YACC@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
DEFINES = @DEFINES@ -DVERSION=\"@PACKAGE_VERSION@\"
# fix some stupidity
DEFINES += -Wp,-U_FORTIFY_SOURCE -U_FORTIFY_SOURCE
WARNINGS = -Wall -Wshadow -Wsign-compare -Werror
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ @SOCKET_LIBS@
SOCKET_LIBS = @SOCKET_LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
libdir = @libdir@
mandir = @mandir@
datarootdir = @datarootdir@
sysconfdir = /etc
srcdir = @srcdir@
LDAP_LIBS = @LDAP_LIBS@
CONFIG_SRCS = scanner.c y.tab.c
USEROPS_SRCS = $(wildcard userops/*.c)
SRCS = $(CONFIG_SRCS) $(USEROPS_SRCS) accept_thread.c failover_thread.c
SRCS += gsmd.c helix.c hotp.c
SRCS += lock.c main.c mlog.c nonce.c otp.c site.c state.c uhash.c work_thread.c
SRCS += x99.c xfunc.c
OBJS = $(patsubst %.c,%.o,$(SRCS))
MAN = otpd.8 otppasswd.5 resynctool.8
# cardops is separate to allow drop-in object files
CARDOPS_SRCS := $(wildcard cardops/*.c)
CARDOPS_OBJS := $(patsubst %.c,%.o,$(CARDOPS_SRCS))
CARDOPS_XOBJS = $(filter-out $(CARDOPS_OBJS), $(wildcard cardops/*.o))
CARDOPS_OBJS += $(CARDOPS_XOBJS)
all: otpd otpauth resynctool init-scripts $(MAN)
otpd: $(OBJS) $(CARDOPS_OBJS)
$(CC) -o $@ $(LDFLAGS) $^ $(LDAP_LIBS) $(LIBS)
otpauth: otpauth.o
$(CC) -o $@ $(LDFLAGS) $^ $(SOCKET_LIBS)
resynctool: resynctool.o
$(CC) -o $@ $(LDFLAGS) $^ -lcrypto
init-scripts: redhat/otpd.init solaris/manifest
redhat/otpd.init: redhat/otpd.init.in
perl -pe 's:\@sbindir\@:$(sbindir):' $^ > $@
solaris/manifest: solaris/manifest.in
perl -pe 's:\@sbindir\@:$(sbindir):; s:\@mandir\@:$(mandir):' $^ > $@
install: install-otpd install-otpauth install-resynctool
install-otpd: otpd
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) otpd $(DESTDIR)$(sbindir)/otpd
$(INSTALL) -d $(DESTDIR)$(mandir)/man8
$(INSTALL) -d $(DESTDIR)$(mandir)/man5
$(INSTALL_DATA) otpd.8 $(DESTDIR)$(mandir)/man8/otpd.8
$(INSTALL_DATA) otppasswd.5 $(DESTDIR)$(mandir)/man5/otppasswd.5
$(INSTALL) -d $(DESTDIR)$(sysconfdir)
-[ -f $(DESTDIR)$(sysconfdir)/otpd.conf ] && mv $(DESTDIR)$(sysconfdir)/otpd.conf $(DESTDIR)$(sysconfdir)/otpd.conf.save
$(INSTALL_DATA) otpd.conf $(DESTDIR)$(sysconfdir)/otpd.conf
chmod 0600 $(DESTDIR)$(sysconfdir)/otpd.conf
install-otpauth: otpauth
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) otpauth $(DESTDIR)$(sbindir)/otpauth
install-resynctool: resynctool
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) resynctool $(DESTDIR)$(sbindir)/resynctool
$(INSTALL) -d $(DESTDIR)$(mandir)/man8
$(INSTALL_DATA) resynctool.8 $(DESTDIR)$(mandir)/man8/resynctool.8
distclean: clean
rm -rf Makefile config.log config.status autom4te.cache redhat/otpd.init solaris/manifest configure
clean:
rm -f otpd $(OBJS) otpauth otpauth.o resynctool resynctool.o $(patsubst %.c,%.o,$(CARDOPS_SRCS)) $(MAN)
common_headers = extern.h
specific_headers = $(filter-out $(common_headers),$(wildcard *.h cardops/*.h userops/*.h))
objs_with_headers = $(patsubst %.h,%.o,$(specific_headers))
$(objs_with_headers): %.o: %.h
otp.o state.o user.o: cardops.h
site.o state.o work_thread.o x99.o: otp.h
state.o: gsm.h
failover_thread.o helix.o state.o: bitmanip.h
$(CARDOPS_SRCS): cardops.h otp.h
%.o: %.c $(common_headers)
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) -c -o $@ $<
helix.o: helix.c $(common_headers)
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) -fno-strict-aliasing -c -o $@ $<
scanner.o: scanner.c $(common_headers)
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) -Wno-implicit -Wno-unused-function -Wno-unused-label -Wno-sign-compare -c -o $@ $<
# have to rename lex.yy.c if we want to distribute it,
# to avoid conflict with AC_PROG_LEX test which removes it
scanner.c: config.l y.tab.h
$(LEX) config.l
mv lex.yy.c scanner.c
perl -i -pe s/lex.yy.c/scanner.c/ scanner.c
y.tab.c y.tab.h: config.y
$(YACC) -d config.y
otpd.8: otpd.8.pod
pod2man -d $(PACKAGE_DATE) -s 8 -n otpd -r "otpd $(PACKAGE_VERSION)" -c " " $< > $@
otppasswd.5: otppasswd.5.pod
pod2man -d $(PACKAGE_DATE) -s 5 -n otppasswd -r "otpd $(PACKAGE_VERSION)" -c " " $< > $@
resynctool.8: resynctool.8.pod
pod2man -d $(PACKAGE_DATE) -s 8 -n resynctool -r "otpd $(PACKAGE_VERSION)" -c " " $< > $@
tar: scanner.c y.tab.c y.tab.h distclean
$(TAR) -C .. --owner=root --group=root -zcf ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz $(PACKAGE_NAME)-$(PACKAGE_VERSION)
srctar: scanner.c y.tab.c y.tab.h $(MAN) distclean
test -d ../$(PACKAGE_NAME)-$(PACKAGE_VERSION) || \
ln -s $(PACKAGE_NAME) ../$(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TAR) -C .. --owner=root --group=root -zchf ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz \
$(PACKAGE_NAME)-$(PACKAGE_VERSION)
test -L ../$(PACKAGE_NAME)-$(PACKAGE_VERSION) && rm ../$(PACKAGE_NAME)-$(PACKAGE_VERSION)