File: Makefile.am

package info (click to toggle)
courier-authlib 0.71.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,416 kB
  • sloc: ansic: 15,778; sh: 4,565; cpp: 4,205; makefile: 793; perl: 739
file content (682 lines) | stat: -rw-r--r-- 24,556 bytes parent folder | download
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
#
# Copyright 1998 - 2020 Double Precision, Inc.  See COPYING for
# distribution information.

ACLOCAL_AMFLAGS = -I m4

AUTOMAKE_OPTIONS=dist-bzip2

SUBDIRS=libs/gdbmobj libs/bdbobj libs/md5 libs/sha1 libs/libhmac libs/numlib libs/makedat userdb libs/rfc822 libs/random128 libs/liblock liblog

AM_CPPFLAGS=-I liblock $(LTDLINCL)
BUILT_SOURCES=

modules=@LIBAUTHUSERDB@ \
	@LIBAUTHPAM@ @LIBAUTHPWD@ @LIBAUTHSHADOW@ \
	@LIBAUTHPGSQL@ @LIBAUTHLDAP@ @LIBAUTHMYSQL@ @LIBAUTHSQLITE@ \
	@LIBAUTHCUSTOM@ @LIBAUTHPIPE@

pkglibexecdir=$(libexecdir)/courier-authlib
pkglibexec_SCRIPTS=authsystem.passwd

lib_LTLIBRARIES=libcourierauth.la \
	libcourierauthcommon.la libcourierauthsasl.la libcourierauthsaslclient.la
pkglib_LTLIBRARIES=$(modules)
sbin_SCRIPTS=authdaemond
sbin_PROGRAMS=authtest authenumerate authpasswd
bin_PROGRAMS=courierauthconfig

EXTRA_LTLIBRARIES=libauthuserdb.la \
	libauthpam.la libauthpwd.la libauthshadow.la \
	libauthpgsql.la \
	libauthldap.la \
	libauthmysql.la \
	libauthsqlite.la \
	libauthcustom.la \
	libauthpipe.la

CLEANFILES=authldaprc.h authmysqlrc.h authsqliterc.h authdaemonrc.h \
	authpgsqlrc.h authpiperc.h authdaemon \
	authlib.3 authlib.html packageversion.h \
	authchangepwdir.h sbindir.h pkglibdir.h pkgincludedir.h \
	mailusergroup.h authinfodaemondlist.c permissions.dat \
	README.authdebug.html

DISTCLEANFILES=dbobj.config README_authlib.html

commonlibdep=libcourierauthcommon.la
commonldflags=-module -rpath $(pkglibdir) -export-symbols-regex 'courier_auth.*_init'  -version-info @VERSION_INFO@ @courierauth_ldflags@
commonlibadd=libcourierauthcommon.la

libcourierauthcommon_t=@CRYPTLIBS@
libcourierauthcommon_la_SOURCES= \
	auth.h courierauth.h \
	authconfigfile.cpp \
	authconfigfile.h \
	authpwdenumerate.c \
	authsaslfrombase64.c authsasltobase64.c \
	courierauthstaticlist.h \
	authsyschangepwd.c authsyscommon.c \
	authldapescape.c \
	cramlib.c \
	checkpassword.c cryptpassword.c \
	checkpasswordmd5.c checkpasswordsha1.c

libcourierauthcommon_la_DEPENDENCIES=libcourierauth.la
libcourierauthcommon_la_LIBADD=libcourierauth.la
libcourierauthcommon_la_LDFLAGS=$(libcourierauthcommon_t:%=-Wl,%) -version-info @VERSION_INFO@

libcourierauth_la_SOURCES=authdaemon.c authdaemonlib.c preauthdaemon.c \
	authmoduser2.c authmoduser3.c debug.c \
	courierauthdebug.h \
	authoption.c
libcourierauth_la_LIBADD=libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la libs/numlib/libnumlib.la \
	libs/random128/librandom128.la libs/rfc822/libencode.la
