2 ###############################################################################
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
11 # Package: Bible Retrieval System
12 # Status: Experimental (Do Not Distribute)
14 ###############################################################################
19 # Revision 2.11 2005/01/22 23:31:01 matthew
20 # Remove -traditional, since newer GCCs then object to ANSI
23 # Revision 2.10 2005/01/22 18:51:01 matthew
26 # Revision 2.9 2005/01/21 18:00:25 matthew
27 # Remove -fwritable-strings
29 # Revision 2.8 2003/07/26 10:05:06 matthew
32 # Revision 2.7 2003/01/09 13:29:08 matthew
33 # Remove a bit more cruft with clean
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
38 # Revision 2.5 2003/01/08 18:29:12 matthew
39 # patch from IWJ to make this -j compatible
41 # Revision 2.4 2003/01/08 16:14:17 matthew
42 # tidy up header a little
44 # Revision 2.3 2003/01/08 16:13:29 matthew
45 # remove clobber target, and make clean target remove everything that should go
47 # Revision 2.2 2003/01/08 16:08:50 matthew
48 # clean target now removes things created by makeindex2
50 # Revision 2.1 2003/01/08 15:50:53 matthew
51 # applied debian patch
53 # Revision 2.0 2003/01/08 15:29:51 matthew
54 # versions collected from the net
56 # Revision 1.27 93/04/27 12:57:55 12:57:55 chip (Chip Chapin)
57 # Removed dependencies from "install" target".
59 ###############################################################################
61 # name of main program -- this determines a lot of other names
64 # name of supplemental index file -- generated from raw data file
65 PROGINDEX = $(PROGRAM)-index
67 README = README.$(PROGRAM)
73 RAWDATA = $(PROGRAM).rawtext
75 # Derived data file. Comes from processing raw data file.
76 DATA = $(PROGRAM).data
79 NINSTPKG = $(PROGRAM).pkg
81 # where to install this stuff
86 DESTMAN = $(DEST)/share/man
87 DESTMAN1 = $(DESTMAN)/man1
89 # I use environment variables for these...
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)\"
94 # release directories. Nobody should care about this but me
96 RELEASEDIR = $(FTPHOME)/pub/$(PROGRAM)
97 NINSTDIR = /usr/adm/netdist
98 NINSTPKGDIR = $(NINSTDIR)/packages
100 # This is only used by the author when making a new release ftp-able.
113 ###############################################################################
114 # Sources, objects, and tools
115 ###############################################################################
116 # PROGOBJS and PROGSRCS are the components of the main program.
117 PROGOBJS = $(PROGRAM).o \
125 PROGSRCS = $(PROGRAM).c \
133 # TOOLOBJS and TOOLSRCS are objects and sources used in building TOOLS.
134 TOOLOBJS = buildcmp.o \
139 TOOLSRCS = buildcmp.c \
144 TOOLS = buildcmp squish makeindex makeconcfile
146 # TOOLS2 are additional scripts and data files used in constructing stuff.
147 TOOLS2 = makeindex2 \
152 # HDRS lists all header files used by PROGRAM and TOOLS
161 ###############################################################################
162 # Distribution and version-control packages
163 ###############################################################################
164 # SRCS includes all archivable sources except headers, both tools and program
169 # DOC includes all available program documentation
174 # List of files controlled by RCS
182 # PROGDIST contains only those files needed to build PROGRAM, plus doc.
188 # DATADIST contains the fully-processed compressed data files
189 DATADIST = $(DATA) $(DATA).conc
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) \
199 ###############################################################################
201 ###############################################################################
202 $(PROGRAM): $(PROGOBJS)
203 @echo "Linking $@ ..."
204 @$(LD) $(LDFLAGS) $(PROGOBJS) -o $@
208 all: $(PROGRAM) $(TOOLS) $(DATA) $(DATA).conc
210 buildcmp: buildcmp.o compresslib.o util.o
211 @echo "Linking $@ ..."
212 @$(LD) $(LDFLAGS) $@.o compresslib.o util.o -o $@
216 @echo "Linking $@ ..."
217 @$(LD) $(LDFLAGS) $@.o -o $@
220 makeindex: makeindex.o
221 @echo "Linking $@ ..."
222 @$(LD) $(LDFLAGS) $@.o -o $@
225 makeconcfile: makeconcfile.o util.o
226 @echo "Linking $@ ..."
227 @$(LD) $(LDFLAGS) $@.o util.o -o $@
230 brl-startverse.h: $(RAWDATA)
231 ./makeindex2 $(RAWDATA)
233 brl-startchapter.h: brl-startverse.h
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
241 ./makeconcfile $@ < $(PROGRAM).rawconcordance
243 squish.data: $(RAWDATA)
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
249 squish.stats: squish.data
251 $(PROGINDEX).c: $(RAWDATA)
253 ./makeindex $(RAWDATA) > $@
255 $(DATA): squish.stats squish.data
262 ###############################################################################
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
270 @touch $(SAFEDATE) $@
271 @if [ -r $(SAFEDATE) ]; then \
272 /bin/rm $(SAFEDATE) $@; \
273 if [ -x /usr/5bin/touch ]; then \
274 /usr/5bin/touch $(SAFEDATE) $@; \
276 # major kludge alert! ... \
277 touch brl-startverse.h brl-startchapter.h; \
280 @echo " A dummy $(RAWDATA) file has been created."
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..."
296 gzip < $(MAN) > $(MAN).gz
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
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
304 # depend:; @mkmf -f $(MAKEFILE) ROOT=$(ROOT)
306 echo:; @echo $(HDRS) $(SRCS)
308 index:; @ctags -wx $(HDRS) $(SRCS)
310 print:; @$(PRINT) $(HDRS) $(SRCS)
312 tags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
316 ###############################################################################
317 # Distribution Targets
318 ###############################################################################
319 shar: $(PROGRAM).shar $(DATA).shar $(PROGRAM)-tools.shar
321 $(PROGRAM).shar: $(PROGDIST)
322 shar -cstem $(PROGDIST) > $<
324 $(DATA).shar: $(DATADIST)
325 shar -cstem $(DATADIST) > $<
327 $(PROGRAM)-tools.shar: $(TOOLSDIST)
328 shar -cstem $(TOOLSDIST) > $<
331 TARFILES = $(PROGRAM).tar.Z \
333 $(PROGRAM)-tools.tar.Z \
338 $(PROGRAM).tar.Z: $(PROGDIST)
339 tar cvf $(PROGRAM).tar $(PROGDIST)
340 compress $(PROGRAM).tar
342 $(DATA).tar: $(DATADIST)
343 tar cvf $@ $(DATADIST)
345 $(PROGRAM)-tools.tar.Z: $(TOOLSDIST)
346 tar cvf $(PROGRAM)-tools.tar $(TOOLSDIST)
347 compress $(PROGRAM)-tools.tar
349 # compress raw text data (without deleting uncompressed)
350 $(PROGRAM).rawtext.Z: $(PROGRAM).rawtext
351 compress <$(PROGRAM).rawtext >$@
354 @echo "Writing Linus tape on device /dev/rct...\c"
355 @echo $(TARFILES) | cpio -ocv | tcio -orveVS 8 /dev/rct
359 @echo "Writing tar-format tape on device /dev/dat...\c"
360 tar cvf /dev/dat README.ftp $(TARFILES)
365 ###############################################################################
367 ###############################################################################
368 stdresults: test.results
369 @echo "Storing Standard test results in test.stdresults...\c"
370 @cp test.results test.stdresults
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"
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
386 ###############################################################################
387 # Release/Version Control/Installation Targets
388 # Except for "install" this will be of no interest to users other than
390 ###############################################################################
396 @if [ "$(RELNAME)" = "" ]; \
397 then echo "*** No RELNAME value specified ***"; \
398 echo "*** Set RELNAME to release name and export it ***"; \
400 @if [ "$(CFLAGS)" != "-O" ]; \
401 then echo "*** CFLAGS not set to -O for release ***"; \
402 echo "*** Set CFLAGS to -O and export it ***"; \
404 rcs -n"$(RELNAME):" -sRel $(RCSFILES)
405 echo "$(RELNAME)" > relcheckin
407 ## $(RCSFILES):; co $@
409 # The nested makes are here because the timestamps don't get updated
410 # correctly from the ci -l otherwise.
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
431 ninstall: $(NINSTPKG)
432 $(INSTALL) $(NINSTPKG) $(NINSTPKGDIR)
433 .do $(NINSTDIR)/restartd
435 # The "install" target could be of general use. That's why there are
436 # no explicit dependencies here. They just confuse things...
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
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)
468 # update: $(DESTBIN)/$(PROGRAM) $(DESTLIB)/$(DATA)
472 ###############################################################################
473 # Header DEPENDENCIES
474 ###############################################################################
476 $(PROGRAM).o: brl.h tsl.h util.h version.h
477 brl.o: brl.h 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