File: Makefile.am

package info (click to toggle)
nmh 1.8-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 7,860 kB
  • sloc: ansic: 50,445; sh: 22,697; makefile: 1,138; lex: 740; perl: 509; yacc: 265
file content (1345 lines) | stat: -rw-r--r-- 34,842 bytes parent folder | download | duplicates (2)
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
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
## Our Makefile.am template for Makefile.in (and, eventually, Makefile)
##
## Process this with automake to generate Makefile.in
## Lists are in `LC_ALL=C sort' order.
##

## We set this to get our autoconf macros in the m4 directory
ACLOCAL_AMFLAGS = -I m4

AM_YFLAGS = -d

##
## This is the default set of libraries all programs link against.  Some
## programs add extra libraries to this set, so they override this with
## a program-specific LDADD variable.  Note that in all of the cases today
## LDADD is included in the program-specific LDADD since we want to add
## to this list of libraries, not replace it.
##
LDADD = sbr/libmh.a

##
## These are used to create the default mhn.defaults config file
## MHNSEARCHPATH is the default path to look for MIME content handlers
## MHNSEARCHPROG is the script used to find the support programs
##
MHNSEARCHPATH = "$(PATH)"
MHNSEARCHPROG = $(srcdir)/etc/mhn.find.sh

##
## nmh _does_ have a test suite!
##
TESTS_ENVIRONMENT = MH_OBJ_DIR="@abs_builddir@" \
		    MH_VERSION="$(VERSION)" \
		    OAUTH_SUPPORT='@OAUTH_SUPPORT@' \
		    CURL_USER_AGENT='@CURL_USER_AGENT@' \
		    MH_TEST_DIR=`cd "@abs_builddir@" && pwd -P`/test/testdir \
		    nmhlibexecdir="$(nmhlibexecdir)" bindir="$(bindir)" \
		    mandir="$(mandir)" nmhetcdir="$(nmhetcdir)" \
		    nmhetcdirinst="@nmhetcdirinst@$(nmhetcdir)" \
		    supported_locks="$(supported_locks)" \
		    default_locking="${default_locking}" \
		    MULTIBYTE_ENABLED=$(MULTIBYTE_ENABLED) \
		    ICONV_ENABLED=$(ICONV_ENABLED) \
		    $(TESTS_SHELL) ## Keep at end of TESTS_ENVIRONMENT.

##
## Important note: the "cleanup" test should always be last
##
TESTS = \
    test/ali/test-ali \
    test/anno/test-anno \
    test/bad-input/test-header \
    test/burst/test-burst \
    test/burst/test-burst-mime \
    test/comp/test-comp-format \
    test/dist/test-dist \
    test/folder/test-coverage \
    test/folder/test-create \
    test/folder/test-nocreate \
    test/folder/test-packf \
    test/folder/test-recurse \
    test/folder/test-sortm \
    test/folder/test-total \
    test/format/test-ap \
    test/format/test-curses \
    test/format/test-dp \
    test/format/test-fmtdump \
    test/format/test-fmttest \
    test/format/test-functions \
    test/format/test-localmbox \
    test/format/test-myhost \
    test/format/test-mymbox \
    test/format/test-myname \
    test/format/test-nullstr \
    test/format/test-rightjustify \
    test/format/test-unquote \
    test/forw/test-forw-coverage \
    test/forw/test-forw-digest \
    test/forw/test-forw-format \
    test/inc/test-deb359167 \
    test/inc/test-eom-align \
    test/inc/test-inc-scanout \
    test/inc/test-msgchk \
    test/inc/test-pop \
    test/install-mh/test-install-mh \
    test/install-mh/test-version-check \
    test/locking/test-datalocking \
    test/locking/test-spoollocking \
    test/manpages/test-manpages \
    test/mhbuild/test-attach \
    test/mhbuild/test-cte \
    test/mhbuild/test-ext-params \
    test/mhbuild/test-forw \
    test/mhbuild/test-header-encode \
    test/mhbuild/test-mhbuild \
    test/mhbuild/test-utf8-body \
    test/mhfixmsg/test-mhfixmsg \
    test/mhical/test-mhical \
    test/mhl/test-format \
    test/mhl/test-mhl-flags \
    test/mhl/test-rfc6532 \
    test/mhlist/test-ext-params \
    test/mhlist/test-mhlist \
    test/mhmail/test-mhmail \
    test/mhparam/test-etcpath \
    test/mhparam/test-home \
    test/mhparam/test-mhparam \
    test/mhpath/test-mhpath \
    test/mhshow/test-binary \
    test/mhshow/test-charset \
    test/mhshow/test-cte-binary \
    test/mhshow/test-eof-newline \
    test/mhshow/test-exec \
    test/mhshow/test-markers \
    test/mhshow/test-msg-buffer-boundaries \
    test/mhshow/test-qp \
    test/mhshow/test-subpart \
    test/mhshow/test-textcharset \
    test/mhstore/test-mhstore \
    test/mkstemp/test-mkstemp \
    test/new/test-basic \
    test/oauth/test-inc \
    test/oauth/test-mhlogin \
    test/oauth/test-mhparam \
    test/oauth/test-send \
    test/oauth/test-sendfrom \
    test/oauth/test-share \
    test/pick/test-pick \
    test/pick/test-stderr \
    test/post/test-messageid \
    test/post/test-mts \
    test/post/test-post-aliases \
    test/post/test-post-basic \
    test/post/test-post-bcc \
    test/post/test-post-dcc \
    test/post/test-post-envelope \
    test/post/test-post-fcc \
    test/post/test-post-group \
    test/post/test-post-multifrom \
    test/post/test-post-multiple \
    test/post/test-rfc6531 \
    test/post/test-sendfiles \
    test/prompter/test-prompter \
    test/rcv/test-rcvdist \
    test/rcv/test-rcvpack \
    test/rcv/test-rcvstore \
    test/rcv/test-rcvtty \
    test/refile/test-refile \
    test/repl/test-convert \
    test/repl/test-if-str \
    test/repl/test-multicomp \
    test/repl/test-repl \
    test/repl/test-trailing-newline \
    test/scan/test-header-parsing \
    test/scan/test-scan \
    test/scan/test-scan-file \
    test/scan/test-scan-multibyte \
    test/send/test-sendfrom \
    test/sequences/test-flist \
    test/sequences/test-mark \
    test/sequences/test-out-of-range \
    test/show/test-show \
    test/slocal/test-slocal \
    test/whatnow/test-attach-detach \
    test/whatnow/test-cd \
    test/whatnow/test-ls \
    test/whom/test-whom \
    test/cleanup ## The "cleanup" test should always be last.