libcourierauth_la_LDFLAGS=@NETLIBS@ -version-info @VERSION_INFO@

# The userdb module

libauthuserdb_t=userdb/libuserdb.la @dblibrary@ @LIBGDBM@ @LIBDB@
libauthuserdb_la_SOURCES=authuserdb.c preauthuserdb.c preauthuserdbcommon.c \
	 authuserdbpwd.c
libauthuserdb_la_DEPENDENCIES=libcourierauthcommon.la @dblibrary@
libauthuserdb_la_LIBADD=$(commonlibadd) $(libauthuserdb_t)
libauthuserdb_la_LDFLAGS=$(commonldflags)

# the authpam module

libauthpam_t=-lpam @SHADOWLIBS@ @AUTHPAMCRYPT@ @LIBDL@

libauthpam_la_SOURCES=authpam.c preauthpam.c authwait.h
libauthpam_la_DEPENDENCIES=$(commonlibdep)
libauthpam_la_LIBADD=$(commonlibadd) $(libauthpam_t)
libauthpam_la_LDFLAGS=$(commonldflags)

# The authpwd module

libauthpwd_la_SOURCES=authpwd.c preauthpwd.c
libauthpwd_la_DEPENDENCIES=$(commonlibdep)
libauthpwd_la_LIBADD=$(commonlibadd)
libauthpwd_la_LDFLAGS=$(commonldflags)

# The authshadow module

libauthshadow_t=@SHADOWLIBS@

libauthshadow_la_SOURCES=authshadow.c preauthshadow.c
libauthshadow_la_DEPENDENCIES=$(commonlibdep)
libauthshadow_la_LIBADD=$(commonlibadd) $(libauthshadow_t)
libauthshadow_la_LDFLAGS=$(commonldflags)

# The authpgsql module

libauthpgsql_t=@PGSQL_LIBS@ @LIBM@ @NETLIBS@

libauthpgsql_la_SOURCES=authpgsql.c authpgsqllib.cpp authpgsql.h
libauthpgsql_la_DEPENDENCIES=$(commonlibdep)
libauthpgsql_la_LIBADD=$(commonlibadd) $(libauthpgsql_t)
libauthpgsql_la_LDFLAGS=$(commonldflags)

if HAVE_AUTHPGSQL

install-authpgsqlrc:
	$(mkinstalldirs) $(DESTDIR)`dirname @authpgsqlrc@` || :
	$(INSTALL_DATA) -m 660 $(srcdir)/authpgsqlrc \
		$(DESTDIR)@authpgsqlrc@.dist

uninstall-authpgsqlrc:
	rm -f $(DESTDIR)@authpgsqlrc@.dist

else

install-authpgsqlrc:
	@:

uninstall-authpgsqlrc:
	@:
endif

authpgsqlrc.h:
	echo "#define AUTHPGSQLRC \"@authpgsqlrc@\"" >authpgsqlrc.h


# The authldap module

libauthldap_t=@LDAPLIBS@ @NETLIBS@
libauthldap_la_SOURCES=authldap.c preauthldap.c authldaplib.cpp authldap.h
libauthldap_la_DEPENDENCIES=$(commonlibdep)
libauthldap_la_LIBADD=$(commonlibadd) $(libauthldap_t)
libauthldap_la_LDFLAGS=$(commonldflags)

if HAVE_LDAP

install-authldaprc:
	$(mkinstalldirs) $(DESTDIR)`dirname @authldaprc@` || :
	$(INSTALL_DATA) -m 660 $(srcdir)/authldaprc \
		$(DESTDIR)@authldaprc@.dist

uninstall-authldaprc:
	rm -f $(DESTDIR)@authldaprc@.dist

else
install-authldaprc:
	@:

uninstall-authldaprc:
	@:
endif

authldaprc.h:
	echo "#define AUTHLDAPRC \"@authldaprc@\"" >authldaprc.h

# The authmysql module

libauthmysql_t=@MYSQL_LIBS@ @LIBM@ @NETLIBS@

