Support for handling multibyte encodings in cpstripped(), which
[mmh] / Makefile.am
1 ##
2 ## Our Makefile.am template for Makefile.in (and, eventually, Makefile)
3 ##
4 ## Process this with automake to generate Makefile.in
5 ##
6
7 ## We set this to get our autoconf macros in the m4 directory
8 ACLOCAL_AMFLAGS = -I m4
9
10 ##
11 ## This is the default set of libraries all programs link against.  Some
12 ## programs add extra libraries to this set, so they override this with
13 ## a program-specific LDADD variable.  Note that in all of the cases today
14 ## LDADD is included in the program-specific LDADD since we want to add
15 ## to this list of libraries, not replace it.
16 ##
17 LDADD = sbr/libmh.a sbr/libdtimep.a
18
19 ##
20 ## These are used to create the default mhn.defaults config file
21 ## MHNSEARCHPATH is the default path to look for MIME content handlers
22 ## MHNSEARCHPROG is the script used to find the support programs
23 ##
24 MHNSEARCHPATH = "$(PATH):/usr/demo/SOUND"
25 MHNSEARCHPROG = $(srcdir)/etc/mhn.find.sh
26
27 ##
28 ## Automake doesn't let us install programs in $(libdir), so we create our
29 ## own directory prefix to use in the primary variable.
30 ##
31 auxexecdir = @libdir@
32
33 ##
34 ## nmh _does_ have a test suite!
35 ##
36 TESTS_ENVIRONMENT = MH_OBJ_DIR=@abs_builddir@ \
37                     MH_TEST_DIR=@abs_builddir@/test/testdir \
38                     auxexecdir=$(auxexecdir) bindir=$(bindir) \
39                     mandir=$(mandir) sysconfdir=$(sysconfdir) \
40                     MULTIBYTE_ENABLED=$(MULTIBYTE_ENABLED) \
41                     $(TESTS_SHELL) ## Keep at end of TESTS_ENVIRONMENT.
42 ##
43 ## Important note: the "cleanup" test should always be last
44 ##
45 TESTS = test/bad-input/test-header \
46         test/burst/test-burst \
47         test/comp/test-comp-format \
48         test/folder/test-create \
49         test/folder/test-total test/format/test-localmbox \
50         test/format/test-myname test/format/test-myhost \
51         test/format/test-mymbox \
52         test/forw/test-forw-digest \
53         test/forw/test-forw-format \
54         test/inc/test-deb359167 test/inc/test-eom-align \
55         test/inc/test-inc-scanout test/install-mh/test-install-mh \
56         test/manpages/test-manpages test/mhbuild/test-forw \
57         test/mhlist/test-mhlist test/mhparam/test-mhparam \
58         test/mhpath/test-mhpath \
59         test/mhshow/test-cte-binary test/mhshow/test-qp \
60         test/mhshow/test-subpart test/mhstore/test-mhstore \
61         test/new/test-basic \
62         test/pick/test-pick test/pick/test-stderr \
63         test/post/test-post-basic test/post/test-post-multiple \
64         test/post/test-post-dcc test/post/test-post-fcc \
65         test/post/test-post-multifrom test/post/test-post-envelope \
66         test/post/test-post-group \
67         test/refile/test-refile \
68         test/repl/test-if-str test/repl/test-trailing-newline \
69         test/repl/test-multicomp \
70         test/scan/test-scan test/scan/test-scan-multibyte \
71         test/sequences/test-flist test/sequences/test-mark \
72         test/whatnow/test-attach-detach test/whatnow/test-cd \
73         test/whatnow/test-ls test/whom/test-whom \
74         test/cleanup ## The "cleanup" test should always be last.
75
76 check_SCRIPTS = test/common.sh
77 check_PROGRAMS = test/getfullname test/getfqdn test/fakesmtp
78 DISTCHECK_CONFIGURE_FLAGS = DISABLE_SETGID_MAIL=1
79
80 ##
81 ## Stuff that should be cleaned via "make clean"
82 ##
83 CLEANFILES = config/version.c sbr/sigmsg.h etc/mts.conf etc/sendfiles \
84              etc/mhn.defaults man/man.sed man/mh-chart.man $(man_MANS)
85 clean-local:
86         @rm -rf RPM a.out.dSYM uip/a.out.dSYM
87         @rm -rf test/testdir
88
89 ##
90 ## Stuff that should be cleaned via "make maintainer-clean"
91 ##
92 MAINTAINERCLEANFILES = cscope.files cscope.out
93
94 ##
95 ## And our own superclean, to get everything left by maintainer-clean.
96 ##
97 SUPERCLEANFILES = ChangeLog Makefile.in aclocal.m4 compile config.guess \
98                   config.h.in config.h.in~ config.sub configure depcomp \
99                   install-sh missing ylwrap nmh-*.tar.gz
100 superclean: maintainer-clean
101         @rm -f $(SUPERCLEANFILES)
102 .PHONY: superclean
103
104 ##
105 ## Files that need to be built before everything else
106 ##
107 BUILT_SOURCES = sbr/sigmsg.h
108
109 ##
110 ## This is a list of all programs that get installed in the "bin" directory
111 ## Note that primary difference between "PROGRAMS" and "SCRIPTS" is that
112 ## the latter do not have $(EXEEXT) added on the end.
113 ##
114 bin_PROGRAMS = uip/ali uip/anno uip/burst uip/comp uip/dist uip/flist \
115                uip/folder uip/forw uip/inc uip/install-mh uip/mark \
116                uip/mhbuild uip/mhlist uip/mhmail uip/mhn uip/mhparam \
117                uip/mhpath uip/mhshow uip/mhstore uip/msgchk uip/msh uip/new \
118                uip/packf uip/pick uip/prompter uip/refile uip/repl uip/rmf \
119                uip/rmm uip/scan uip/send uip/show uip/sortm uip/whatnow \
120                uip/whom
121
122 bin_SCRIPTS = etc/sendfiles
123
124 ##
125 ## This is all programs that get installed in the "lib" directory
126 ##
127 auxexec_PROGRAMS = uip/ap uip/conflict uip/dp uip/fmtdump uip/mhl uip/post \
128                    uip/rcvdist uip/rcvpack uip/rcvstore uip/rcvtty uip/slocal \
129                    uip/spost uip/viamail uip/mhtest
130
131 ##
132 ## Internal libraries that we create as part of the build process
133 ## but do not install
134 ##
135 noinst_LIBRARIES = sbr/libmh.a sbr/libdtimep.a mts/libmts.a
136
137 ##
138 ## These are all of our header files.  Right now we don't install any of
139 ## them, but that might change in the future.
140 ##
141 noinst_HEADERS = h/addrsbr.h h/aliasbr.h h/crawl_folders.h h/dropsbr.h \
142                  h/fmt_compile.h h/fmt_scan.h h/md5.h h/mf.h \
143                  h/mh.h h/mhcachesbr.h h/mhparse.h h/mime.h h/msh.h \
144                  h/mts.h h/nmh.h h/picksbr.h h/popsbr.h h/prototypes.h \
145                  h/rcvmail.h h/scansbr.h h/signals.h h/tws.h h/utils.h \
146                  h/vmhsbr.h mts/smtp/smtp.h
147
148 ##
149 ## Extra files we need to install in various places
150 ##
151 dist_sysconf_DATA = etc/MailAliases etc/components etc/digestcomps \
152                     etc/distcomps etc/forwcomps etc/mhl.body etc/mhl.digest \
153                     etc/mhl.format etc/mhl.forward etc/mhl.headers \
154                     etc/mhl.reply etc/rcvdistcomps etc/rcvdistcomps.outbox \
155                     etc/replcomps etc/replgroupcomps etc/scan.MMDDYY \
156                     etc/scan.YYYYMMDD etc/scan.default etc/scan.mailx \
157                     etc/scan.nomime etc/scan.size etc/scan.time \
158                     etc/scan.timely etc/scan.unseen
159
160 ##
161 ## The same as above, but we don't include these in the distribution
162 ## (because they're generated at compile time)
163 ##
164 sysconf_DATA = etc/mhn.defaults etc/mts.conf
165
166 ##
167 ## Documentation that gets installed in docdir
168 ##
169 dist_doc_DATA = COPYRIGHT VERSION docs/COMPLETION-BASH docs/COMPLETION-TCSH \
170                 docs/COMPLETION-ZSH docs/DIFFERENCES docs/FAQ \
171                 docs/MAIL.FILTERING docs/MAILING-LISTS docs/README-ATTACHMENTS \
172                 docs/README-HOOKS docs/README-components docs/README.about \
173                 docs/README.SASL docs/README.developers docs/README.manpages \
174                 docs/TODO
175
176 ##
177 ## Contribs that get installed in docdir/contrib/
178 ##
179 contribdir = $(docdir)/contrib
180 dist_contrib_DATA = docs/contrib/replyfilter docs/contrib/build_nmh
181
182 ##
183 ## Our man pages
184 ##
185 man_MANS = man/ali.1 man/anno.1 man/ap.8 man/burst.1 man/comp.1 \
186            man/conflict.8 man/dist.1 man/dp.8 man/flist.1 man/flists.1 \
187            man/fmtdump.8 man/fnext.1 man/folder.1 man/folders.1 \
188            man/forw.1 man/fprev.1 man/inc.1 man/install-mh.1 man/mark.1 \
189            man/mh-alias.5 man/mh-chart.1 man/mh-draft.5 man/mh-format.5 \
190            man/mh-mail.5 man/mh-profile.5 man/mh_profile.5 man/mh-sequence.5 \
191            man/mh-tailor.5 man/mhbuild.1 man/mhl.1 man/mhlist.1 \
192            man/mhmail.1 man/mhn.1 man/mhparam.1 man/mhpath.1 \
193            man/mhshow.1 man/mhstore.1 man/msgchk.1 man/msh.1 \
194            man/mts.conf.5 man/new.1 man/next.1 man/nmh.1 man/packf.1 \
195            man/pick.1 man/post.8 man/prev.1 man/prompter.1 man/rcvdist.1 \
196            man/rcvpack.1 man/rcvstore.1 man/rcvtty.1 man/refile.1 \
197            man/repl.1 man/rmf.1 man/rmm.1 man/scan.1 man/send.1 \
198            man/sendfiles.1 man/show.1 man/slocal.1 man/sortm.1 man/unseen.1 \
199            man/whatnow.1 man/whom.1
200
201 ##
202 ## Files we need to include in the distribution which aren't found by
203 ## Automake using the automatic rules
204 ##
205 EXTRA_DIST = config/version.sh sbr/sigmsg.awk etc/mts.conf.in etc/sendfiles.in \
206              etc/mhn.defaults.sh $(MHNSEARCHPROG) DATE MACHINES \
207              docs/ChangeLog_MH-3_to_MH-6.6 \
208              docs/ChangeLog_MH-6.7.0_to_MH-6.8.4.html \
209              man/ali.man man/anno.man man/ap.man man/burst.man man/comp.man \
210              man/conflict.man man/dist.man man/dp.man man/flist.man \
211              man/flists.man man/fmtdump.man man/fnext.man man/folder.man \
212              man/folders.man man/forw.man man/fprev.man man/inc.man \
213              man/install-mh.man man/mark.man man/mh-alias.man \
214              man/mh-chart-gen.sh man/mh-draft.man man/mh-format.man \
215              man/mh-mail.man man/mh-profile.man man/mh_profile.man \
216              man/mh-sequence.man man/mh-tailor.man man/mhbuild.man man/mhl.man \
217              man/mhlist.man man/mhmail.man man/mhn.man man/mhparam.man \
218              man/mhpath.man man/mhshow.man man/mhstore.man man/msgchk.man \
219              man/msh.man man/mts.conf.man man/new.man man/next.man man/nmh.man \
220              man/packf.man man/pick.man man/post.man man/prev.man \
221              man/prompter.man man/rcvdist.man man/rcvpack.man \
222              man/rcvstore.man man/rcvtty.man man/refile.man man/repl.man \
223              man/rmf.man man/rmm.man man/scan.man man/send.man \
224              man/sendfiles.man man/show.man man/slocal.man man/sortm.man \
225              man/unseen.man man/whatnow.man man/whom.man \
226              test/README $(TESTS) test/inc/deb359167.mbox \
227              test/inc/fromline.txt test/inc/msgheader.txt test/inc/filler.txt \
228              test/inc/md5sums test/post/test-post-common.sh \
229              SPECS/nmh.spec SPECS/build-nmh-cygwin
230
231 ##
232 ## These are all of the definitions for each of the programs listed above.
233 ## They describe the source files that make up the programs and any particular
234 ## overrides that are used to select different library options from the
235 ## default.
236 ##
237 uip_ali_SOURCES = uip/ali.c uip/aliasbr.c
238
239 uip_anno_SOURCES = uip/anno.c uip/annosbr.c
240
241 uip_burst_SOURCES = uip/burst.c
242
243 uip_comp_SOURCES = uip/comp.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
244                    uip/annosbr.c uip/distsbr.c
245 uip_comp_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
246
247 uip_dist_SOURCES = uip/dist.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
248                    uip/annosbr.c uip/distsbr.c uip/forwsbr.c
249 uip_dist_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
250
251 uip_flist_SOURCES = uip/flist.c
252
253 uip_folder_SOURCES = uip/folder.c
254
255 uip_forw_SOURCES = uip/forw.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
256                    uip/annosbr.c uip/distsbr.c uip/forwsbr.c
257 uip_forw_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
258
259 uip_inc_SOURCES = uip/inc.c uip/scansbr.c uip/dropsbr.c uip/termsbr.c \
260                   uip/popsbr.c
261 uip_inc_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(SASLLIB)
262
263 uip_install_mh_SOURCES = uip/install-mh.c
264
265 uip_mark_SOURCES = uip/mark.c
266
267 uip_mhbuild_SOURCES = uip/mhbuild.c uip/mhbuildsbr.c uip/mhcachesbr.c \
268                       uip/mhlistsbr.c uip/mhoutsbr.c uip/mhmisc.c  \
269                       uip/mhfree.c uip/mhparse.c uip/termsbr.c uip/md5.c
270 uip_mhbuild_LDADD = $(LDADD) $(TERMLIB)
271
272 uip_mhlist_SOURCES = uip/mhlist.c uip/mhparse.c uip/mhcachesbr.c \
273                      uip/mhlistsbr.c uip/mhmisc.c uip/mhfree.c uip/termsbr.c \
274                      uip/md5.c
275 uip_mhlist_LDADD = $(LDADD) $(TERMLIB)
276
277 uip_mhmail_SOURCES = uip/mhmail.c
278
279 uip_mhn_SOURCES = uip/mhn.c uip/mhparse.c uip/mhcachesbr.c uip/mhshowsbr.c \
280                   uip/mhlistsbr.c uip/mhstoresbr.c uip/mhmisc.c uip/mhfree.c \
281                   uip/termsbr.c uip/md5.c
282 uip_mhn_LDADD = $(LDADD) $(TERMLIB)
283
284 uip_mhparam_SOURCES = uip/mhparam.c
285
286 uip_mhpath_SOURCES = uip/mhpath.c
287
288 uip_mhshow_SOURCES = uip/mhshow.c uip/mhparse.c uip/mhcachesbr.c \
289                      uip/mhshowsbr.c uip/mhlistsbr.c uip/mhmisc.c \
290                      uip/mhfree.c uip/termsbr.c uip/md5.c
291 uip_mhshow_LDADD = $(LDADD) $(TERMLIB)
292
293 uip_mhstore_SOURCES = uip/mhstore.c uip/mhparse.c uip/mhcachesbr.c \
294                       uip/mhshowsbr.c uip/mhlistsbr.c uip/mhstoresbr.c \
295                       uip/mhmisc.c uip/mhfree.c uip/termsbr.c uip/md5.c
296 uip_mhstore_LDADD = $(LDADD) $(TERMLIB)
297
298 uip_msgchk_SOURCES = uip/msgchk.c uip/popsbr.c
299 uip_msgchk_LDADD = $(LDADD) $(SASLLIB)
300
301 uip_msh_SOURCES = uip/msh.c uip/mshcmds.c uip/vmhsbr.c uip/picksbr.c \
302                   uip/scansbr.c uip/dropsbr.c uip/mhlsbr.c uip/termsbr.c
303 uip_msh_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
304
305 uip_new_SOURCES = uip/new.c
306
307 uip_packf_SOURCES = uip/packf.c uip/dropsbr.c
308
309 uip_pick_SOURCES = uip/pick.c uip/picksbr.c
310
311 uip_prompter_SOURCES = uip/prompter.c
312
313 uip_refile_SOURCES = uip/refile.c
314
315 uip_repl_SOURCES = uip/repl.c uip/replsbr.c uip/whatnowproc.c \
316                    uip/whatnowsbr.c uip/sendsbr.c uip/annosbr.c uip/distsbr.c
317 uip_repl_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
318
319 uip_rmf_SOURCES = uip/rmf.c
320
321 uip_rmm_SOURCES = uip/rmm.c
322
323 uip_scan_SOURCES = uip/scan.c uip/scansbr.c uip/termsbr.c
324 uip_scan_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
325
326 uip_send_SOURCES = uip/send.c uip/sendsbr.c uip/annosbr.c uip/distsbr.c
327
328 uip_show_SOURCES = uip/show.c uip/mhlsbr.c uip/termsbr.c
329 uip_show_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
330
331 uip_sortm_SOURCES = uip/sortm.c
332
333 uip_whatnow_SOURCES = uip/whatnow.c uip/whatnowsbr.c uip/sendsbr.c \
334                       uip/annosbr.c uip/distsbr.c
335 uip_whatnow_LDADD = $(LDADD) $(READLINELIB)
336
337 uip_whom_SOURCES = uip/whom.c uip/distsbr.c
338
339 ##
340 ## Programs definitions for all utilities that end up in $(libdir)
341 ##
342
343 uip_ap_SOURCES = uip/ap.c uip/termsbr.c
344 uip_ap_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
345
346 uip_conflict_SOURCES = uip/conflict.c uip/aliasbr.c
347
348 uip_dp_SOURCES = uip/dp.c uip/termsbr.c
349 uip_dp_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
350
351 uip_fmtdump_SOURCES = uip/fmtdump.c
352 uip_fmtdump_LDADD = $(LDADD) $(ICONVLIB)
353
354 uip_mhl_SOURCES = uip/mhl.c uip/mhlsbr.c uip/termsbr.c
355 uip_mhl_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
356
357 uip_mhtest_SOURCES = uip/mhtest.c uip/mhparse.c uip/mhcachesbr.c \
358                      uip/mhoutsbr.c uip/mhmisc.c uip/mhfree.c \
359                      uip/termsbr.c uip/md5.c
360 uip_mhtest_LDADD = $(LDADD) $(TERMLIB)
361
362 uip_post_SOURCES = uip/post.c uip/aliasbr.c
363 uip_post_LDADD = mts/libmts.a $(LDADD) $(SASLLIB)
364
365 uip_rcvdist_SOURCES = uip/rcvdist.c uip/distsbr.c
366 uip_rcvdist_LDADD = $(LDADD) $(ICONVLIB)
367
368 uip_rcvpack_SOURCES = uip/rcvpack.c uip/dropsbr.c
369
370 uip_rcvstore_SOURCES = uip/rcvstore.c
371
372 uip_rcvtty_SOURCES = uip/rcvtty.c uip/scansbr.c uip/termsbr.c
373 uip_rcvtty_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
374
375 uip_slocal_SOURCES = uip/slocal.c uip/aliasbr.c uip/dropsbr.c
376 uip_slocal_LDADD = $(LDADD) $(NDBM_LIBS)
377
378 uip_spost_SOURCES = uip/spost.c uip/aliasbr.c
379
380 uip_viamail_SOURCES = uip/viamail.c uip/mhmisc.c uip/mhoutsbr.c uip/sendsbr.c \
381                       uip/annosbr.c uip/distsbr.c
382
383 test_getfullname_SOURCES = test/getfullname.c
384 test_getfullname_LDADD = sbr/libmh.a
385
386 test_getfqdn_SOURCES = test/getfqdn.c
387 test_getfqdn_LDADD =
388
389 test_fakesmtp_SOURCES = test/fakesmtp.c
390 test_fakesmtp_LDADD =
391
392 ##
393 ## Our rebuild rules for files that aren't built via the normal mechanisms
394 ##
395 config/version.c: Makefile
396         sh $(srcdir)/config/version.sh $(VERSION) > $@
397
398 sbr/sigmsg.h: $(srcdir)/sbr/sigmsg.awk $(SIGNAL_H)
399         $(AWK) -f $(srcdir)/sbr/sigmsg.awk $(SIGNAL_H) > $@
400
401 etc/mts.conf: $(srcdir)/etc/mts.conf.in Makefile
402         rm -f $@
403         $(SED) -e 's,%mts%,$(MTS),' \
404                -e 's,%mailspool%,$(mailspool),' \
405                -e 's,%smtpservers%,$(smtpservers),' \
406                                 < $(srcdir)/etc/mts.conf.in > $@
407
408 etc/mhn.defaults: $(srcdir)/etc/mhn.defaults.sh $(MHNSEARCHPROG)
409         rm -f $@
410         $(srcdir)/etc/mhn.defaults.sh $(MHNSEARCHPATH) $(MHNSEARCHPROG) > $@
411
412 etc/sendfiles: $(srcdir)/etc/sendfiles.in Makefile
413         rm -f $@
414         $(SED) -e 's,%libdir%,$(libdir),' < $(srcdir)/etc/sendfiles.in > $@
415
416 ##
417 ## This rule gets called at "make install" time; we use it to create links
418 ## between different programs.
419 ## On Cygwin, the choice of ln or ln -s must be made at install time,
420 ## not configure time, because some filesystems (NTFS) support hard
421 ## links but others (FAT32) don't.  The fallback to cp -p might not be
422 ## needed, but it's here just in case.
423 ##
424 install-exec-hook:
425         rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
426         rm -f $(DESTDIR)$(bindir)/folders$(EXEEXT)
427         rm -f $(DESTDIR)$(bindir)/fnext$(EXEEXT)
428         rm -f $(DESTDIR)$(bindir)/fprev$(EXEEXT)
429         rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
430         rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
431         rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
432         cd $(DESTDIR)$(bindir) && \
433           if ln flist$(EXEEXT) flists$(EXEEXT) 2>/dev/null && \
434             ln folder$(EXEEXT) folders$(EXEEXT) && \
435             ln new$(EXEEXT) fnext$(EXEEXT) && \
436             ln new$(EXEEXT) fprev$(EXEEXT) && \
437             ln new$(EXEEXT) unseen$(EXEEXT) && \
438             ln show$(EXEEXT) prev$(EXEEXT) && \
439             ln show$(EXEEXT) next$(EXEEXT); then :; \
440           elif ln -s flist$(EXEEXT) flists$(EXEEXT) 2>/dev/null && \
441             ln -s folder$(EXEEXT) folders$(EXEEXT) && \
442             ln -s new$(EXEEXT) fnext$(EXEEXT) && \
443             ln -s new$(EXEEXT) fprev$(EXEEXT) && \
444             ln -s new$(EXEEXT) unseen$(EXEEXT) && \
445             ln -s show$(EXEEXT) prev$(EXEEXT) && \
446             ln -s show$(EXEEXT) next$(EXEEXT); then :; \
447           else cp -p flist$(EXEEXT) flists$(EXEEXT) && \
448             cp -p folder$(EXEEXT) folders$(EXEEXT) && \
449             cp -p new$(EXEEXT) fnext$(EXEEXT) && \
450             cp -p new$(EXEEXT) fprev$(EXEEXT) && \
451             cp -p new$(EXEEXT) unseen$(EXEEXT) && \
452             cp -p show$(EXEEXT) prev$(EXEEXT) && \
453             cp -p show$(EXEEXT) next$(EXEEXT); \
454           fi
455         if test x$(SETGID_MAIL) != x; then \
456                 chgrp $(MAIL_SPOOL_GRP) $(DESTDIR)$(bindir)/inc$(EXEEXT) && \
457                 chmod 2755 $(DESTDIR)$(bindir)/inc$(EXEEXT); \
458         fi
459
460 ##
461 ## Make sure we remove those links at uninstall time
462 ##
463 uninstall-hook:
464         rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
465         rm -f $(DESTDIR)$(bindir)/folders$(EXEEXT)
466         rm -f $(DESTDIR)$(bindir)/fnext$(EXEEXT)
467         rm -f $(DESTDIR)$(bindir)/fprev$(EXEEXT)
468         rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
469         rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
470         rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
471
472 ##
473 ## Our rules to build our internal libraries (libmh.a, libmts.a)
474 ##
475 sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/brkstring.c \
476                       sbr/check_charset.c sbr/client.c sbr/closefds.c \
477                       sbr/concat.c sbr/context_del.c sbr/context_find.c \
478                       sbr/context_foil.c sbr/context_read.c \
479                       sbr/context_replace.c sbr/context_save.c \
480                       sbr/copy.c sbr/copyip.c sbr/cpydata.c \
481                       sbr/cpydgst.c sbr/crawl_folders.c sbr/discard.c \
482                       sbr/done.c sbr/dtime.c sbr/escape_addresses.c \
483                       sbr/error.c  sbr/ext_hook.c sbr/fdcompare.c \
484                       sbr/folder_addmsg.c sbr/folder_delmsgs.c \
485                       sbr/folder_free.c sbr/folder_pack.c \
486                       sbr/folder_read.c sbr/folder_realloc.c sbr/gans.c \
487                       sbr/getans.c sbr/getanswer.c sbr/getarguments.c \
488                       sbr/getcpy.c sbr/getfolder.c sbr/getpass.c \
489                       sbr/fmt_addr.c sbr/fmt_compile.c sbr/fmt_new.c \
490                       sbr/fmt_rfc2047.c sbr/fmt_scan.c sbr/lock_file.c \
491                       sbr/m_atoi.c sbr/m_backup.c sbr/m_convert.c \
492                       sbr/m_draft.c sbr/m_getfld.c sbr/m_gmprot.c \
493                       sbr/m_maildir.c sbr/m_name.c \
494                       sbr/makedir.c sbr/mts.c sbr/norm_charmap.c sbr/path.c \
495                       sbr/peekc.c sbr/pidwait.c sbr/pidstatus.c \
496                       sbr/print_help.c sbr/print_sw.c sbr/print_version.c \
497                       sbr/push.c sbr/putenv.c sbr/refile.c sbr/remdir.c \
498                       sbr/r1bindex.c sbr/readconfig.c sbr/ruserpass.c \
499                       sbr/seq_add.c sbr/seq_bits.c sbr/seq_del.c \
500                       sbr/seq_getnum.c sbr/seq_list.c sbr/seq_nameok.c \
501                       sbr/seq_print.c sbr/seq_read.c sbr/seq_save.c \
502                       sbr/seq_setcur.c sbr/seq_setprev.c sbr/seq_setunseen.c \
503                       sbr/showfile.c sbr/signals.c sbr/smatch.c \
504                       sbr/snprintb.c sbr/ssequal.c sbr/strcasecmp.c \
505                       sbr/strindex.c sbr/trimcpy.c sbr/uprf.c sbr/vfgets.c \
506                       sbr/fmt_def.c sbr/m_msgdef.c sbr/mf.c sbr/utils.c \
507                       sbr/m_mktemp.c sbr/getansreadline.c config/config.c \
508                       config/version.c
509
510 sbr_libmh_a_CPPFLAGS = -I./sbr -DNMHETCDIR='"$(sysconfdir)"' \
511                 -DMAILSPOOL='"$(mailspool)"' \
512                 -DSENDMAILPATH='"$(sendmailpath)"' -DNMHBINDIR='"$(bindir)"' \
513                 -DNMHLIBDIR='"$(libdir)"' \
514                 -DDEFAULT_EDITOR='"$(editorpath)"' \
515                 -DDEFAULT_PAGER='"$(pagerpath)"'
516
517 sbr_libdtimep_a_SOURCES = sbr/dtimep.l
518 sbr_libdtimep_a_CFLAGS = $(sbr_libmh_a_CPPFLAGS) \
519                          $(DISABLE_UNUSED_MACROS_WARNING) \
520                          $(DISABLE_SIGN_COMPARE_WARNING)
521
522 mts_libmts_a_SOURCES = mts/smtp/smtp.c
523
524 ##
525 ## Our rules for generating man pages (both the rule for man.sed and
526 ## the implicit rules for man page generation).
527 ##
528 manext1 = 1
529 manext5 = 5
530 manext8 = 8
531
532 $(man_MANS): man/man.sed
533
534 man/man.sed: Makefile
535         @echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
536         @echo 's,%nmhversion%,nmh-$(VERSION),g' >> $@
537         @echo 's,%nmhdate%,$(DATE),g' >> $@
538         @echo 's,%bindir%,$(bindir),g' >> $@
539         @echo 's,%etcdir%,$(sysconfdir),g' >> $@
540         @echo 's,%libdir%,$(libdir),g' >> $@
541         @echo 's,%mandir%,$(mandir),g' >> $@
542         @echo 's,%mailspool%,$(mailspool),g' >> $@
543         @echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
544         @echo 's,%default_editor%,$(editorpath),g' >> $@
545         @echo 's,%default_pager%,$(pagerpath),g' >> $@
546         @echo 's,%manext1%,$(manext1),g' >> $@
547         @echo 's,%manext5%,$(manext5),g' >> $@
548         @echo 's,%manext8%,$(manext8),g' >> $@
549         @echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
550         @echo ' s,%mhl_forward%,,g' >> $@
551         @echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
552         @echo ' s,%mhl_format%,,g' >> $@
553         @echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
554         @echo ' s,%mhl_reply%,,g' >> $@
555
556 man/mh-chart.man:
557         @$(srcdir)/man/mh-chart-gen.sh > $@
558
559 .man.$(manext1):
560         @$(SED) -f man/man.sed $< > $@
561
562 .man.$(manext5):
563         @$(SED) -f man/man.sed $< > $@
564
565 .man.$(manext8):
566         @$(SED) -f man/man.sed $< > $@
567
568 ## Don't include commit hashes in ChangeLog.
569 ChangeLog:
570         @[ -d .git ]  &&  git --no-pager log --abbrev-commit | \
571            egrep -v '^commit [0-9a-f]+$$' > $@  ||  true
572 ## Make ChangeLog phony so it will always get regenerated.  But don't
573 ## fail if we don't have a git repository in order to allow
574 ## regeneration of distribution archive or RPM.
575 .PHONY: ChangeLog
576
577 ##
578 ## Our RPM build target
579 ##
580 rpm: dist
581         @test -d $(rpmdir)/SOURCES || $(MKDIR_P) $(rpmdir)/SOURCES
582         @mv -f $(DIST_ARCHIVES) $(rpmdir)/SOURCES
583         @cp -p VERSION $(rpmdir)/SOURCES
584         @rpmbuild --define '_topdir $(rpmdir)' \
585           --define '_tmppath %{_topdir}/TMP' \
586           --define "_sysconfdir $(DESTDIR)$(sysconfdir)" \
587           -ba SPECS/nmh.spec
588 .PHONY: rpm
589
590 ##
591 ## A target to build information needed by cscope
592 ##
593 cscope:
594         echo "-I $(srcdir)/h -I $(srcdir)/sbr -I $(srcdir)/uip -I $(srcdir)/mts/smtp" > cscope.files
595         find $(srcdir) \( -name docs -prune \) -o \( -name \*.c -o -name \*.l \) -print | grep -v dtimep.c >> cscope.files
596 .PHONY: cscope
597
598
599 ##
600 ## Use GNU gcov to find the coverage of the test suite.
601 ## These targets are not integrated into the other automake
602 ## targets because they will be used so infrequently, if at all.
603 ##
604 gcov:
605         @if ./config.status --config | grep -e --enable-debug >/dev/null; then \
606            echo For best results with gcov, configure without --enable-debug; \
607          fi
608         @echo rebuilding with AM_CFLAGS=--coverage . . .
609         @(make clean  &&  make AM_CFLAGS=--coverage) > /dev/null  && \
610           make check AM_CFLAGS=--coverage
611         @for i in `find . -name '*.gcda'`; do \
612            gcov -p -o `echo $$i | $(SED) 's%\\(.*\\)/%\\1 %'`; \
613          done
614         @for i in `find . -name '*.gcno'`; do \
615            if test -f `echo $$i | sed 's%\.gcno%.gcda%'`; then :; else \
616              echo untested: $$i; \
617            fi; \
618          done
619 gcov-mostlyclean:
620         @find . -name '*.gcno' -o -name '*.gcda' | xargs rm
621 gcov-clean: gcov-mostlyclean
622         @find . -name '*.gcov' | xargs rm
623 .PHONY: gcov gcov-mostlyclean gcov-clean
624
625
626 ##
627 ## Rules to upload the distribution to savannah
628 ##
629 upload: dist
630         @if test -z "$(SAVANNAH_USERNAME)"; then \
631                 echo "You need to set SAVANNAH_USERNAME to the your username on savannah.gnu.org." ;\
632                 echo "You can set it either in your environment or on the make command line."; \
633                 false; \
634         fi
635         @echo "Did you run 'make distcheck' already?"
636         @if test -z "$(SKIP_GPG_SIG)"; then \
637                 echo "Creating GPG signature (set SKIP_GPG_SIG to bypass this step)"; \
638                 gpg --output $(DIST_ARCHIVES).sig --detatch-sig $(DIST_ARCHIVES); \
639         fi
640         @echo "Setting permissions for savannah.gnu.org"
641         chmod 664 $(DIST_ARCHIVES)
642         if test -f $(DIST_ARCHIVES).sig; then \
643                 chmod 664 $(DIST_ARCHIVES).sig; \
644         fi
645         @echo "Uploading to savannah"
646         scp -p $(DIST_ARCHIVES)* $(SAVANNAH_USERNAME)@dl.sv.nongnu.org:/releases/nmh
647 .PHONY: upload