check_SCRIPTS = test/common.sh

check_PROGRAMS = \
    test/fakehttp \
    test/fakepop \
    test/fakesmtp \
    test/getcanon \
    test/getcwidth \
    test/getfullname \
    test/runpty \
    #

## So they can be built without builing the `check' target.
check-programs: $(check_PROGRAMS)

## The location of installed nmhetcdir is, for all purposes except
## distcheck, $nmhetcdir.  For distcheck, prepend $MH_INST_DIR (from
## test/common.sh.in), which is based on $MH_TEST_DIR (from
## $TESTS_ENVIRONMENT).
AM_DISTCHECK_CONFIGURE_FLAGS = DISABLE_SETGID_MAIL=1 \
			NMHETCDIRINST='$${abs_builddir}/test/testdir/inst'

##
## Stuff that should be cleaned via "make clean"
##
CLEANFILES = \
    $(man_MANS) \
    config/version.c \
    etc/bash_completion_nmh \
    etc/mhn.defaults \
    etc/mts.conf \
    man/man.sed \
    man/mh-chart.man
    #

clean-local:
	@rm -rf RPM a.out.dSYM uip/a.out.dSYM
	@rm -rf test/testdir
	@rm -rf *.plist

##
## Stuff that should be cleaned via "make maintainer-clean"
##
MAINTAINERCLEANFILES = \
    atags \
    cscope.files \
    cscope.in.out \
    cscope.out \
    cscope.po.out \
    #

##
## And our own superclean, to get everything left by maintainer-clean.
##
SUPERCLEANFILES = \
    ChangeLog \
    Makefile.in \
    aclocal.m4 \
    compile \
    config.guess \
    config.h.in \
    config.h.in~ \
    config.sub \
    configure \
    depcomp \
    install-sh \
    missing \
    nmh-*.tar.gz \
    nmh-*.tar.gz.sig \
    test-driver \
    ylwrap \
    #

superclean: maintainer-clean
	@rm -f $(SUPERCLEANFILES)
.PHONY: superclean

##
## This is a list of all programs that get installed in the "bin" directory
## Note that primary difference between "PROGRAMS" and "SCRIPTS" is that
## the latter do not have $(EXEEXT) added on the end.
##
bin_PROGRAMS = \
    uip/ali \
    uip/anno \
    uip/burst \
    uip/comp \
    uip/dist \
    uip/flist \
    uip/fmttest \
    uip/folder \
    uip/forw \
    uip/inc \
    uip/install-mh \
    uip/mark \
    uip/mhbuild \
    uip/mhfixmsg \
    uip/mhical \
    uip/mhlist \
    uip/mhlogin \
    uip/mhn \
    uip/mhparam \
    uip/mhpath \
    uip/mhshow \
    uip/mhstore \
    uip/msgchk \
    uip/new \
    uip/packf \
    uip/pick \
    uip/prompter \
    uip/refile \
    uip/repl \
    uip/rmf \
    uip/rmm \
    uip/scan \
    uip/send \
    uip/show \
    uip/sortm \
    uip/whatnow \
    uip/whom \
    #

noinst_PROGRAMS = \
    uip/imaptest \
    #

bin_SCRIPTS = \
    etc/sendfiles \
    uip/mhmail \
    #

##
## This is all programs that get installed in the "libexec" directory
##
nmhlibexec_PROGRAMS = \
    uip/ap \
    uip/dp \
    uip/fmtdump \
    uip/mhl \
    uip/mkstemp \
    uip/post \
    uip/rcvdist \
    uip/rcvpack \
    uip/rcvstore \
    uip/rcvtty \
    uip/slocal \
    uip/viamail \
    #

nmhlibexec_SCRIPTS = uip/spost

##
## Internal libraries that we create as part of the build process
## but do not install
##
noinst_LIBRARIES = \
    mts/libmts.a \
    sbr/libmh.a \
    #