libauthmysql_la_SOURCES=authmysql.cpp preauthmysql.cpp authmysqllib.cpp authmysql.h
libauthmysql_la_DEPENDENCIES=$(commonlibdep)
libauthmysql_la_LIBADD=$(commonlibadd) $(libauthmysql_t)
libauthmysql_la_LDFLAGS=$(commonldflags)

if HAVE_AUTHMYSQL
install-authmysqlrc:
	$(mkinstalldirs) $(DESTDIR)`dirname @authmysqlrc@` || :
	$(INSTALL_DATA) -m 660 $(srcdir)/authmysqlrc \
		$(DESTDIR)@authmysqlrc@.dist

uninstall-authmysqlrc:
	rm -f $(DESTDIR)@authmysqlrc@.dist

else
install-authmysqlrc:
	@:

uninstall-authmysqlrc:
	@:
endif

authmysqlrc.h:
	echo "#define AUTHMYSQLRC \"@authmysqlrc@\"" >authmysqlrc.h

# The authsqlite module

libauthsqlite_t=@SQLITE_LIBS@ @NETLIBS@

libauthsqlite_la_SOURCES=authsqlite.cpp authsqlitelib.cpp authsqlite.h
libauthsqlite_la_DEPENDENCIES=$(commonlibdep)
libauthsqlite_la_LIBADD=$(commonlibadd) $(libauthsqlite_t)
libauthsqlite_la_LDFLAGS=$(commonldflags)

if HAVE_AUTHSQLITE
install-authsqliterc:
	$(mkinstalldirs) $(DESTDIR)`dirname @authsqliterc@` || :
	$(INSTALL_DATA) -m 660 $(srcdir)/authsqliterc \
		$(DESTDIR)@authsqliterc@.dist

uninstall-authsqliterc:
	rm -f $(DESTDIR)@authsqliterc@.dist

else
install-authsqliterc:
	@:

uninstall-authsqliterc:
	@:
endif

authsqliterc.h:
	echo "#define AUTHSQLITERC \"@authsqliterc@\"" >authsqliterc.h

# The authcustom module

libauthcustom_la_SOURCES=authcustom.c preauthcustom.c authcustom.h
libauthcustom_la_DEPENDENCIES=$(commonlibdep)
libauthcustom_la_LIBADD=$(commonlibadd)
libauthcustom_la_LDFLAGS=$(commonldflags)

# The authpipe module
libauthpipe_la_SOURCES=authpipe.c authpipelib.h authpipelib.c
libauthpipe_la_DEPENDENCIES=$(commonlibdep)
libauthpipe_la_LIBADD=$(commonlibadd)
libauthpipe_la_LDFLAGS=$(commonldflags)

authpipelib.lo: authpipelib.c authpipelib.h authpiperc.h

authpiperc.h:
	echo "#define PIPE_PROGRAM \"@authProg@\"" >authpiperc.h


#
# AUTHMODULES should be listed in the best authentication order
#

noinst_PROGRAMS= \
	authdaemontest authmksock \
	authdaemondprog

install-authdaemonrc:
	$(mkinstalldirs) $(DESTDIR)`dirname @authdaemonrc@` || :
	sed 's/@ALLMODULES@/$(modules:lib%.la=%)/' <authdaemonrc >authdaemonrc.tmp
	$(INSTALL_DATA) -m 660 authdaemonrc.tmp $(DESTDIR)@authdaemonrc@.dist
	rm -f authdaemonrc.tmp

uninstall-authdaemonrc:
	rm -f $(DESTDIR)@authdaemonrc@.dist

authdaemonrc.h:
	echo "#define AUTHDAEMONRC \"@authdaemonrc@\"" >authdaemonrc.h
	echo "#define AUTHDAEMONVAR \"@authdaemonvar@\"" >>authdaemonrc.h
	echo "#define AUTHDAEMONPID AUTHDAEMONVAR \"/pid\"" >>authdaemonrc.h
	echo "#define AUTHDAEMONSOCK AUTHDAEMONVAR \"/socket\"" >>authdaemonrc.h
	echo "#define AUTHDAEMONLOCK AUTHDAEMONVAR \"/lock\"" >>authdaemonrc.h

