1 ## $Id: Makefile 7488 2005-12-25 00:26:08Z eagle $
3 include Makefile.global
5 ## All installation directories except for $(PATHRUN), which has a
6 ## different mode than the rest.
7 INSTDIRS = $(PATHNEWS) $(PATHBIN) $(PATHAUTH) $(PATHAUTHRESOLV) \
8 $(PATHAUTHPASSWD) $(PATHCONTROL) $(PATHFILTER) \
9 $(PATHRNEWS) $(PATHDB) $(PATHDOC) $(PATHETC) $(PATHLIB) \
10 $(PATHMAN) $(MAN1) $(MAN3) $(MAN5) $(MAN8) $(PATHSPOOL) \
11 $(PATHTMP) $(PATHARCHIVE) $(PATHARTICLES) $(PATHINCOMING) \
12 $(PATHINBAD) $(PATHTAPE) $(PATHOVERVIEW) $(PATHOUTGOING) \
13 $(PATHLOG) $(PATHLOG)/OLD $(PATHINCLUDE)
15 ## LIBDIRS are built before PROGDIRS, make update runs in all UPDATEDIRS,
16 ## and make install runs in all ALLDIRS. Nothing runs in test except the
17 ## test target itself and the clean targets. Currently, include is built
18 ## before anything else but nothing else runs in it except clean targets.
19 LIBDIRS = include lib storage history
20 PROGDIRS = innd nnrpd innfeed control expire frontends backends authprogs \
22 UPDATEDIRS = $(LIBDIRS) $(PROGDIRS) doc
23 ALLDIRS = $(UPDATEDIRS) samples site
24 CLEANDIRS = $(ALLDIRS) include tests
26 ## The directory name and tar file to use when building a release.
27 TARDIR = inn-$(VERSION)
28 TARFILE = $(TARDIR).tar
30 ## The directory to use when building a snapshot.
31 SNAPDIR = inn-$(SNAPSHOT)-$(SNAPDATE)
33 ## DISTDIRS gets all directories from the MANIFEST, and DISTFILES gets all
34 ## regular files. Anything not listed in the MANIFEST will not be included
35 ## in a distribution. These are arguments to sed.
36 DISTDIRS = -e 1,2d -e '/(Directory)/!d' -e 's/ .*//' -e 's;^;$(TARDIR)/;'
37 SNAPDIRS = -e 1,2d -e '/(Directory)/!d' -e 's/ .*//' -e 's;^;$(SNAPDIR)/;'
38 DISTFILES = -e 1,2d -e '/(Directory)/d' -e 's/ .*//'
41 ## Major target -- build everything. Rather than just looping through
42 ## all the directories, use a set of parallel rules so that make -j can
43 ## work on more than one directory at a time.
44 all: all-include all-libraries all-programs
46 cd samples && $(MAKE) all
47 cd site && $(MAKE) all
49 all-libraries: all-lib all-storage all-history
51 all-include: ; cd include && $(MAKE) all
52 all-lib: all-include ; cd lib && $(MAKE) all
53 all-storage: all-lib ; cd storage && $(MAKE) library
54 all-history: all-storage ; cd history && $(MAKE) all
56 all-programs: all-innd all-nnrpd all-innfeed all-control all-expire \
57 all-frontends all-backends all-authprogs all-scripts \
60 all-authprogs: all-lib ; cd authprogs && $(MAKE) all
61 all-backends: all-libraries ; cd backends && $(MAKE) all
62 all-control: ; cd control && $(MAKE) all
63 all-expire: all-libraries ; cd expire && $(MAKE) all
64 all-frontends: all-libraries ; cd frontends && $(MAKE) all
65 all-innd: all-libraries ; cd innd && $(MAKE) all
66 all-innfeed: all-libraries ; cd innfeed && $(MAKE) all
67 all-nnrpd: all-libraries ; cd nnrpd && $(MAKE) all
68 all-scripts: ; cd scripts && $(MAKE) all
69 all-store-util: all-libraries ; cd storage && $(MAKE) programs
72 ## If someone tries to run make before running configure, tell them to run
75 @echo 'Run ./configure before running make. See INSTALL for details.'
79 ## Installation rules. make install installs everything; make update only
80 ## updates the binaries, scripts, and documentation and leaves config
83 @for D in $(ALLDIRS) ; do \
85 cd $$D && $(MAKE) install || exit 1 ; cd .. ; \
88 @echo 'If this is a first-time installation, a minimal active file and'
89 @echo 'history database have been installed. Do not forget to update'
90 @echo 'your cron entries and configure INN. See INSTALL for more'
95 @chmod +x support/install-sh
96 for D in $(INSTDIRS) ; do \
97 support/install-sh $(OWNER) -m 0755 -d $(D)$$D ; \
99 support/install-sh $(OWNER) -m 0750 -d $(D)$(PATHRUN)
102 @chmod +x support/install-sh
103 @for D in $(UPDATEDIRS) ; do \
105 cd $$D && $(MAKE) install || exit 1 ; cd .. ; \
107 $(PATHBIN)/innupgrade $(PATHETC)
109 ## Install a certificate for TLS/SSL support.
111 $(SSLBIN)/openssl req -new -x509 -nodes \
112 -out $(PATHLIB)/cert.pem -days 366 \
113 -keyout $(PATHLIB)/key.pem
114 chown $(NEWSUSER) $(PATHLIB)/cert.pem
115 chgrp $(NEWSGROUP) $(PATHLIB)/cert.pem
116 chmod 640 $(PATHLIB)/cert.pem
117 chown $(NEWSUSER) $(PATHLIB)/key.pem
118 chgrp $(NEWSGROUP) $(PATHLIB)/key.pem
119 chmod 600 $(PATHLIB)/key.pem
122 ## Cleanup targets. clean deletes all compilation results but leaves the
123 ## configure results. distclean or clobber removes everything not part of
124 ## the distribution tarball. maintclean removes some additional files
125 ## created as part of the release process.
127 @for D in $(CLEANDIRS) ; do \
129 cd $$D && $(MAKE) clean || exit 1 ; cd .. ; \
132 clobber realclean distclean:
133 @for D in $(CLEANDIRS) ; do \
135 cd $$D && $(MAKE) $(FLAGS) clobber && cd .. ; \
138 rm -f LIST.* Makefile.global TAGS tags config.cache config.log
139 rm -f config.status libtool support/fixscript
141 maintclean: distclean
143 rm -f CHANGES ChangeLog inn*.tar.gz
146 ## Other generic targets.
147 depend tags ctags profiled:
148 @for D in $(ALLDIRS) ; do \
150 cd $$D && $(MAKE) $@ || exit 1 ; cd .. ; \
154 etags */*.c */*.h */*/*.c */*/*.h
157 ## Run the test suite.
159 cd tests && $(MAKE) test
162 ## For maintainers, build the entire source base with warnings enabled.
164 $(MAKE) COPT="$(WARNINGS) $(COPT)" all
167 ## Make a release. We create a release by recreating the directory
168 ## structure and then copying over all files listed in the MANIFEST. If it
169 ## isn't in the MANIFEST, it doesn't go into the release. We also update
170 ## the version information in Makefile.global.in to remove the prerelease
171 ## designation and update all timestamps to the date the release is made.
176 for d in `sed $(DISTDIRS) MANIFEST` ; do mkdir -p $$d ; done
177 for f in `sed $(DISTFILES) MANIFEST` ; do \
178 cp $$f $(TARDIR)/$$f || exit 1 ; \
180 sed 's/= prerelease/=/' < Makefile.global.in \
181 > $(TARDIR)/Makefile.global.in
182 cp ChangeLog $(TARDIR)
183 find $(TARDIR) -type f -print | xargs touch -t `date +%m%d%H%M.%S`
184 tar cf $(TARFILE) $(TARDIR)
185 $(GZIP) -9 $(TARFILE)
187 ## Generate the ChangeLog using support/mkchangelog. This should only be
188 ## run by a maintainer since it depends on cvs log working and also
189 ## requires cvs2cl be available somewhere.
191 $(PERL) support/mkchangelog
194 ## Check the MANIFEST against the files present in the current tree,
195 ## building a list with find and running diff between the lists.
197 sed -e 1,2d -e 's/ .*//' MANIFEST > LIST.manifest
198 $(PERL) support/mkmanifest > LIST.real
199 diff -u LIST.manifest LIST.real
202 ## Make a snapshot. This is like making a release, except that we don't do
203 ## the ChangeLog thing and we don't change the version number. We also
204 ## assume that SNAPSHOT has been set to the appropriate current branch.
209 set -e ; for d in `sed $(SNAPDIRS) MANIFEST` ; do mkdir -p $$d ; done
210 set -e ; for f in `sed $(DISTFILES) MANIFEST` ; do \
211 cp $$f $(SNAPDIR)/$$f ; \
213 cp README.snapshot $(SNAPDIR)/
214 sed 's/= prerelease/= $(SNAPDATE) snapshot/' \
215 Makefile.global.in > $(SNAPDIR)/Makefile.global.in
216 find $(SNAPDIR) -type f -print | xargs touch -t `date +%m%d%H%M.%S`
217 tar cf $(SNAPDIR).tar $(SNAPDIR)
218 $(GZIP) -9 $(SNAPDIR).tar