##
## These are all of our header files.  Right now we don't install any of
## them, but that might change in the future.
##
noinst_HEADERS = \
    config/version.h \
    h/icalendar.h \
    h/mh.h \
    h/mhparse.h \
    h/mime.h \
    h/netsec.h \
    h/nmh.h \
    h/tws.h \
    mts/smtp/smtp.h \
    sbr/addrsbr.h \
    sbr/ambigsw.h \
    sbr/arglist.h \
    sbr/atooi.h \
    sbr/base64.h \
    sbr/brkstring.h \
    sbr/charstring.h \
    sbr/check_charset.h \
    sbr/client.h \
    sbr/concat.h \
    sbr/context_del.h \
    sbr/context_find.h \
    sbr/context_foil.h \
    sbr/context_read.h \
    sbr/context_replace.h \
    sbr/context_save.h \
    sbr/copyip.h \
    sbr/cpydata.h \
    sbr/cpydgst.h \
    sbr/crawl_folders.h \
    sbr/credentials.h \
    sbr/ctype-checked.h \
    sbr/datetime.h \
    sbr/discard.h \
    sbr/done.h \
    sbr/dtime.h \
    sbr/encode_rfc2047.h \
    sbr/error.h \
    sbr/escape_addresses.h \
    sbr/ext_hook.h \
    sbr/fdcompare.h \
    sbr/fmt_addr.h \
    sbr/fmt_compile.h \
    sbr/fmt_new.h \
    sbr/fmt_rfc2047.h \
    sbr/fmt_scan.h \
    sbr/folder_addmsg.h \
    sbr/folder_delmsgs.h \
    sbr/folder_free.h \
    sbr/folder_pack.h \
    sbr/folder_read.h \
    sbr/folder_realloc.h \
    sbr/getarguments.h \
    sbr/getcpy.h \
    sbr/geteditor.h \
    sbr/getfolder.h \
    sbr/getpass.h \
    sbr/globals.h \
    sbr/lock_file.h \
    sbr/m_atoi.h \
    sbr/m_backup.h \
    sbr/m_convert.h \
    sbr/m_draft.h \
    sbr/m_getfld.h \
    sbr/m_gmprot.h \
    sbr/m_maildir.h \
    sbr/m_mktemp.h \
    sbr/m_name.h \
    sbr/m_popen.h \
    sbr/m_rand.h \
    sbr/maildir_read_and_sort.h \
    sbr/makedir.h \
    sbr/message_id.h \
    sbr/mf.h \
    sbr/mime_type.h \
    sbr/mts.h \
    sbr/oauth.h \
    sbr/oauth_prof.h \
    sbr/path.h \
    sbr/pidstatus.h \
    sbr/pidwait.h \
    sbr/print_help.h \
    sbr/print_sw.h \
    sbr/print_version.h \
    sbr/push.h \
    sbr/r1bindex.h \
    sbr/read_line.h \
    sbr/read_switch.h \
    sbr/read_switch_multiword.h \
    sbr/read_switch_multiword_via_readline.h \
    sbr/read_yes_or_no_if_tty.h \
    sbr/readconfig.h \
    sbr/refile.h \
    sbr/remdir.h \
    sbr/ruserpass.h \
    sbr/seq_add.h \
    sbr/seq_bits.h \
    sbr/seq_del.h \
    sbr/seq_getnum.h \
    sbr/seq_list.h \
    sbr/seq_nameok.h \
    sbr/seq_print.h \
    sbr/seq_read.h \
    sbr/seq_save.h \
    sbr/seq_setcur.h \
    sbr/seq_setprev.h \
    sbr/seq_setunseen.h \
    sbr/showfile.h \
    sbr/signals.h \
    sbr/smatch.h \
    sbr/snprintb.h \
    sbr/stringdex.h \
    sbr/terminal.h \
    sbr/trimcpy.h \
    sbr/unquote.h \
    sbr/uprf.h \
    sbr/utils.h \
    sbr/vector.h \
    sbr/vfgets.h \
    test/server.h \
    thirdparty/jsmn/jsmn.h \
    uip/aliasbr.h \
    uip/annosbr.h \
    uip/distsbr.h \
    uip/dropsbr.h \
    uip/forwsbr.h \
    uip/mhbuildsbr.h \
    uip/mhfree.h \
    uip/mhlistsbr.h \
    uip/mhlsbr.h \
    uip/mhmisc.h \
    uip/mhoutsbr.h \
    uip/mhshowsbr.h \
    uip/mhstoresbr.h \
    uip/picksbr.h \
    uip/popsbr.h \
    uip/replsbr.h \
    uip/scansbr.h \
    uip/sendsbr.h \
    uip/whatnowproc.h \
    uip/whatnowsbr.h \
    #

##
## Extra files we need to install in various places
##
dist_nmhetc_SCRIPTS = etc/rmmproc.messageid
dist_nmhetc_DATA = \
    etc/MailAliases \
    etc/components \
    etc/digestcomps \
    etc/distcomps \
    etc/forwcomps \
    etc/mhical.12hour \
    etc/mhical.24hour \
    etc/mhl.body \
    etc/mhl.digest \
    etc/mhl.format \
    etc/mhl.forward \
    etc/mhl.headers \
    etc/mhl.reply \
    etc/mhl.replywithoutbody \
    etc/mhshow.marker \
    etc/rcvdistcomps \
    etc/rcvdistcomps.outbox \
    etc/replcomps \
    etc/replgroupcomps \
    etc/scan.MMDDYY \
    etc/scan.YYYYMMDD \
    etc/scan.curses \
    etc/scan.default \
    etc/scan.highlighted \
    etc/scan.mailx \
    etc/scan.nomime \
    etc/scan.size \
    etc/scan.time \
    etc/scan.timely \
    etc/scan.unseen \
    #

##
## The same as above, but we don't include these in the distribution
## (because they're generated at compile time)
##
nmhetc_DATA = \
    etc/bash_completion_nmh \
    etc/mhn.defaults \
    etc/mts.conf \
    #

##
## Documentation that gets installed in docdir
##
dist_doc_DATA = \
    COPYRIGHT \
    INSTALL \
    NEWS \
    README \
    VERSION \
    docs/COMPLETION-TCSH \
    docs/COMPLETION-ZSH \
    docs/DIFFERENCES \
    docs/FAQ \
    docs/MAIL.FILTERING \
    docs/MAILING-LISTS \
    docs/README-ATTACHMENTS \
    docs/README-HOOKS \
    docs/README-components \
    docs/README.SASL \
    docs/README.about \
    docs/README.developers \
    docs/README.manpages \
    docs/TODO \
    #