BUILT_SOURCES += authdaemonrc.h

HTMLFILES=README.html NEWS.html INSTALL.html \
	README.authsqlite.html README.authmysql.html README.authpostgres.html


if HAVE_SGML

GITFILES=authldaprc authmysqlrc authpgsqlrc authsqliterc authdaemonrc.in

$(GITFILES): %: %.git
	perl -p -e 's/\$$Id:[^\$$]*/\$$Id: '"`git log --pretty=format:\"%H\" -n 1 -- $<`-`date +%Y%m%d%H%M%S`/" <$< >$@.tmp
	mv -f $@.tmp $@
endif

EXTRA_DIST=$(HTMLFILES) sysconftool COPYING COPYING.GPL\
	authldap.schema \
	authldap.ldif \
	$(GITFILES) README.ldap \
	README.authmysql.myownquery \
	README.authdebug.html.in \
	courier-authlib.spec \
	courier-authlib.lpspec pgpkeys.txt \
	README_authlib.html.in \
	authlib.html.in authlib.3.in \
	authpasswd.html authpasswd.1 \
	authtest.html authtest.1 \
	auth_sasl.html auth_sasl.3 auth_sasl_ex.3 \
	auth_generic.html auth_generic.3 auth_generic_meta.3 \
	auth_login.html auth_login.3 auth_login_meta.3 \
	auth_passwd.html auth_passwd.3 \
	auth_meta.html auth_meta.3 \
	auth_getuserinfo.html auth_getuserinfo.3 auth_getuserinfo_meta.3 \
	auth_mkhomedir.html auth_mkhomedir.3 \
	auth_enumerate.html auth_enumerate.3 \
	auth_getoption.html auth_getoption.3 \
	samplepipe.pl

README: README.html
	links -dump -no-references README.html >README

NEWS: NEWS.html
	links -dump -no-references NEWS.html >NEWS

INSTALL: INSTALL.html
	rm -f INSTALL; links -dump -no-references INSTALL.html >INSTALL

libcourierauthsasl_la_SOURCES=\
	authsasl.c courierauthsasl.h \
	authsaslcram.c authsasllogin.c authsaslplain.c \
	authsaslfrombase64.c authsasltobase64.c
libcourierauthsasl_la_LIBADD=libcourierauthcommon.la libcourierauth.la
libcourierauthsasl_la_LDFLAGS=-export-symbols-regex '^auth_sasl|auth_sasl_ex|auth_sasl_extract_userid$$' -version-info @VERSION_INFO@

libcourierauthsaslclient_la_SOURCES=courierauthsaslclient.h \
	authsaslclient.c authsaslclient.h authsaslclientcram.c \
	authsaslclientcrammd5.c authsaslclientcramsha1.c \
	authsaslclientlogin.c authsaslclientplain.c \
	authsaslclientexternal.c \
	authsaslfrombase64.c authsasltobase64.c
libcourierauthsaslclient_la_LIBADD=libcourierauth.la
libcourierauthsaslclient_la_LDFLAGS=-export-symbols-regex '^auth_sasl_client$$' -version-info @VERSION_INFO@

include_HEADERS=courierauth.h courierauthsasl.h \
	courierauthsaslclient.h courierauthdebug.h courierauthstaticlist.h

courierauthconfig_SOURCES=authinfo.c

authpasswd_SOURCES=authpasswd.c
authpasswd_LDADD=libcourierauthcommon.la \
        libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la libs/rfc822/libencode.la

authtest_SOURCES=authtest.c
authtest_DEPENDENCIES=libcourierauth.la
authtest_LDADD=libcourierauth.la

authenumerate_SOURCES=authenumerate.c
authenumerate_DEPENDENCIES = libcourierauth.la \
	libs/numlib/libnumlib.la
