document branches better
[mharc.git] / Makefile
CommitLineData
2ea8f66b
IK
1##--------------------------------------------------------------------------##
2## File:
3## $Id: Makefile,v 1.35 2002/10/01 22:49:46 ehood Exp $
4## Description:
5## Administrative makefile for mailing list archives.
6##--------------------------------------------------------------------------##
7## Copyright (C) 2001-2002 Earl Hood <earl@earlhood.com>
8##
9## This program is free software; you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published by
11## the Free Software Foundation; either version 2 of the License, or
12## (at your option) any later version.
13##
14## This program is distributed in the hope that it will be useful,
15## but WITHOUT ANY WARRANTY; without even the implied warranty of
16## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17## GNU General Public License for more details.
18##
19## You should have received a copy of the GNU General Public License
20## along with this program; if not, write to the Free Software
21## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22## 02111-1307, USA
23##--------------------------------------------------------------------------##
24
25.PHONY: default editidx rebuild rootidx dist enable disable readmail \
26 help editidxonly release clean distclean configure mhonarc-check \
27 doc doc_pod doc_file doc_install
28
29INSTALL_PL = ./install.pl
30APPLY_CONFIG = ./bin/apply-config
31COMPRESS_FILES = ./bin/compress-files
32COMPRESS_MBOXES = ./bin/compress-mboxes
33CONFIG_CHECK = ./bin/config-check
34FILTER_SPOOL = ./bin/filter-spool
35LOG_CMD = ./bin/logcmd
36MBOX_MONTH_PACK = ./bin/mbox-month-pack
37MHA_CHECK = ./bin/mhonarc-check
38MH_MONTH_PACK = ./bin/mh-month-pack
39MK_PROCMAILRC = ./bin/mk-procmailrc
40READ_MAIL = ./bin/read-mail
41WEB_ARCHIVE = ./bin/web-archive
42
43PRGS = \
44 $(INSTALL_PL) \
45 $(LOG_CMD) \
46 $(MH_MONTH_PACK) \
47 $(MBOX_MONTH_PACK) \
48 $(FILTER_SPOOL) \
49 $(APPLY_CONFIG) \
50 $(COMPRESS_FILES) \
51 $(COMPRESS_MBOXES) \
52 $(CONFIG_CHECK) \
53 $(MHA_CHECK) \
54 $(MK_PROCMAILRC) \
55 $(READ_MAIL) \
56 $(WEB_ARCHIVE) \
57 # End PRGS
58
59CONFIG_SH = ./lib/config.sh
60LIST_DEF = ./lib/lists.def
61
62NO_ARCHIVE = .noarchive
63PROCMAIL_RC = procmailrc.mharc
64
65CHMOD = chmod
66CP = cp
67FIND = find
68GZIP = gzip
69MKDIR = mkdir
70MV = mv
71PERL = perl
72RM = rm
73TAR = tar
74TOUCH = touch
75
76##--------------------------------------------------------------------------##
77
78default: procmailrc
79
80procmailrc: mhonarc-check
81 $(MK_PROCMAILRC)
82
83editidx: disable
84 -$(PERL) $(WEB_ARCHIVE) -verbose -editidx -nosearch $(MLISTS)
85 -@echo "============================================================="
86 -@echo "!!! Auto-archive processing is DISABLED !!!"
87 -@echo "============================================================="
88
89editidxonly: disable
90 -$(PERL) $(WEB_ARCHIVE) -verbose -editidxonly -nosearch $(MLISTS)
91 -@echo "============================================================="
92 -@echo "!!! Auto-archive processing is DISABLED !!!"
93 -@echo "============================================================="
94
95editrootidx: disable
96 -$(PERL) $(WEB_ARCHIVE) -verbose -editrootidx -nosearch $(MLISTS)
97 -@echo "============================================================="
98 -@echo "!!! Auto-archive processing is DISABLED !!!"
99 -@echo "============================================================="
100
101rebuild: disable
102 -$(PERL) $(WEB_ARCHIVE) -verbose -rebuild $(MLISTS)
103 -@echo "============================================================="
104 -@echo "!!! Auto-archive processing is DISABLED !!!"
105 -@echo "============================================================="
106
107rootidx: _FORCE
108 -$(PERL) $(WEB_ARCHIVE) -verbose -editrootidx $(MLISTS)
109
110enable: _FORCE
111 @$(RM) -f $(NO_ARCHIVE)
112 -@echo "============================================================="
113 -@echo "!!! Auto-archive processing is ENABLED !!!"
114 -@echo "============================================================="
115
116disable: _FORCE
117 @$(TOUCH) $(NO_ARCHIVE)
118 -@echo "============================================================="
119 -@echo "!!! Auto-archive processing is DISABLED !!!"
120 -@echo "============================================================="
121
122readmail: _FORCE
123 $(READ_MAIL) -verbose -force
124
125configure: _FORCE
126 -@$(MKDIR) -p log mbox html
127 @if [ ! -f $(CONFIG_SH) ]; then \
128 $(CP) $(CONFIG_SH).dist $(CONFIG_SH); \
129 $(CHMOD) u+w $(CONFIG_SH); \
130 fi
131 @if [ ! -f $(LIST_DEF) ]; then \
132 $(CP) $(LIST_DEF).dist $(LIST_DEF); \
133 $(CHMOD) u+w $(LIST_DEF); \
134 fi
135 $(APPLY_CONFIG) -verbose
136 -$(MHA_CHECK)
137 -@echo "============================================================="
138 -@echo "* Make sure to rerun 'make configure' when you change"
139 -@echo "* lib/config.sh or change a .in template file."
140 -@echo "============================================================="
141
142mhonarc-check: _FORCE
143 @$(MHA_CHECK)
144
145help: _FORCE
146 -@echo "Targets available:"
147 -@echo " (default) Generate $(PROCMAIL_RC) from $(LIST_DEF)."
148 -@echo " configure: Apply $(CONFIG_SH) settings."
149 -@echo " disable: Disable automated processing of new messages."
150 -@echo " editidx: Edit all mhonarc archive pages."
151 -@echo " editidxonly: Edit only mhonarc archive index pages."
152 -@echo " editrootidx: Edit only top period index pages."
153 -@echo " enable: Enable automated processing of new messages."
154 -@echo " help: This message."
155 -@echo " readmail: Process mail spool."
156 -@echo " rebuild: Rebuild archives from raw message data."
157 -@echo " rootidx: Regenerated top index for archives."
158 -@echo ""
159 -@echo "NOTE: Targets that modify archives run with debugging enabled."
160 -@echo "NOTE: 'editidx', 'editidxonly', and 'rebuild' automatically"
161 -@echo " disable auto-processing. Execute 'enable' target to"
162 -@echo " reenable."
163 -@echo "CAUTION: The 'clean' target should not have to be invoked."
164 -@echo " But if done, it removes all .in generated files. The"
165 -@echo " 'configure' target can be executed to regenerate"
166 -@echo " file from templates"
167 -@echo "WARNING: The 'dist' and 'distclean' targets should only be"
168 -@echo " invoked IF YOU KNOW WHAT YOU ARE DOING!"
169
170
171# Dummy target to force building of other targets
172_FORCE:
173
174##--------------------------------------------------------------------------##
175## The following targets are mainly intended by mharc developers
176## and used for creating releases
177##--------------------------------------------------------------------------##
178
179DIST_BUNDLE = mharc-$(_RELEASE_VERSION).tar
180
181# List of files/dirs to be included in distribtion bundle
182# NOTE: The leading '.' is important.
183DIST_FILES = \
184 ./README \
185 ./INSTALL \
186 ./NEWS \
187 ./COPYING \
188 ./TODO \
189 ./install.pl \
190 ./doc \
191 ./bin \
192 ./cgi-bin \
193 ./etc \
194 ./html/.PNM* \
195 ./html/stylesheet.css* \
196 ./lib \
197 ./Makefile \
198 # End DIST_FILES
199
200# List of files/dirs to explicitly exclude from distribtion bundle
201# NOTE: The leading '.' is important.
202DIST_EXC_FILES = \
203 ./etc/release-mharc \
204 # End DIST_EXC_FILES
205
206TAR_EXC_FILE = dist/.dist-exclude
207
208PERL_PRGS = $(PRGS)
209
210release: syntax_check dist
211
212dist: _FORCE
213 @$(RM) -rf dist
214 @$(MKDIR) -p dist/mharc
215 @$(FIND) . -name 'CVS' -print > $(TAR_EXC_FILE)
216 @$(FIND) . -name '.*.sw*' -print >> $(TAR_EXC_FILE)
217 @for i in $(DIST_EXC_FILES); do \
218 echo $$i >> $(TAR_EXC_FILE); \
219 done
220 @$(TOUCH) INSTALL
221 @$(TAR) -c \
222 -X $(TAR_EXC_FILE) \
223 -f - $(DIST_FILES) | (cd dist/mharc; tar xfp -)
224 @(cd dist/mharc && $(MAKE) distclean)
225 @(cd dist/mharc && $(MAKE) doc)
226 @(cd dist/mharc && $(MAKE) doc_pod)
227 @(cd dist/mharc && echo "$(_RELEASE_VERSION)" > VERSION)
228 @$(MV) dist/mharc dist/mharc-$(_RELEASE_VERSION)
229 @(cd dist && $(TAR) cvf $(DIST_BUNDLE) mharc-$(_RELEASE_VERSION))
230 @(cd dist && $(GZIP) $(DIST_BUNDLE))
231
232syntax_check: _FORCE
233 @for i in $(PERL_PRGS); do \
234 echo "Checking $$i syntax..."; \
235 $(PERL) -cw $$i; \
236 done
237
238# doc_pod listed twice to resolve xrefs
239doc: doc_pod doc_file doc_install
240
241doc_pod: _FORCE
242 -@mkdir -p ./doc/bin ./doc/lib ./doc/file
243 @for i in $(PRGS); do \
244 echo "processing $$i..." ; \
245 pod2html --header --infile=$$i \
246 --htmlroot=.. \
247 --podroot=./doc \
248 --podpath='bin:lib' \
249 --outfile=./doc/bin/`basename $$i`.html ; \
250 done
251 @for i in `find ./lib/MHArc -name '*.pm' -print`; do \
252 echo "processing $$i..." ; \
253 pod2html --header \
254 --infile=$$i \
255 --htmlroot=.. \
256 --podroot=./doc \
257 --podpath='bin:lib' \
258 --outfile=./doc/lib/MHArc::`basename $$i`.html ; \
259 done
260 @$(RM) -f pod2htm*.x~~
261
262doc_file: _FORCE
263 $(CP) -f Makefile ./doc/file/Makefile.txt
264 $(CP) -f ./lib/common.mrc.in.dist ./doc/file/common.mrc.txt
265 $(CP) -f ./lib/config.sh.dist ./doc/file/config.sh.txt
266 $(CP) -f ./lib/lists.def.dist ./doc/file/lists.def.txt
267 $(CP) -f ./etc/apache.conf.in.dist ./doc/file/apache.conf.txt
268 $(CP) -f ./etc/crontab.in.dist ./doc/file/crontab.txt
269 $(CP) -f ./etc/.htaccess.in.dist ./doc/file/htaccess.txt
270
271doc_install:
272 w3m -dump -cols 76 ./doc/install.html > INSTALL
273
274distclean: clean
275 $(APPLY_CONFIG) -distclean -verbose
276 $(RM) -f $(CONFIG_SH) $(CONFIG_SH).cache.pl $(LIST_DEF) VERSION INSTALL
277 $(RM) -rf ./dist ./doc/bin ./doc/lib ./doc/file
278
279clean: _FORCE
280 $(RM) -f $(PROCMAIL_RC)
281 $(APPLY_CONFIG) -clean -verbose
282