##
## Contribs that get installed in docdir/contrib/
##
docs_contribdir = $(docdir)/contrib
dist_docs_contrib_SCRIPTS = \
    docs/contrib/localpostproc \
    docs/contrib/ml \
    docs/contrib/replyfilter \
    docs/contrib/vpick \
    #

dist_docs_contrib_DATA = docs/contrib/replaliases

##
## Our man pages
##
man_MANS = \
    man/ali.1mh \
    man/anno.1mh \
    man/ap.8mh \
    man/burst.1mh \
    man/comp.1mh \
    man/dist.1mh \
    man/dp.8mh \
    man/flist.1mh \
    man/flists.1mh \
    man/fmtdump.8mh \
    man/fmttest.1mh \
    man/fnext.1mh \
    man/folder.1mh \
    man/folders.1mh \
    man/forw.1mh \
    man/fprev.1mh \
    man/inc.1mh \
    man/install-mh.1mh \
    man/mark.1mh \
    man/mh-alias.5mh \
    man/mh-chart.7mh \
    man/mh-draft.5mh \
    man/mh-folders.5mh \
    man/mh-format.5mh \
    man/mh-mail.5mh \
    man/mh-mime.7mh \
    man/mh-mkstemp.1mh \
    man/mh-profile.5mh \
    man/mh-sequence.5mh \
    man/mh-tailor.5mh \
    man/mh_profile.5mh \
    man/mhbuild.1mh \
    man/mhfixmsg.1mh \
    man/mhical.1mh \
    man/mhl.1mh \
    man/mhlist.1mh \
    man/mhlogin.1mh \
    man/mhmail.1mh \
    man/mhn.1mh \
    man/mhparam.1mh \
    man/mhpath.1mh \
    man/mhshow.1mh \
    man/mhstore.1mh \
    man/msgchk.1mh \
    man/mts.conf.5mh \
    man/new.1mh \
    man/next.1mh \
    man/nmh.7mh \
    man/packf.1mh \
    man/pick.1mh \
    man/post.8mh \
    man/prev.1mh \
    man/prompter.1mh \
    man/rcvdist.1mh \
    man/rcvpack.1mh \
    man/rcvstore.1mh \
    man/rcvtty.1mh \
    man/refile.1mh \
    man/repl.1mh \
    man/rmf.1mh \
    man/rmm.1mh \
    man/scan.1mh \
    man/send.1mh \
    man/sendfiles.1mh \
    man/show.1mh \
    man/slocal.1mh \
    man/sortm.1mh \
    man/unseen.1mh \
    man/whatnow.1mh \
    man/whom.1mh \
    #

##
## Sources for our man pages
##
man_SRCS = \
    man/MH.man \
    man/ali.man \
    man/anno.man \
    man/ap.man \
    man/burst.man \
    man/comp.man \
    man/dist.man \
    man/dp.man \
    man/flist.man \
    man/flists.man \
    man/fmtdump.man \
    man/fmttest.man \
    man/fnext.man \
    man/folder.man \
    man/folders.man \
    man/forw.man \
    man/fprev.man \
    man/inc.man \
    man/install-mh.man \
    man/mark.man \
    man/mh-alias.man \
    man/mh-chart-gen.sh \
    man/mh-draft.man \
    man/mh-folders.man \
    man/mh-format.man \
    man/mh-mail.man \
    man/mh-mime.man \
    man/mh-mkstemp.man \
    man/mh-profile.man \
    man/mh-sequence.man \
    man/mh-tailor.man \
    man/mh_profile.man \
    man/mhbuild.man \
    man/mhfixmsg.man \
    man/mhical.man \
    man/mhl.man \
    man/mhlist.man \
    man/mhlogin.man \
    man/mhmail.man \
    man/mhn.man \
    man/mhparam.man \
    man/mhpath.man \
    man/mhshow.man \
    man/mhstore.man \
    man/msgchk.man \
    man/mts.conf.man \
    man/new.man \
    man/next.man \
    man/nmh.man \
    man/packf.man \
    man/pick.man \
    man/post.man \
    man/prev.man \
    man/prompter.man \
    man/rcvdist.man \
    man/rcvpack.man \
    man/rcvstore.man \
    man/rcvtty.man \
    man/refile.man \
    man/repl.man \
    man/rmf.man \
    man/rmm.man \
    man/scan.man \
    man/send.man \
    man/sendfiles.man \
    man/show.man \
    man/slocal.man \
    man/sortm.man \
    man/unseen.man \
    man/whatnow.man \
    man/whom.man \
    #

##
## Files we need to include in the distribution which aren't found by
## Automake using the automatic rules
##
EXTRA_DIST = \
    $(MHNSEARCHPROG) \
    $(TESTS) \
    $(man_SRCS) \
    DATE \
    MACHINES \
    SPECS/nmh.cygport \
    SPECS/nmh.spec \
    autogen.sh \
    build_nmh \
    config/version.sh \
    docs/ChangeLog_MH-3_to_MH-6.6 \
    docs/ChangeLog_MH-6.7.0_to_MH-6.8.4.html \
    etc/bash_completion_nmh-gen \
    etc/mhn.defaults.sh \
    etc/mts.conf.in \
    etc/sendfiles \
    sbr/icalparse.h \
    test/README \
    test/fakesendmail \
    test/inc/deb359167.mbox \
    test/inc/filler.txt \
    test/inc/fromline.txt \
    test/inc/md5sums \
    test/inc/msgheader.txt \
    test/mhbuild/nulls \
    test/mhbuild/somebinary \
    test/mhbuild/textplain \
    test/mhbuild/tiny.jpg \
    test/mhmail/attachment.txt \
    test/oauth/common.sh \
    test/post/test-post-common.sh \
    test/send/README \
    test/valgrind.supp \
    uip/mhmail \
    #