authenumerate_LDADD = libcourierauth.la \
	libs/numlib/libnumlib.la
authenumerate_LDFLAGS=

#
# The main daemon.

authdaemondprog_SOURCES=authdaemond.c authdaemondcpp.cpp

authdaemond.o: authdaemond.h

authdaemond.h: libcourierauthcommon.la
	. ./libcourierauthcommon.la; echo '#define COURIERDLEXT "'`echo $$dlname | sed s/libcourierauthcommon//`'"' >authdaemond.h

CLEANFILES += authdaemond.h

authdaemondprog_DEPENDENCIES=libcourierauthcommon.la \
	libcourierauth.la \
	libs/liblock/liblock.la $(modules) \
	libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la \
	libs/rfc822/libencode.la libs/numlib/libnumlib.la
authdaemondprog_LDADD=$(LIBLTDL) libcourierauthcommon.la libcourierauth.la libs/liblock/liblock.la \
	libs/libhmac/libhmac.la libs/md5/libmd5.la libs/sha1/libsha1.la \
	libs/rfc822/libencode.la libs/numlib/libnumlib.la
authdaemondprog_LDFLAGS=-export-dynamic $(modules:%=-dlopen %) @NETLIBS@

authdaemontest_SOURCES=authdaemontest.c
authdaemontest_DEPENDENCIES=libcourierauthcommon.la
authdaemontest_LDADD=libcourierauthcommon.la @NETLIBS@
authdaemontest_LDFLAGS=-static

authmksock_SOURCES=authmksock.c
authmksock_LDADD=@NETLIBS@

man3=authlib.3 auth_generic.3 auth_login.3 auth_getuserinfo.3 auth_mkhomedir.3 \
	auth_enumerate.3 auth_passwd.3 auth_getoption.3 auth_sasl.3 \
	auth_meta.3

extraman3=auth_generic_meta.3 auth_login_meta.3 auth_getuserinfo_meta.3 \
	auth_sasl_ex.3
man1=authpasswd.1 authtest.1

man_MANS=$(man1) $(man3) $(extraman3)

BUILT1=authlib.html authldaprc.h authmysqlrc.h authpgsqlrc.h authpiperc.h \
	authdaemonrc.h packageversion.h \
	authchangepwdir.h sbindir.h \
	pkglibdir.h pkgincludedir.h mailusergroup.h \
	README_authlib.html
BUILT_SOURCES += $(BUILT1) $(GITFILES) $(man3:%.3=%.html) $(man1:%.1=%.html) \
	authsqliterc.h authmysqlrc.h authpgsqlrc.h

authchangepwdir.h: config.status
	echo '#define AUTHCHANGEPWDIR "$(pkglibexecdir)"' >authchangepwdir.h

sbindir.h: config.status
	echo '#define SBINDIR "@sbindir@"' >sbindir.h

pkglibdir.h: config.status
	echo '#define PKGLIBDIR "$(pkglibdir)"' >pkglibdir.h

packageversion.h: config.status
	echo '#define PKGVERSION "@PACKAGE_VERSION@"' >packageversion.h

pkgincludedir.h: config.status
	echo '#define PKGINCLUDEDIR "$(includedir)"' >pkgincludedir.h

mailusergroup.h: config.status
	echo '#define MAILUSER "@mailuser@"' >mailusergroup.h
	echo '#define MAILGROUP "@mailgroup@"' >>mailusergroup.h

noinst_DATA=$(BUILT_SOURCES)

dist-hook:
	for f in $(BUILT1) ; do rm -f $(distdir)/$$f; done

# automake still a bit stupid...

install-data-hook: install-authdaemonrc install-authpgsqlrc \
	install-authldaprc install-authmysqlrc install-authsqliterc
	:

