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