##
## These are all of the definitions for each of the programs listed above.
## They describe the source files that make up the programs and any particular
## overrides that are used to select different library options from the
## default.
##
POSTLINK = @POSTLINK@

uip_ali_SOURCES = uip/ali.c uip/aliasbr.c
uip_ali_LDADD = $(LDADD) $(POSTLINK)

uip_anno_SOURCES = uip/anno.c uip/annosbr.c
uip_anno_LDADD = $(LDADD) $(POSTLINK)

uip_burst_SOURCES = uip/burst.c \
		    uip/mhparse.c \
		    uip/mhmisc.c \
		    uip/mhfree.c \
		    #
uip_burst_LDADD = $(LDADD) $(ICONVLIB) $(POSTLINK)

uip_comp_SOURCES = uip/comp.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
		   uip/annosbr.c uip/distsbr.c uip/aliasbr.c
uip_comp_LDADD = $(LDADD) $(READLINELIB) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_dist_SOURCES = uip/dist.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
		   uip/annosbr.c uip/distsbr.c uip/forwsbr.c uip/aliasbr.c
uip_dist_LDADD = $(LDADD) $(READLINELIB) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_flist_SOURCES = uip/flist.c
uip_flist_LDADD = $(LDADD) $(POSTLINK)

uip_folder_SOURCES = uip/folder.c
uip_folder_LDADD = $(LDADD) $(POSTLINK)

uip_forw_SOURCES = uip/forw.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
		   uip/annosbr.c uip/distsbr.c uip/forwsbr.c uip/aliasbr.c
uip_forw_LDADD = $(LDADD) $(READLINELIB) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_imaptest_SOURCES = uip/imaptest.c
uip_imaptest_LDADD = $(LDADD) $(SASLLIB) $(CURLLIB) $(TLSLIB) $(POSTLINK)

uip_inc_SOURCES = uip/inc.c uip/scansbr.c uip/dropsbr.c uip/popsbr.c
uip_inc_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(SASLLIB) $(CURLLIB) \
		$(TLSLIB) $(POSTLINK)

uip_install_mh_SOURCES = uip/install-mh.c
uip_install_mh_LDADD = $(LDADD) $(POSTLINK)

uip_mark_SOURCES = uip/mark.c
uip_mark_LDADD = $(LDADD) $(POSTLINK)

uip_mhbuild_SOURCES = uip/mhbuild.c \
		      uip/mhbuildsbr.c \
		      uip/mhlistsbr.c \
		      uip/mhoutsbr.c \
		      uip/mhmisc.c \
		      uip/mhfree.c \
		      uip/mhparse.c \
		      uip/mhstoresbr.c \
		      uip/mhshowsbr.c \
		      #
uip_mhbuild_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhfixmsg_SOURCES = uip/mhfixmsg.c \
		       uip/mhparse.c \
		       uip/mhoutsbr.c \
		       uip/mhmisc.c \
		       uip/mhfree.c \
		       uip/mhshowsbr.c \
		       uip/mhlistsbr.c \
		       #
uip_mhfixmsg_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhical_SOURCES = uip/mhical.c
uip_mhical_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhlist_SOURCES = uip/mhlist.c \
		     uip/mhparse.c \
		     uip/mhlistsbr.c \
		     uip/mhmisc.c \
		     uip/mhfree.c \
		     #
uip_mhlist_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhn_SOURCES = uip/mhn.c \
		  uip/mhparse.c \
		  uip/mhshowsbr.c \
		  uip/mhlistsbr.c \
		  uip/mhstoresbr.c \
		  uip/mhmisc.c \
		  uip/mhfree.c \
		  #
uip_mhn_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhparam_SOURCES = uip/mhparam.c
uip_mhparam_LDADD = $(LDADD) $(POSTLINK)

uip_mhpath_SOURCES = uip/mhpath.c
uip_mhpath_LDADD = $(LDADD) $(POSTLINK)

uip_mhshow_SOURCES = uip/mhshow.c \
		     uip/mhparse.c \
		     uip/mhshowsbr.c \
		     uip/mhlistsbr.c \
		     uip/mhmisc.c \
		     uip/mhfree.c \
		     #
uip_mhshow_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhstore_SOURCES = uip/mhstore.c \
		      uip/mhparse.c \
		      uip/mhshowsbr.c \
		      uip/mhlistsbr.c \
		      uip/mhstoresbr.c \
		      uip/mhmisc.c \
		      uip/mhfree.c \
		      #
uip_mhstore_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_msgchk_SOURCES = uip/msgchk.c uip/popsbr.c
uip_msgchk_LDADD = $(LDADD) $(SASLLIB) $(CURLLIB) $(TLSLIB) $(POSTLINK)

uip_new_SOURCES = uip/new.c
uip_new_LDADD = $(LDADD) $(POSTLINK)

uip_packf_SOURCES = uip/packf.c uip/dropsbr.c
uip_packf_LDADD = $(LDADD) $(POSTLINK)

uip_pick_SOURCES = uip/pick.c uip/picksbr.c
uip_pick_LDADD = $(LDADD) $(ICONVLIB) $(POSTLINK)

uip_prompter_SOURCES = uip/prompter.c
uip_prompter_LDADD = $(LDADD) $(POSTLINK)

uip_refile_SOURCES = uip/refile.c
uip_refile_LDADD = $(LDADD) $(POSTLINK)

uip_repl_SOURCES = uip/repl.c uip/replsbr.c uip/whatnowproc.c uip/whatnowsbr.c \
		   uip/sendsbr.c uip/annosbr.c uip/distsbr.c uip/aliasbr.c