install-exec-hook:
	$(mkinstalldirs) $(DESTDIR)$(bindir) || :
	$(mkinstalldirs) $(DESTDIR)$(sbindir) || :
	$(mkinstalldirs) $(DESTDIR)$(pkglibexecdir) || :
	chmod 755 $(DESTDIR)$(pkglibexecdir)
	$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) authdaemondprog $(DESTDIR)$(pkglibexecdir)/authdaemond
	$(mkinstalldirs) $(DESTDIR)@authdaemonvar@ || :
	chmod 750 $(DESTDIR)@authdaemonvar@
	test "@LIBAUTHUSERDB@" = "" && exit 0 ;\
		$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) libs/makedat/makedatprog \
				$(DESTDIR)$(pkglibexecdir)/makedatprog ; \
		$(INSTALL_SCRIPT) userdb/pw2userdb \
				$(DESTDIR)$(sbindir)/pw2userdb ; \
		$(INSTALL_SCRIPT) userdb/makeuserdb \
				$(DESTDIR)$(sbindir)/makeuserdb ; \
		$(INSTALL_SCRIPT) userdb/userdb.pl \
				$(DESTDIR)$(sbindir)/userdb ; \
		$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) userdb/userdbpw \
				$(DESTDIR)$(sbindir)/userdbpw ; \
		$(INSTALL_SCRIPT) userdb-test-cram-md5.pl \
				$(DESTDIR)$(sbindir)/userdb-test-cram-md5

uninstall-hook: uninstall-authldaprc uninstall-authdaemonrc uninstall-authmysqlrc uninstall-authpgsqlrc uninstall-authsqliterc
	rm -f $(DESTDIR)$(pkglibexecdir)/authdaemond
	test "@AUTHUSERDB@" = "" && exit 0 ;\
		rm -f $(DESTDIR)$(pkglibexecdir)/makedatprog \
				$(DESTDIR)$(sbindir)/pw2userdb \
				$(DESTDIR)$(sbindir)/makeuserdb \
				$(DESTDIR)$(sbindir)/userdb \
				$(DESTDIR)$(sbindir)/userdbpw \
				$(DESTDIR)$(sbindir)/userdb-test-cram-md5

authlib.html: authlib.html.in
	$(SHELL) ./config.status --file=authlib.html

authlib.3: authlib.3.in
	$(SHELL) ./config.status --file=authlib.3

if HAVE_SGML

authpasswd.html: authpasswd.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html authpasswd.sgml authpasswd.html

authpasswd.1: authpasswd.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man authpasswd.sgml authpasswd.1

authtest.html: authtest.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html authtest.sgml authtest.html

authtest.1: authtest.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man authtest.sgml authtest.1

authlib.html.in: authlib.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html authlib.sgml authlib.html.in

authlib.3.in: authlib.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man authlib.sgml authlib.3.in
	mv authlib.3 authlib.3.in

README_authlib.html.in: README_authlib.sgml optionlist.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html README_authlib.sgml README_authlib.html.in "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_generic.html: auth_generic.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_generic.sgml auth_generic.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_generic.3: auth_generic_meta.3
	touch $@

auth_generic_meta.3: auth_generic.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_generic.sgml auth_generic_meta.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_login.html: auth_login.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_login.sgml auth_login.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_login.3: auth_login_meta.3
	touch $@

auth_login_meta.3: auth_login.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_login.sgml auth_login_meta.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_getuserinfo.html: auth_getuserinfo.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_getuserinfo.sgml auth_getuserinfo.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"
auth_getuserinfo.3: auth_getuserinfo_meta.3
	touch $@

