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