uip_repl_LDADD = $(LDADD) $(READLINELIB) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_rmf_SOURCES = uip/rmf.c
uip_rmf_LDADD = $(LDADD) $(POSTLINK)

uip_rmm_SOURCES = uip/rmm.c
uip_rmm_LDADD = $(LDADD) $(POSTLINK)

uip_scan_SOURCES = uip/scan.c uip/scansbr.c
uip_scan_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_send_SOURCES = uip/send.c uip/sendsbr.c uip/annosbr.c \
		   uip/distsbr.c uip/aliasbr.c
uip_send_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_show_SOURCES = uip/show.c uip/mhlsbr.c
uip_show_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_sortm_SOURCES = uip/sortm.c
uip_sortm_LDADD = $(LDADD) $(POSTLINK)

uip_whatnow_SOURCES = uip/whatnow.c uip/whatnowsbr.c uip/sendsbr.c \
		      uip/annosbr.c uip/distsbr.c uip/aliasbr.c
uip_whatnow_LDADD = $(LDADD) $(READLINELIB) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_whom_SOURCES = uip/whom.c uip/distsbr.c
uip_whom_LDADD = $(LDADD) $(POSTLINK)

##
## Program definitions for all utilities that end up in $(nmhlibexecdir)
##

uip_ap_SOURCES = uip/ap.c
uip_ap_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_dp_SOURCES = uip/dp.c
uip_dp_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_fmtdump_SOURCES = uip/fmtdump.c
uip_fmtdump_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_fmttest_SOURCES = uip/fmttest.c
uip_fmttest_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhl_SOURCES = uip/mhl.c uip/mhlsbr.c
uip_mhl_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_mhlogin_SOURCES = uip/mhlogin.c
uip_mhlogin_LDADD = mts/libmts.a $(LDADD) $(CURLLIB) $(POSTLINK)

uip_mkstemp_SOURCES = uip/mkstemp.c
uip_mkstemp_LDADD = $(LDADD) $(POSTLINK)

uip_post_SOURCES = uip/post.c uip/aliasbr.c
uip_post_LDADD = mts/libmts.a $(LDADD) $(SASLLIB) $(CURLLIB) $(TLSLIB) \
		 $(POSTLINK)

uip_rcvdist_SOURCES = uip/rcvdist.c uip/distsbr.c
uip_rcvdist_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_rcvpack_SOURCES = uip/rcvpack.c uip/dropsbr.c
uip_rcvpack_LDADD = $(LDADD) $(POSTLINK)

uip_rcvstore_SOURCES = uip/rcvstore.c
uip_rcvstore_LDADD = $(LDADD) $(POSTLINK)

uip_rcvtty_SOURCES = uip/rcvtty.c uip/scansbr.c
uip_rcvtty_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

uip_slocal_SOURCES = uip/slocal.c uip/aliasbr.c uip/dropsbr.c
uip_slocal_LDADD = $(LDADD) $(NDBM_LIBS) $(POSTLINK)

uip_viamail_SOURCES = uip/viamail.c uip/mhmisc.c uip/sendsbr.c \
		      uip/annosbr.c uip/distsbr.c uip/aliasbr.c
uip_viamail_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)

##
## Other program definitions
##

test_getfullname_SOURCES = test/getfullname.c
test_getfullname_LDADD = $(LDADD) $(POSTLINK)

test_getcanon_SOURCES = test/getcanon.c
test_getcanon_LDADD = $(POSTLINK)

test_fakepop_SOURCES = test/fakepop.c test/server.c
test_fakepop_LDADD = $(POSTLINK)

test_fakesmtp_SOURCES = test/fakesmtp.c test/server.c
test_fakesmtp_LDADD = $(POSTLINK)

test_fakehttp_SOURCES = test/fakehttp.c test/server.c
test_fakehttp_LDADD = $(LDADD) $(POSTLINK)

test_getcwidth_SOURCES = test/getcwidth.c
test_getcwidth_LDADD = $(POSTLINK)

test_runpty_SOURCES = test/runpty.c
test_runpty_LDADD = $(POSTLINK)

##
## Our rebuild rules for files that aren't built via the normal mechanisms
##

## Hard-code the config/version.c target, instead of using $@, so this
## rule works for the distcheck target with Solaris (System V) make.
## distcheck uses VPATH, causes that make to prepend the VPATH to $@.
config/version.c: Makefile $(srcdir)/config/version.sh
	env srcdir="$(srcdir)" sh $(srcdir)/config/version.sh $(VERSION) > ./config/version.c

etc/bash_completion_nmh: $(srcdir)/etc/bash_completion_nmh-gen man/mh-chart.man
	$(srcdir)/etc/bash_completion_nmh-gen > $@

etc/mts.conf: $(srcdir)/etc/mts.conf.in Makefile
	@rm -f $@
	$(SED) -e 's,%mts%,$(MTS),' \
	       -e 's,%mailspool%,$(mailspool),' \
	       -e 's,%smtpserver%,$(smtpserver),' \
	       -e 's,%default_locking%,$(default_locking),' \
	       -e 's,%supported_locks%,$(supported_locks),' \
				< $(srcdir)/etc/mts.conf.in > $@

etc/mhn.defaults: $(srcdir)/etc/mhn.defaults.sh $(MHNSEARCHPROG)
	@rm -f $@
	$(srcdir)/etc/mhn.defaults.sh $(MHNSEARCHPATH) $(MHNSEARCHPROG) > $@

##
## Use configure to set up default LN, but through a make variable so
## that it can be overridden at install time.
##
LN = @LN@

