chiark / gitweb /
correct text of Psa50:17 (fix for #623629)
[bible-kjv.git] / Makefile
1 # -*-Fundamental-*-
2 ###############################################################################
3 #
4 # File:         Makefile
5 # RCS:          $Header: /home/matthew/cvs/bible-kjv-4.10/Makefile,v 2.11 2005/01/22 23:31:01 matthew Exp $
6 # Description:  Makefile for Bible Retrieval System
7 # Author:       Chip Chapin, Hewlett Packard Company
8 # Created:      Thu Aug 24 17:26:25 1989
9 # Modified:     Tue Apr 27 12:57:45 1993 (Chip Chapin) chip@hpclbis
10 # Language:     make
11 # Package:      Bible Retrieval System
12 # Status:       Experimental (Do Not Distribute)
13 #
14 ###############################################################################
15 #
16 # Revisions:
17 #
18 # $Log: Makefile,v $
19 # Revision 2.11  2005/01/22 23:31:01  matthew
20 # Remove -traditional, since newer GCCs then object to ANSI
21 # prototypes...
22 #
23 # Revision 2.10  2005/01/22 18:51:01  matthew
24 # add more warnings
25 #
26 # Revision 2.9  2005/01/21 18:00:25  matthew
27 # Remove -fwritable-strings
28 #
29 # Revision 2.8  2003/07/26 10:05:06  matthew
30 # 4.15 release
31 #
32 # Revision 2.7  2003/01/09 13:29:08  matthew
33 # Remove a bit more cruft with clean
34 #
35 # Revision 2.6  2003/01/08 19:18:31  matthew
36 # add an -f flag to the rm -f squish.stats, so this doesnt barf
37 #
38 # Revision 2.5  2003/01/08 18:29:12  matthew
39 # patch from IWJ to make this -j compatible
40 #
41 # Revision 2.4  2003/01/08 16:14:17  matthew
42 # tidy up header a little
43 #
44 # Revision 2.3  2003/01/08 16:13:29  matthew
45 # remove clobber target, and make clean target remove everything that should go
46 #
47 # Revision 2.2  2003/01/08 16:08:50  matthew
48 # clean target now removes things created by makeindex2
49 #
50 # Revision 2.1  2003/01/08 15:50:53  matthew
51 # applied debian patch
52 #
53 # Revision 2.0  2003/01/08 15:29:51  matthew
54 # versions collected from the net
55 #
56 # Revision 1.27  93/04/27  12:57:55  12:57:55  chip (Chip Chapin)
57 # Removed dependencies from "install" target".
58 #
59 ###############################################################################
60
61 # name of main program -- this determines a lot of other names
62 PROGRAM       = bible
63
64 # name of supplemental index file -- generated from raw data file
65 PROGINDEX     = $(PROGRAM)-index
66
67 README        = README.$(PROGRAM)
68
69 # primary man page
70 MAN           = $(PROGRAM).1
71
72 # raw data file
73 RAWDATA       = $(PROGRAM).rawtext
74
75 # Derived data file.  Comes from processing raw data file.
76 DATA          = $(PROGRAM).data
77
78 # Ninstall package
79 NINSTPKG      = $(PROGRAM).pkg
80
81 # where to install this stuff
82 DEST          = /usr
83 #DEST         = $(HOME)/local
84 DESTBIN       = $(DEST)/bin
85 DESTLIB       = $(DEST)/lib
86 DESTMAN       = $(DEST)/share/man
87 DESTMAN1      = $(DESTMAN)/man1
88
89 # I use environment variables for these...
90 #CFLAGS       = -g
91 CFLAGS        = -Wall -Wformat -Werror -Wshadow -W -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wcast-align -Wcast-qual -Wbad-function-cast -Wpointer-arith -g2 -ggdb -DDESTLIB=\"$(DESTLIB)\"
92 LDFLAGS       = -lreadline
93
94 # release directories.  Nobody should care about this but me
95 FTPHOME       = /mnt/ftp
96 RELEASEDIR    = $(FTPHOME)/pub/$(PROGRAM)
97 NINSTDIR      = /usr/adm/netdist
98 NINSTPKGDIR   = $(NINSTDIR)/packages
99
100 # This is only used by the author when making a new release ftp-able.
101 INSTALL       = .do cp
102
103 LD            = cc
104
105 MAKEFILE      = Makefile
106
107 PRINT         = pr
108
109 SHELL         = /bin/sh
110
111 MKDIR       = install -d
112
113 ###############################################################################
114 # Sources, objects, and tools
115 ###############################################################################
116 # PROGOBJS and PROGSRCS are the components of the main program.
117 PROGOBJS      = $(PROGRAM).o \
118                 brl-index.o \
119                 brl.o \
120                 $(PROGINDEX).o \
121                 tsl.o \
122                 util.o \
123                 compresslib.o
124
125 PROGSRCS      = $(PROGRAM).c \
126                 brl-index.c \
127                 brl.c \
128                 $(PROGINDEX).c \
129                 tsl.c \
130                 util.c \
131                 compresslib.c
132
133 # TOOLOBJS and TOOLSRCS are objects and sources used in building TOOLS.
134 TOOLOBJS      = buildcmp.o \
135                 makeindex.o \
136                 makeconcfile.o \
137                 squish.o
138
139 TOOLSRCS      = buildcmp.c \
140                 makeindex.c \
141                 makeconcfile.c \
142                 squish.c
143
144 TOOLS         = buildcmp squish makeindex makeconcfile
145
146 # TOOLS2 are additional scripts and data files used in constructing stuff.
147 TOOLS2        = makeindex2 \
148                 makeconcordance \
149                 makeconc.pl \
150                 $(PROGRAM).stopwords
151
152 # HDRS lists all header files used by PROGRAM and TOOLS
153 HDRS          = brl.h \
154                 brl-startverse.h \
155                 brl-startchapter.h \
156                 tsl.h \
157                 util.h \
158                 version.h
159
160
161 ###############################################################################
162 # Distribution and version-control packages
163 ###############################################################################
164 # SRCS includes all archivable sources except headers, both tools and program
165 SRCS          = $(PROGSRCS) \
166                 $(TOOLSRCS) \
167                 $(TOOLS2)
168
169 # DOC includes all available program documentation
170 DOC           = $(README) \
171                 README.ftp \
172                 $(MAN)
173
174 # List of files controlled by RCS
175 RCSFILES      = $(DOC) \
176                 $(SRCS) \
177                 $(HDRS) \
178                 $(MAKEFILE) \
179                 $(NINSTPKG) \
180                 testall
181
182 # PROGDIST contains only those files needed to build PROGRAM, plus doc.
183 PROGDIST      = $(HDRS) \
184                 $(PROGSRCS) \
185                 $(MAKEFILE) \
186                 $(DOC)
187
188 # DATADIST contains the fully-processed compressed data files
189 DATADIST      = $(DATA) $(DATA).conc
190
191 # TOOLSDIST contains all additional files needed to build a new
192 # version of this application from scratch, including re-processing data.
193 TOOLSDIST     = $(TOOLSRCS) \
194                 $(TOOLS2) \
195                 $(NINSTPKG) \
196                 testall 
197
198
199 ###############################################################################
200 # TARGETS
201 ###############################################################################
202 $(PROGRAM):     $(PROGOBJS)
203                 @echo "Linking $@ ..."
204                 @$(LD) $(LDFLAGS) $(PROGOBJS) -o $@
205                 @echo "done"
206
207
208 all:            $(PROGRAM) $(TOOLS) $(DATA) $(DATA).conc
209
210 buildcmp:       buildcmp.o compresslib.o util.o
211                 @echo "Linking $@ ..."
212                 @$(LD) $(LDFLAGS) $@.o compresslib.o util.o -o $@
213                 @echo "done"
214                 
215 squish:         squish.o
216                 @echo "Linking $@ ..."
217                 @$(LD) $(LDFLAGS) $@.o -o $@
218                 @echo "done"
219                 
220 makeindex:      makeindex.o
221                 @echo "Linking $@ ..."
222                 @$(LD) $(LDFLAGS) $@.o -o $@
223                 @echo "done"
224                 
225 makeconcfile:   makeconcfile.o util.o
226                 @echo "Linking $@ ..."
227                 @$(LD) $(LDFLAGS) $@.o util.o -o $@
228                 @echo "done"
229                 
230 brl-startverse.h:       $(RAWDATA)
231                 ./makeindex2 $(RAWDATA)
232
233 brl-startchapter.h: brl-startverse.h
234
235 ###############################################################################
236 # The nested makes are used on the following items to
237 # avoid establishing an explicit dependency on those files.
238 # Such a dependency causes lots of extra work.
239 $(DATA).conc:   $(PROGRAM).rawconcordance
240                 make makeconcfile
241                 ./makeconcfile $@ < $(PROGRAM).rawconcordance
242
243 squish.data:    $(RAWDATA)
244                 make squish
245                 if ./squish -w 65536 -v < $(RAWDATA) >squish.tmpdata; \
246                 then    mv squish.tmpdata squish.data; \
247                 else    rm -f squish.tmpdata squish.stats; fi
248                 
249 squish.stats:   squish.data
250
251 $(PROGINDEX).c: $(RAWDATA)
252                 make makeindex
253                 ./makeindex $(RAWDATA) > $@
254
255 $(DATA):        squish.stats squish.data
256                 make buildcmp
257                 ./buildcmp
258                 mv squish.output $@
259
260
261 #
262 ###############################################################################
263
264 # The next one ensures that $(PROGINDEX).c gets its dependency satisfied.
265 # Note that $(PROGINDEX).c is included in source distributions, while 
266 # $(RAWDATA) is NOT included in all distributions.  $(PROGINDEX).c does NOT 
267 # need to be rebuilt unless someone (probably me) has munged $(RAWDATA).
268 SAFEDATE = 0101000193
269 $(RAWDATA):
270                 @touch $(SAFEDATE) $@
271                 @if [ -r $(SAFEDATE) ]; then \
272                         /bin/rm $(SAFEDATE) $@; \
273                         if [ -x /usr/5bin/touch ]; then \
274                                 /usr/5bin/touch $(SAFEDATE) $@; \
275                         else \
276                                 # major kludge alert! ... \
277                                 touch brl-startverse.h brl-startchapter.h; \
278                         fi; \
279                 fi
280                 @echo "  A dummy $(RAWDATA) file has been created."
281
282 # The dependency on $(RAWDATA) helps to ensure that the raw concordance file
283 # is not rebuilt unnecessarily.
284 $(PROGRAM).rawconcordance:      $(RAWDATA)
285                 @echo "To exclude \"stopwords\" from concordance use this:"
286                 @echo "     ./makeconc.pl bible.stopwords"
287                 @echo "NOTE: The next command will FAIL if you don't have PERL."
288                 @echo "  If it fails, edit Makefile to use this instead:"
289                 @echo "     ./makeconcordance"
290                 @echo "Here we go..."
291                 ./makeconc.pl
292 #               ./makeconcordance
293
294 $(MAN).gz:      $(MAN)
295                 /bin/rm $@
296                 gzip < $(MAN) > $(MAN).gz
297
298 clean:;         @rm -f $(PROGOBJS) $(TOOLOBJS) core brl-startverse.h brl-startchapter.h vrs2num.index $(PROGINDEX).c $(PROGRAM) $(TOOLS) $(DATADIST) squish.stats squish.data tags $(PROGRAM).rawconcordance $(PROGRAM).wordcounts
299
300 #Don't use this. Use clean :-)
301 #clobber:;      @rm -f $(PROGOBJS) $(TOOLOBJS) $(PROGRAM) $(TOOLS) $(DATA) \
302                         $(PROGINDEX).c squish.stats squish.data core tags
303
304 # depend:;      @mkmf -f $(MAKEFILE) ROOT=$(ROOT)
305
306 echo:;          @echo $(HDRS) $(SRCS)
307
308 index:;         @ctags -wx $(HDRS) $(SRCS)
309
310 print:;         @$(PRINT) $(HDRS) $(SRCS)
311
312 tags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
313
314
315
316 ###############################################################################
317 # Distribution Targets
318 ###############################################################################
319 shar:           $(PROGRAM).shar $(DATA).shar $(PROGRAM)-tools.shar
320
321 $(PROGRAM).shar: $(PROGDIST)
322                 shar -cstem $(PROGDIST) > $<
323
324 $(DATA).shar:   $(DATADIST)
325                 shar -cstem $(DATADIST) > $<
326
327 $(PROGRAM)-tools.shar: $(TOOLSDIST)
328                 shar -cstem $(TOOLSDIST) > $<
329
330
331 TARFILES      = $(PROGRAM).tar.Z \
332                 $(DATA).tar \
333                 $(PROGRAM)-tools.tar.Z \
334                 $(PROGRAM).rawtext.Z
335
336 tar:            $(TARFILES)
337
338 $(PROGRAM).tar.Z: $(PROGDIST)
339                 tar cvf $(PROGRAM).tar $(PROGDIST)
340                 compress $(PROGRAM).tar
341
342 $(DATA).tar:    $(DATADIST)
343                 tar cvf $@ $(DATADIST)
344
345 $(PROGRAM)-tools.tar.Z: $(TOOLSDIST)
346                 tar cvf $(PROGRAM)-tools.tar $(TOOLSDIST)
347                 compress $(PROGRAM)-tools.tar
348
349 # compress raw text data (without deleting uncompressed)
350 $(PROGRAM).rawtext.Z:   $(PROGRAM).rawtext
351                 compress <$(PROGRAM).rawtext >$@
352                 
353 linustape:      tar
354                 @echo "Writing Linus tape on device /dev/rct...\c"
355                 @echo $(TARFILES) | cpio -ocv | tcio -orveVS 8 /dev/rct
356                 @echo " done."
357
358 dattape:        tar
359                 @echo "Writing tar-format tape on device /dev/dat...\c"
360                 tar cvf /dev/dat README.ftp $(TARFILES)
361                 @echo " done."
362
363
364
365 ###############################################################################
366 # Testing Targets
367 ###############################################################################
368 stdresults:     test.results
369                 @echo "Storing Standard test results in test.stdresults...\c"
370                 @cp test.results test.stdresults
371                 @touch stdresults
372                 @echo " done."
373
374 test.results:   testall $(PROGRAM)
375                 @echo "Running Test Suite (results in test.results)...\c"
376                 @./testall > test.results 2>&1
377                 @echo " test suite completed"
378
379 test:           test.results test.stdresults
380                 @echo "Comparing results to standard results"
381                 @if diff -c test.results test.stdresults; \
382                 then echo "  results OK."; \
383                 else echo "  results differ.  Possible error."; fi
384
385
386 ###############################################################################
387 # Release/Version Control/Installation Targets
388 # Except for "install" this will be of no interest to users other than 
389 # the author. 
390 ###############################################################################
391 checkin:        $(RCSFILES)
392                 ci -l $?
393                 touch checkin
394
395 relcheckin:     checkin 
396                 @if [ "$(RELNAME)" = "" ]; \
397                 then echo "*** No RELNAME value specified ***"; \
398                 echo "*** Set RELNAME to release name and export it ***"; \
399                 exit 1; fi
400                 @if [ "$(CFLAGS)" != "-O" ]; \
401                 then echo "*** CFLAGS not set to -O for release ***"; \
402                 echo "*** Set CFLAGS to -O and export it ***"; \
403                 exit 1; fi
404                 rcs -n"$(RELNAME):" -sRel $(RCSFILES)
405                 echo "$(RELNAME)" > relcheckin
406
407 ## $(RCSFILES):;        co $@
408
409 # The nested makes are here because the timestamps don't get updated
410 # correctly from the ci -l otherwise.
411 release:        relcheckin
412                 make all
413                 strip $(PROGRAM)
414                 make stdresults
415                 make tar
416                 make relinstall
417                 touch release
418
419 # The "relinstall" target puts all the pieces of a new release into place on 
420 # my home distribution machine.  Probably nobody else will want this...
421 relinstall: $(PROGRAM) $(DATA) $(DATA).conc $(TARFILES) \
422             $(MAN) $(README) README.ftp ninstall
423                 if hp9000s800;then $(INSTALL) $(PROGRAM) $(RELEASEDIR)/$(PROGRAM).hp-s800;fi
424                 $(INSTALL) $(DATA) $(RELEASEDIR)
425                 $(INSTALL) $(DATA).conc $(RELEASEDIR)
426                 $(INSTALL) $(TARFILES) $(RELEASEDIR)
427                 $(INSTALL) $(MAN) $(RELEASEDIR)
428                 $(INSTALL) $(README) $(RELEASEDIR)/$(README)
429                 $(INSTALL) README.ftp $(RELEASEDIR)/README.ftp
430
431 ninstall:       $(NINSTPKG)
432                 $(INSTALL) $(NINSTPKG) $(NINSTPKGDIR)
433                 .do $(NINSTDIR)/restartd
434
435 # The "install" target could be of general use.  That's why there are
436 # no explicit dependencies here.  They just confuse things...
437 install:
438                 @if [ ! -r $(DEST) ]; then $(MKDIR) $(DEST); fi
439                 @echo Installing $(PROGRAM) in $(DESTBIN)
440                 @if [ ! -r $(DESTBIN) ]; then $(MKDIR) $(DESTBIN); fi
441                 @if [ $(DESTBIN) != . ]; then \
442                 ((cd $(DESTBIN);rm -f $(PROGRAM)); \
443                 cp $(PROGRAM) $(DESTBIN)); \
444                 chown bin $(DESTBIN)/$(PROGRAM); \
445                 chgrp bin $(DESTBIN)/$(PROGRAM); \
446                 chmod 755 $(DESTBIN)/$(PROGRAM); fi
447                 @echo Installing $(DATA) and $(DATA).conc in $(DESTLIB)
448                 @if [ ! -r $(DESTLIB) ]; then $(MKDIR) $(DESTLIB); fi
449                 @if [ $(DESTLIB) != . ]; then \
450                 cp $(DATA) $(DATA).conc $(DESTLIB); \
451                 chown bin $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc; \
452                 chgrp bin $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc; \
453                 chmod 644 $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc; fi
454                 @if [ ! -r $(DESTMAN) ]; then $(MKDIR) $(DESTMAN); fi
455                 @echo Installing $(MAN) in $(DESTMAN1)
456                 @if [ ! -r $(DESTMAN1) ]; then $(MKDIR) $(DESTMAN1); fi
457                 @if [ $(DESTMAN1) != . ]; then \
458                 cp $(MAN) $(DESTMAN1)/$(MAN); \
459                 chown bin $(DESTMAN1)/$(MAN); \
460                 chgrp bin $(DESTMAN1)/$(MAN); \
461                 chmod 644 $(DESTMAN1)/$(MAN); fi
462
463 uninstall:;     @echo Un-installing $(PROGRAM), $(DATA) and $(MAN)
464                 rm -f $(DESTBIN)/$(PROGRAM)
465                 rm -f $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc
466                 rm -f $(DESTMAN1)/$(MAN)
467
468 # update:               $(DESTBIN)/$(PROGRAM) $(DESTLIB)/$(DATA)
469
470
471
472 ###############################################################################
473 # Header DEPENDENCIES
474 ###############################################################################
475 ###
476 $(PROGRAM).o:   brl.h tsl.h util.h version.h
477 brl.o:          brl.h tsl.h util.h
478 tsl.o:          tsl.h util.h
479 buildcmp.o:     tsl.h util.h
480 makeconcfile.o: tsl.h util.h
481 brl-index.o:    brl-startverse.h brl-startchapter.h