chiark / gitweb /
xfoo => mfoo, add comment
[inn-innduct.git] / Makefile
1 ##  $Id: Makefile 7488 2005-12-25 00:26:08Z eagle $
2
3 include Makefile.global
4
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)
14
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 \
21               scripts
22 UPDATEDIRS  = $(LIBDIRS) $(PROGDIRS) doc
23 ALLDIRS     = $(UPDATEDIRS) samples site
24 CLEANDIRS   = $(ALLDIRS) include tests
25
26 ##  The directory name and tar file to use when building a release.
27 TARDIR      = inn-$(VERSION)
28 TARFILE     = $(TARDIR).tar
29
30 ##  The directory to use when building a snapshot.
31 SNAPDIR     = inn-$(SNAPSHOT)-$(SNAPDATE)
32
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/ .*//'
39
40
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
45         cd doc     && $(MAKE) all
46         cd samples && $(MAKE) all
47         cd site    && $(MAKE) all
48
49 all-libraries:  all-lib all-storage all-history
50
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
55
56 all-programs:   all-innd all-nnrpd all-innfeed all-control all-expire \
57                 all-frontends all-backends all-authprogs all-scripts \
58                 all-store-util
59
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
70
71
72 ##  If someone tries to run make before running configure, tell them to run
73 ##  configure first.
74 Makefile.global:
75         @echo 'Run ./configure before running make.  See INSTALL for details.'
76         @exit 1
77
78
79 ##  Installation rules.  make install installs everything; make update only
80 ##  updates the binaries, scripts, and documentation and leaves config
81 ##  files alone.
82 install: directories
83         @for D in $(ALLDIRS) ; do \
84             echo '' ; \
85             cd $$D && $(MAKE) install || exit 1 ; cd .. ; \
86         done
87         @echo ''
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'
91         @echo 'information.'
92         @echo ''
93
94 directories:
95         @chmod +x support/install-sh
96         for D in $(INSTDIRS) ; do \
97             support/install-sh $(OWNER) -m 0755 -d $(D)$$D ; \
98         done
99         support/install-sh $(OWNER) -m 0750 -d $(D)$(PATHRUN)
100
101 update: 
102         @chmod +x support/install-sh
103         @for D in $(UPDATEDIRS) ; do \
104             echo '' ; \
105             cd $$D && $(MAKE) install || exit 1 ; cd .. ; \
106         done
107         $(PATHBIN)/innupgrade $(PATHETC)
108
109 ##  Install a certificate for TLS/SSL support.
110 cert:
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
120
121
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.
126 clean:
127         @for D in $(CLEANDIRS) ; do \
128             echo '' ; \
129             cd $$D && $(MAKE) clean || exit 1 ; cd .. ; \
130         done
131
132 clobber realclean distclean:
133         @for D in $(CLEANDIRS) ; do \
134             echo '' ; \
135             cd $$D && $(MAKE) $(FLAGS) clobber && cd .. ; \
136         done
137         @echo ''
138         rm -f LIST.* Makefile.global TAGS tags config.cache config.log
139         rm -f config.status libtool support/fixscript
140
141 maintclean: distclean
142         rm -rf $(TARDIR)
143         rm -f CHANGES ChangeLog inn*.tar.gz
144
145
146 ##  Other generic targets.
147 depend tags ctags profiled:
148         @for D in $(ALLDIRS) ; do \
149             echo '' ; \
150             cd $$D && $(MAKE) $@ || exit 1 ; cd .. ; \
151         done
152
153 TAGS etags:
154         etags */*.c */*.h */*/*.c */*/*.h
155
156
157 ##  Run the test suite.
158 check test tests:
159         cd tests && $(MAKE) test
160
161
162 ##  For maintainers, build the entire source base with warnings enabled.
163 warnings:
164         $(MAKE) COPT="$(WARNINGS) $(COPT)" all
165
166
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.
172 release: ChangeLog
173         rm -rf $(TARDIR)
174         rm -f inn*.tar.gz
175         mkdir $(TARDIR)
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 ; \
179         done
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)
186
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.
190 ChangeLog:
191         $(PERL) support/mkchangelog
192
193
194 ##  Check the MANIFEST against the files present in the current tree,
195 ##  building a list with find and running diff between the lists.
196 check-manifest:
197         sed -e 1,2d -e 's/ .*//' MANIFEST > LIST.manifest
198         $(PERL) support/mkmanifest > LIST.real
199         diff -u LIST.manifest LIST.real
200
201
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.
205 snapshot:
206         rm -rf $(SNAPDIR)
207         rm -f inn*.tar.gz
208         mkdir $(SNAPDIR)
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 ; \
212         done
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