##
## This rule gets called at "make install" time; we use it to create links
## between different programs.
##
install-exec-hook:
	@rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
	@rm -f $(DESTDIR)$(bindir)/folders$(EXEEXT)
	@rm -f $(DESTDIR)$(bindir)/fnext$(EXEEXT)
	@rm -f $(DESTDIR)$(bindir)/fprev$(EXEEXT)
	@rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
	@rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
	@rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/flist$(EXEEXT) $(DESTDIR)$(bindir)/flists$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/folder$(EXEEXT) $(DESTDIR)$(bindir)/folders$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fnext$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fprev$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/unseen$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/prev$(EXEEXT)
	$(LN) $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/next$(EXEEXT)
	if test x$(SETGID_MAIL) != x; then \
		chgrp $(MAIL_SPOOL_GRP) $(DESTDIR)$(bindir)/inc$(EXEEXT) && \
		chmod 2755 $(DESTDIR)$(bindir)/inc$(EXEEXT); \
	fi

##
## Make sure we remove those links at uninstall time
##
uninstall-hook:
	rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/folders$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/fnext$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/fprev$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)

##
## Our rules to build our internal libraries (libmh.a, libmts.a)
##
sbr_libmh_a_SOURCES = \
    config/version.c \
    sbr/addrsbr.c \
    sbr/ambigsw.c \
    sbr/arglist.c \
    sbr/atooi.c \
    sbr/base64.c \
    sbr/brkstring.c \
    sbr/charstring.c \
    sbr/check_charset.c \
    sbr/client.c \
    sbr/concat.c \
    sbr/context_del.c \
    sbr/context_find.c \
    sbr/context_foil.c \
    sbr/context_read.c \
    sbr/context_replace.c \
    sbr/context_save.c \
    sbr/copyip.c \
    sbr/cpydata.c \
    sbr/cpydgst.c \
    sbr/crawl_folders.c \
    sbr/credentials.c \
    sbr/ctype-checked.c \
    sbr/datetime.c \
    sbr/discard.c \
    sbr/done.c \
    sbr/dtime.c \
    sbr/dtimep.l \
    sbr/encode_rfc2047.c \
    sbr/error.c \
    sbr/escape_addresses.c \
    sbr/ext_hook.c \
    sbr/fdcompare.c \
    sbr/fmt_addr.c \
    sbr/fmt_compile.c \
    sbr/fmt_new.c \
    sbr/fmt_rfc2047.c \
    sbr/fmt_scan.c \
    sbr/folder_addmsg.c \
    sbr/folder_delmsgs.c \
    sbr/folder_free.c \
    sbr/folder_pack.c \
    sbr/folder_read.c \
    sbr/folder_realloc.c \
    sbr/getarguments.c \
    sbr/getcpy.c \
    sbr/geteditor.c \
    sbr/getfolder.c \
    sbr/getpass.c \
    sbr/globals.c \
    sbr/icalendar.l \
    sbr/icalparse.y \
    sbr/lock_file.c \
    sbr/m_atoi.c \
    sbr/m_backup.c \
    sbr/m_convert.c \
    sbr/m_draft.c \
    sbr/m_getfld.c \
    sbr/m_gmprot.c \
    sbr/m_maildir.c \
    sbr/m_mktemp.c \
    sbr/m_name.c \
    sbr/m_popen.c \
    sbr/m_rand.c \
    sbr/maildir_read_and_sort.c \
    sbr/makedir.c \
    sbr/message_id.c \
    sbr/mf.c \
    sbr/mime_type.c \
    sbr/mts.c \
    sbr/netsec.c \
    sbr/oauth.c \
    sbr/oauth_prof.c \
    sbr/path.c \
    sbr/pidstatus.c \
    sbr/pidwait.c \
    sbr/print_help.c \
    sbr/print_sw.c \
    sbr/print_version.c \
    sbr/push.c \
    sbr/r1bindex.c \
    sbr/read_line.c \
    sbr/read_switch.c \
    sbr/read_switch_multiword.c \
    sbr/read_switch_multiword_via_readline.c \
    sbr/read_yes_or_no_if_tty.c \
    sbr/readconfig.c \
    sbr/refile.c \
    sbr/remdir.c \
    sbr/ruserpass.c \
    sbr/seq_add.c \
    sbr/seq_bits.c \
    sbr/seq_del.c \
    sbr/seq_getnum.c \
    sbr/seq_list.c \
    sbr/seq_nameok.c \
    sbr/seq_print.c \
    sbr/seq_read.c \
    sbr/seq_save.c \
    sbr/seq_setcur.c \
    sbr/seq_setprev.c \
    sbr/seq_setunseen.c \
    sbr/showfile.c \
    sbr/signals.c \
    sbr/smatch.c \
    sbr/snprintb.c \
    sbr/stringdex.c \
    sbr/terminal.c \
    sbr/trimcpy.c \
    sbr/unquote.c \
    sbr/uprf.c \
    sbr/utils.c \
    sbr/vector.c \
    sbr/vfgets.c \
    #

sbr_libmh_a_LIBADD = $(LIBOBJS)

##
## Need explicit dependency so that YACC is run before LEX.
##
sbr/icalendar.c: sbr/icalparse.c
$(srcdir)/uip/mhical.c: sbr/icalparse.h

##
## Because these files use the definitions in the libmh rule below,
## they need to be rebuilt if the Makefile changes.
##

config/sbr_libmh_a-config.$(OBJEXT) sbr/sbr_libmh_a-mts.$(OBJEXT): Makefile

sbr_libmh_a_CPPFLAGS = ${AM_CPPFLAGS} \
		-DNMHBINDIR='"$(bindir)"' \
		-DNMHLIBEXECDIR='"$(nmhlibexecdir)"' \
		-DNMHETCDIR='"@nmhetcdirinst@$(nmhetcdir)"' \
		-DNMHDOCDIR='"@docdir@"' \
		-DMAILSPOOL='"$(mailspool)"' \
		-DSENDMAILPATH='"$(sendmailpath)"'