auth_getuserinfo_meta.3: auth_getuserinfo.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_getuserinfo.sgml auth_getuserinfo_meta.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_meta.3: auth_meta.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_meta.sgml auth_meta.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_meta.html: auth_meta.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_meta.sgml auth_meta.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_mkhomedir.html: auth_mkhomedir.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_mkhomedir.sgml auth_mkhomedir.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_mkhomedir.3: auth_mkhomedir.sgml authcallback.sgml optionlist.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_mkhomedir.sgml auth_mkhomedir.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_enumerate.html: auth_enumerate.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_enumerate.sgml auth_enumerate.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_enumerate.3: auth_enumerate.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_enumerate.sgml auth_enumerate.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_passwd.html: auth_passwd.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_passwd.sgml auth_passwd.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_passwd.3: auth_passwd.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_passwd.sgml auth_passwd.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_getoption.html: auth_getoption.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_getoption.sgml auth_getoption.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_getoption.3: auth_getoption.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_getoption.sgml auth_getoption.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_sasl.html: auth_sasl.sgml libs/docbook/sgml2html
	libs/docbook/sgml2html auth_sasl.sgml auth_sasl.html "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_sasl.3: auth_sasl.sgml libs/docbook/sgml2man
	libs/docbook/sgml2man auth_sasl.sgml auth_sasl.3 "--stringparam man.base.url.for.relative.links http://www.courier-mta.org/authlib/"

auth_sasl_ex.3: auth_sasl.3
	touch $@

endif

authldap.ldif: authldap.schema
	echo 'dn: cn=courier,cn=schema,cn=config' >authldap.ldif.tmp
	echo 'objectClass: olcSchemaConfig' >>authldap.ldif.tmp
	echo 'cn: courier' >>authldap.ldif.tmp
	sed '/^#/d;s/^attributetype/olcAttributeTypes:/;s/^objectclass/olcObjectClasses:/;s/^$$/#/' <$(srcdir)/authldap.schema | tr '\011' ' ' >>authldap.ldif.tmp
	mv -f authldap.ldif.tmp authldap.ldif

README_authlib.html: README_authlib.html.in config.status
	$(SHELL) ./config.status --file=README_authlib.html

authdaemond.o: authdaemonrc.h authdaemond.c


install-migrate: authmigrate
	@SHELL@ authmigrate

install-configure:
	test -f $(DESTDIR)@authdaemonrc@.dist && @SYSCONFTOOL@ $(DESTDIR)@authdaemonrc@.dist || true
	test -f $(DESTDIR)@authmysqlrc@.dist && @SYSCONFTOOL@ $(DESTDIR)@authmysqlrc@.dist || true
	test -f $(DESTDIR)@authpgsqlrc@.dist && @SYSCONFTOOL@ $(DESTDIR)@authpgsqlrc@.dist || true
	test -f $(DESTDIR)@authldaprc@.dist && @SYSCONFTOOL@ $(DESTDIR)@authldaprc@.dist || true
	test -f $(DESTDIR)@authsqliterc@.dist && @SYSCONFTOOL@ $(DESTDIR)@authsqliterc@.dist || true

# For maintainer's use only

distrelease:
	umask 022; $(MAKE) distcheck
	$(MAKE) rpm
	$(MAKE)
	$(MAKE)
	rm -f @PACKAGE@.spec @PACKAGE@.lpspec
	$(MAKE) @PACKAGE@.spec @PACKAGE@.lpspec
	$(MAKE) dist

rpm: rpm-build

rpm-build:
	$(MAKE) bump.rpm.release
	$(MAKE) dist
	$(MAKE) dorpm

lpm: lpm-build

lpm-build:
	$(MAKE) bump.rpm.release
	$(MAKE) dist
	$(MAKE) dolpm

dolpm:
	rm -rf lpm
	mkdir lpm
	lpbuild `test "@REPOSITORY@" == "" || echo --define "repository=1"` --srcbuild -o lpm @PACKAGE@-@VERSION@.tar.bz2

publish: publish-@REPOSITORY@

publish-dev:
	$(MAKE) dopublish SUBDIR=dev

publish-prod:
	$(MAKE) dopublish SUBDIR=prod

