2 # Makefile for top level of mmh distribution
12 VERSION = `sed q $(srcdir)/VERSION`
14 # ========== USER CONFIGURATION SECTION ==========
16 # If `make' is executed in the directory containing this Makefile,
17 # any changes made in this section will override the values of
18 # these parameters in makefiles in any of the subdirectories.
21 exec_prefix = @exec_prefix@
23 # location of standard commands
26 # location of support binaries and scripts
29 # location of mmh configuration and formats files
33 datarootdir = @datarootdir@
35 # location of man pages
38 # location of incoming mail
39 mailspool = @mailspool@
41 # location of mail transport agent
42 sendmailpath = @sendmailpath@
46 DEFS = @DEFS@ @OURDEFS@
51 # ========== YOU SHOULDN'T HAVE TO CHANGE ANYTHING BELOW HERE ==========
53 # flags passed to recursive makes in subdirectories
54 MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \
55 CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
56 prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
57 etcdir='$(etcdir)' libdir='$(libdir)' mandir='$(mandir)' \
58 mailspool='$(mailspool)' sendmailpath='$(sendmailpath)'
61 INSTALL_PROGRAM = @INSTALL_PROGRAM@
62 INSTALL_DATA = @INSTALL_DATA@
66 # distribute all files that are under version control ...
67 # ... plus (for convenience):
68 DISTINCLUDE = config.h.in configure stamp-h.in sbr/dtimep.c ChangeLog
69 # ... minus (git stuff):
70 DISTEXCLUDE = .git .gitignore
72 # Subdirectories with own Makefiles
73 SUBDIRS = h config sbr uip etc man
75 # ========== DEPENDENCIES FOR BUILDING AND INSTALLING ==========
78 all: config.h Makefile all-recursive
81 for subdir in $(SUBDIRS); do \
82 (cd $$subdir && $(MAKE) $(MAKEDEFS) all) || exit 1; \
86 for subdir in $(SUBDIRS); do \
87 (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
91 for subdir in $(SUBDIRS); do \
92 (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
95 # ========== DEPENDENCIES FOR CLEANUP ==========
97 mostlyclean: mostlyclean-recursive mostlyclean-local
98 clean: clean-recursive clean-local
99 distclean: distclean-recursive distclean-local
100 realclean: realclean-recursive realclean-local
101 superclean: superclean-recursive superclean-local
105 rm -rf autom4te.cache
107 clean-local: mostlyclean-local
109 distclean-local: clean-local
110 rm -f Makefile config.h config.status config.log config.cache stamp-h distname ChangeLog
112 realclean-local: distclean-local
114 superclean-local: realclean-local
115 cd $(srcdir) && rm -f config.h.in stamp-h.in configure
117 mostlyclean-recursive clean-recursive distclean-recursive realclean-recursive superclean-recursive:
118 for subdir in $(SUBDIRS); do \
119 target=`echo $@ | sed 's/-recursive//'`; \
120 (cd $$subdir && $(MAKE) $(MAKEDEFS) $$target) || exit 1; \
123 # ========== DEPENDENCIES FOR MAINTENANCE ==========
126 for subdir in $(SUBDIRS); do \
127 ( cd $$subdir && $(MAKE) $(MAKEDEFS) lint ) || exit 1; \
130 # ========== DEPENDENCIES FOR MAINTENANCE ==========
132 Makefile: Makefile.in config.status
135 config.status: configure VERSION
136 ./config.status --recheck
138 configure: configure.ac
139 cd $(srcdir) && autoconf
142 stamp-h: config.h.in config.status
143 ./config.status config.h stamp
145 config.h.in: stamp-h.in
146 stamp-h.in: configure.ac
147 cd $(srcdir) && autoheader
150 # rebuild all autoconf files
152 cd $(srcdir) && autoheader
153 cd $(srcdir) && autoconf
154 cd $(srcdir) && date > stamp-h.in
156 # name of new mmh distribution tar file
157 tarfile = mmh-$(VERSION).tar.gz
159 # file containing name of new mmh distribution
161 @echo mmh-$(VERSION) > distname
163 # pre-generate this file so users don't need lex(1)
165 @cd $(srcdir)/sbr && $(MAKE) dtimep.c
168 @git whatchanged --format=fuller > $@
170 # build mmh distribution
171 distdir = `cat distname`
172 mmhdist: $(DISTINCLUDE) distname
173 @echo "Begin building mmh-$(VERSION) distribution"
175 @echo "Copying files to distribution directory"
176 @git clone $(srcdir) $(distdir)
177 @chmod 755 $(distdir)
178 @for file in $(DISTINCLUDE); do \
179 cp -p $(srcdir)/$$file $(distdir)/$$file; \
180 touch $(distdir)/$$file; \
182 @for file in $(DISTEXCLUDE); do \
183 rm -rf $(distdir)/$$file; \
185 @chmod -R a+r $(distdir)
186 tar chf - $(distdir) | gzip -c > $(tarfile)
187 @rm -rf $(distdir) distname
188 @echo "Done building mmh-$(VERSION) distribution"