mts_libmts_a_SOURCES = mts/smtp/smtp.c

##
## Our rules for generating man pages (both the rule for man.sed and
## the implicit rules for man page generation).
##
manext1 = 1mh
manext5 = 5mh
manext7 = 7mh
manext8 = 8mh

$(man_MANS): man/man.sed

man/man.sed: Makefile
	@echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
	@echo 's,%nmhversion%,nmh-$(VERSION),g' >> $@
	@echo 's,%nmhetcdir%,$(nmhetcdir),g' >> $@
	@echo 's,%nmhlibexecdir%,$(nmhlibexecdir),g' >> $@
	@echo 's,%bindir%,$(bindir),g' >> $@
	@echo 's,%docdir%,$(docdir),g' >> $@
	@echo 's,%mandir%,$(mandir),g' >> $@
	@echo 's,%mailspool%,$(mailspool),g' >> $@
	@echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
	@echo 's,%default_locking%,$(default_locking),g' >> $@
	@echo 's,%supported_locks%,$(supported_locks),g' >> $@
	@echo 's,%manext1%,$(manext1),g' >> $@
	@echo 's,%manext5%,$(manext5),g' >> $@
	@echo 's,%manext7%,$(manext7),g' >> $@
	@echo 's,%manext8%,$(manext8),g' >> $@
	@echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
	@echo ' s,%mhl_forward%,,g' >> $@
	@echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
	@echo ' s,%mhl_format%,,g' >> $@
	@echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
	@echo ' s,%mhl_reply%,,g' >> $@

man/mh-chart.man: $(man_SRCS)
	$(srcdir)/man/mh-chart-gen.sh > $@

.man.$(manext1):
	$(SED) -f man/man.sed $< > $@

.man.$(manext5):
	$(SED) -f man/man.sed $< > $@

.man.$(manext7):
	$(SED) -f man/man.sed $< > $@

.man.$(manext8):
	$(SED) -f man/man.sed $< > $@

man: $(man_MANS)

cleanman:
	rm -f $(man_MANS)

.PHONY: man cleanman

## Don't include commit hashes in ChangeLog.
## Fix ISO-8859-1 encoding of ‘ü’ in uip/slocal.c's log.
ChangeLog:
	@[ -d $(srcdir)/.git ]  &&  ( \
	    cd $(srcdir); \
	    git --no-pager log --no-color --abbrev-commit | \
            LC_ALL=C sed \
		-e '/^commit [0-9a-f][0-9a-f]*$$/d' \
		-e '/149745/s/M.ller/Müller/' >$@ \
	)  ||  true
## Make ChangeLog phony so it will always get regenerated.  But don't
## fail if we don't have a git repository in order to allow
## regeneration of distribution archive or RPM.
.PHONY: ChangeLog

##
## Our RPM build target
##
rpm: dist
	@$(MKDIR_P) $(rpmdir)/SOURCES
	@mv -f $(DIST_ARCHIVES) $(rpmdir)/SOURCES
	@cp -p VERSION $(rpmdir)/SOURCES
	@rpmbuild --define '_topdir $(rpmdir)' \
	  --define '_tmppath %{_topdir}/TMP' \
	  --define "_sysconfdir $(DESTDIR)$(sysconfdir)" \
	  -ba SPECS/nmh.spec
.PHONY: rpm


##
## Use GNU gcov to find the coverage of the test suite.
## These targets are not integrated into the other automake
## targets because they will be used so infrequently, if at all.
##
gcov: gcov-rebuild gcov-run gcov-process gcov-report
gcov-rebuild:
	@echo rebuilding with AM_CFLAGS=--coverage . . .
	@(make clean  &&  make AM_CFLAGS=--coverage) > /dev/null
gcov-run:
	make check AM_CFLAGS=--coverage
gcov-process:
	@for i in `find . -name '*.gcda'`; do \
	   gcov -pro `echo $$i | $(SED) 's%\\(.*\\)/%\\1 %'`; \
	 done
gcov-report:
	@for i in `find . -name '*.gcno'`; do \
	   if test -f `echo $$i | sed 's%\.gcno%.gcda%'`; then :; else \
	     echo untested: $$i; \
	   fi; \
	 done
gcov-mostlyclean:
	@find . -name '*.gcno' -o -name '*.gcda' | xargs rm
gcov-clean: gcov-mostlyclean
	@find . -name '*.gcov' | xargs rm
.PHONY: gcov gcov-rebuild gcov-run gcov-process gcov-report \
    gcov-mostlyclean gcov-clean


##
## Rules to upload the distribution to savannah
##
upload: dist
	@if test -z "$(SAVANNAH_USERNAME)"; then \
		echo "You need to set SAVANNAH_USERNAME to the your username on savannah.gnu.org." ;\
		echo "You can set it either in your environment or on the make command line."; \
		false; \
	fi
	@echo "Did you run 'make distcheck' already?"
	@if test -z "$(SKIP_GPG_SIG)"; then \
		echo "Creating GPG signature (set SKIP_GPG_SIG to bypass this step)"; \
		gpg --output $(DIST_ARCHIVES).sig --detach-sig $(DIST_ARCHIVES); \
	fi
	@echo "Setting permissions for savannah.gnu.org"
	chmod 664 $(DIST_ARCHIVES)
	if test -f $(DIST_ARCHIVES).sig; then \
		chmod 664 $(DIST_ARCHIVES).sig; \
	fi
	@echo "Uploading to savannah"
	scp -p $(DIST_ARCHIVES)* $(SAVANNAH_USERNAME)@dl.sv.nongnu.org:/releases/nmh
.PHONY: upload