2 # Makefile for top level of nmh distribution
12 abs_srcdir = @abs_srcdir@
15 # ========== USER CONFIGURATION SECTION ==========
17 # If `make' is executed in the directory containing this Makefile,
18 # any changes made in this section will override the values of
19 # these parameters in makefiles in any of the subdirectories.
22 exec_prefix = @exec_prefix@
24 # location of standard commands
27 # location of support binaries and scripts
30 # location of nmh configuration and formats files
33 # location of man pages
39 # location of incoming mail
40 mailspool = @mailspool@
42 # location of mail transport agent
43 sendmailpath = @sendmailpath@
46 default_editor = @editorpath@
49 default_pager = @pagerpath@
53 DEFS = @DEFS@ @OURDEFS@
58 # ========== YOU SHOULDN'T HAVE TO CHANGE ANYTHING BELOW HERE ==========
60 # flags passed to recursive makes in subdirectories
61 MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
62 CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
63 prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
64 etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
65 mailspool='$(mailspool)' sendmailpath='$(sendmailpath)' \
66 default_editor='$(default_editor)' default_pager='$(default_pager)'
69 INSTALL_PROGRAM = @INSTALL_PROGRAM@
70 INSTALL_DATA = @INSTALL_DATA@
74 # all files in this directory included in the distribution
75 DIST = ChangeLog COPYRIGHT DATE INSTALL MACHINES README VERSION \
76 ChangeLog install-sh mkinstalldirs Makefile.in aclocal.m4 \
77 acconfig.h config.h.in configure.in configure stamp-h.in \
78 config.sub config.guess
80 # subdirectories in distribution
81 SUBDIRS = h config sbr mts uip etc man docs
83 # ========== DEPENDENCIES FOR BUILDING AND INSTALLING ==========
86 all: config.h Makefile all-recursive
89 for subdir in $(SUBDIRS); do \
90 (cd $$subdir && $(MAKE) $(MAKEDEFS) all) || exit 1; \
94 for subdir in $(SUBDIRS); do \
95 (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
99 for subdir in $(SUBDIRS); do \
100 (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
103 # ========== DEPENDENCIES FOR CLEANUP ==========
105 mostlyclean: mostlyclean-recursive mostlyclean-local
106 clean: clean-recursive clean-local
107 distclean: distclean-recursive distclean-local
108 realclean: realclean-recursive realclean-local
109 superclean: superclean-recursive superclean-local
114 clean-local: mostlyclean-local
116 distclean-local: clean-local
117 rm -f Makefile config.h config.status config.log config.cache stamp-h distname
120 realclean-local: distclean-local
122 superclean-local: realclean-local
123 cd $(srcdir) && rm -f config.h.in stamp-h.in configure
125 mostlyclean-recursive clean-recursive distclean-recursive realclean-recursive superclean-recursive:
126 for subdir in $(SUBDIRS); do \
127 target=`echo $@ | sed 's/-recursive//'`; \
128 (cd $$subdir && $(MAKE) $(MAKEDEFS) $$target) || exit 1; \
131 # ========== DEPENDENCIES FOR MAINTENANCE ==========
134 for subdir in $(SUBDIRS); do \
135 ( cd $$subdir && $(MAKE) $(MAKEDEFS) lint ) || exit 1; \
138 # ========== DEPENDENCIES FOR MAINTENANCE ==========
140 Makefile: Makefile.in config.status
143 config.status: configure VERSION
144 ./config.status --recheck
146 configure: configure.in aclocal.m4
147 cd $(srcdir) && autoconf
150 stamp-h: config.h.in config.status
151 ./config.status config.h stamp
153 config.h.in: stamp-h.in
154 stamp-h.in: configure.in acconfig.h aclocal.m4
155 cd $(srcdir) && autoheader
158 # rebuild all autoconf files
160 cd $(srcdir) && autoheader
161 cd $(srcdir) && autoconf
162 cd $(srcdir) && date > stamp-h.in
164 # name of new nmh distribution tar file
165 tarfile = nmh-$(VERSION).tar.gz
167 # ftp directory location
170 # file containing name of new nmh distribution
172 @echo nmh-$(VERSION) > distname
174 # build nmh distribution
175 distdir = `cat distname`
176 nmhdist: $(DIST) distname
177 @echo "Begin building nmh-$(VERSION) distribution"
180 @chmod 755 $(distdir)
181 @echo "Copying distribution files in main directory"
182 @for file in $(DIST); do \
183 cp -p $(srcdir)/$$file $(distdir); \
185 @for subdir in $(SUBDIRS); do \
186 mkdir $(distdir)/$$subdir; \
187 chmod 755 $(distdir)/$$subdir; \
188 (cd $$subdir && $(MAKE) $@) || exit 1; \
190 chmod -R a+r $(distdir)
191 tar chf - $(distdir) | gzip -c > $(tarfile)
192 rm -rf $(distdir) distname
193 @echo "Done building nmh-$(VERSION) distribution"
195 # release a new nmh distribution into ftp directory
197 rm -f $(ftpdir)/$(tarfile)
198 rm -f $(ftpdir)/nmh.tar.gz
199 mv $(tarfile) $(ftpdir)/$(tarfile)
200 cd $(ftpdir) && ln -s $(tarfile) nmh.tar.gz
201 cd $(ftpdir) && md5sum *.gz > MD5SUM
203 # Create binary and source RPMs. Assumes that configure had already
204 # been run. Otherwise, there wouldn't be a Makefile.
205 # _topdir is the specified RPM build root.
206 # _tmppath is TMP below _topdir.
207 # srcdir is the top level nmh source directory.
208 # tarfile and version are as specified in this file. rpmbuild does
209 # not allow Version to contain any dashes.
211 @rpmbuild --define '_topdir $(rpmdir)' \
212 --define '_tmppath %{_topdir}/TMP' \
213 --define 'srcdir $(abs_srcdir)' \
214 --define 'tarfile $(tarfile)' \
215 --define 'version '`echo $(VERSION) | sed "s/-/_/g"` \