dopublish:
	lpbuild --resign lpm/*
	rm -rf lpmtmp
	mkdir lpmtmp
	ln lpm/* lpmtmp
	rm -f lpmtmp/*debuginfo*
	mv lpmtmp/*.src.lp repository-$(SUBDIR)/`lpm -q --distribution`/sources
	mv lpmtmp/*.lp repository-$(SUBDIR)/`lpm -q --distribution`/packages
	rm -rf lpmtmp
	ls -t repository-$(SUBDIR)/`lpm -q --distribution`/sources | tail -n +6 | xargs -r -n 1 lpm --erase repository-$(SUBDIR)
	lpm --sync repository-$(SUBDIR)
	rsync -a -v --delete-after repository-$(SUBDIR)/`lpm -q --distribution`/. headache:lpmtool.com/www/repositories/$(SUBDIR)/courier-authlib/`lpm -q --distribution`

dorpm:
	rm -rf rpm/BUILD/*
	rm -f rpm/RPMS/*/*
	rm -f rpm/SOURCES/*
	rm -f rpm/SPECS/*
	rm -f rpm/SRPMS/*
	rpmbuild -ta --clean \
		--define "_topdir `pwd`/rpm" \
		--define '_rpmdir %{_topdir}/RPMS' \
		--define '_srcrpmdir %{_topdir}/SRPMS' \
		--define '_sourcedir %{_topdir}/SOURCES' \
		--define '_specdir %{_topdir}/SPECS' \
		--define '_builddir %{_topdir}/BUILD' \
		--define '_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
		--define '_tmppath %{_var}/tmp' \
		--define '__spec_prep_pre %{___build_pre}' \
		@PACKAGE@-@VERSION@.tar.bz2

bump.rpm.release: @PACKAGE@.spec @PACKAGE@.lpspec
	test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
	NEXT_RELEASE=100; \
	test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
	RELEASE=`expr $$NEXT_RELEASE + 1`; \
	echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
	echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
	sed 's/^Release: .*/Release: '$$RELEASE'%{?dist}%{?courier_release}/' \
		<@PACKAGE@.spec >@PACKAGE@.spec.new; \
	mv @PACKAGE@.spec.new @PACKAGE@.spec; \
	sed 's/^Release: .*/Release: '$$RELEASE'/' \
		<@PACKAGE@.lpspec >@PACKAGE@.lpspec.new; \
	mv @PACKAGE@.lpspec.new @PACKAGE@.lpspec

upload-beta:
	rm -f @PACKAGE@-@VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE@-@VERSION@.tar.bz2; test -f @PACKAGE@-@VERSION@.tar.bz2.sig || exit 1
	~/src/sftools/release.pl mrsam courier authlib-devel `echo @VERSION@|sed 's/.*\(........\)/\1/'` @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig

upload-dist:
	rm -f @PACKAGE@-@VERSION@.tar.bz2.sig; gpg --detach-sign --default-key mrsam@courier-mta.com @PACKAGE@-@VERSION@.tar.bz2; test -f @PACKAGE@-@VERSION@.tar.bz2.sig || exit 1
	set -e; v="@PACKAGE@/@VERSION@/`date +%Y%m%d%H%M%S`"; git tag -s $$v -m 'Tag version @VERSION@'; cd libs; git tag -s $$v -m 'Tag version @VERSION@'
	socksify ~/src/sftools/release.pl mrsam courier authlib @VERSION@ @PACKAGE@-@VERSION@.tar.bz2 @PACKAGE@-@VERSION@.tar.bz2.sig

HTMLDOCFILES=$(HTMLFILES) README.authdebug.html README_authlib.html \
	$(man3:%.3=%.html) $(man1:%.1=%.html) userdb/userdb.html userdb/makeuserdb.html userdb/userdbpw.html

htmldoc: $(HTMLDOCFILES)
	for f in $^; do d=`basename $$f`; test "$$d" = "README.html" && d="index.html"; tidy -i -q --tidy-mark no --doctype transitional --input-encoding utf8 --output-encoding utf8 -asxml <$$f >$$f.tmp ; xsltproc --nonet $$HOME/www/www.courier-mta.org/xsl/authlib.xsl $$f.tmp | perl -ne 's~\$(id):.*\$$~\$(id):'"$$h"'\$$~; print' >$$HOME/www/www.courier-mta.org/authlib/$$d; rm -f $$f.tmp; done