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)\"
95 # release directories. Nobody should care about this but me
97 RELEASEDIR = $(FTPHOME)/pub/$(PROGRAM)
98 NINSTDIR = /usr/adm/netdist
99 NINSTPKGDIR = $(NINSTDIR)/packages
101 # This is only used by the author when making a new release ftp-able.
114 ###############################################################################
115 # Sources, objects, and tools
116 ###############################################################################
117 # PROGOBJS and PROGSRCS are the components of the main program.
118 PROGOBJS = $(PROGRAM).o \
126 PROGSRCS = $(PROGRAM).c \
134 # TOOLOBJS and TOOLSRCS are objects and sources used in building TOOLS.
135 TOOLOBJS = buildcmp.o \
140 TOOLSRCS = buildcmp.c \
145 TOOLS = buildcmp squish makeindex makeconcfile
147 # TOOLS2 are additional scripts and data files used in constructing stuff.
148 TOOLS2 = makeindex2 \
153 # HDRS lists all header files used by PROGRAM and TOOLS
162 ###############################################################################
163 # Distribution and version-control packages
164 ###############################################################################
165 # SRCS includes all archivable sources except headers, both tools and program
170 # DOC includes all available program documentation
175 # List of files controlled by RCS
183 # PROGDIST contains only those files needed to build PROGRAM, plus doc.
189 # DATADIST contains the fully-processed compressed data files
190 DATADIST = $(DATA) $(DATA).conc
192 # TOOLSDIST contains all additional files needed to build a new
193 # version of this application from scratch, including re-processing data.
194 TOOLSDIST = $(TOOLSRCS) \
200 ###############################################################################
202 ###############################################################################
203 $(PROGRAM): $(PROGOBJS)
204 @echo "Linking $@ ..."
205 @$(LD) $(LDFLAGS) $(PROGOBJS) $(LDADD) -o $@
209 all: $(PROGRAM) $(TOOLS) $(DATA) $(DATA).conc
211 buildcmp: buildcmp.o compresslib.o util.o
212 @echo "Linking $@ ..."
213 @$(LD) $(LDFLAGS) $@.o compresslib.o util.o -o $@
217 @echo "Linking $@ ..."
218 @$(LD) $(LDFLAGS) $@.o -o $@
221 makeindex: makeindex.o
222 @echo "Linking $@ ..."
223 @$(LD) $(LDFLAGS) $@.o -o $@
226 makeconcfile: makeconcfile.o util.o
227 @echo "Linking $@ ..."
228 @$(LD) $(LDFLAGS) $@.o util.o -o $@
231 brl-startverse.h: $(RAWDATA)
232 ./makeindex2 $(RAWDATA)
234 brl-startchapter.h: brl-startverse.h
236 ###############################################################################
237 # The nested makes are used on the following items to
238 # avoid establishing an explicit dependency on those files.
239 # Such a dependency causes lots of extra work.
240 $(DATA).conc: $(PROGRAM).rawconcordance
242 ./makeconcfile $@ < $(PROGRAM).rawconcordance
244 squish.data: $(RAWDATA)
246 if ./squish -w 65536 -v < $(RAWDATA) >squish.tmpdata; \
247 then mv squish.tmpdata squish.data; \
248 else rm -f squish.tmpdata squish.stats; fi
250 squish.stats: squish.data
252 $(PROGINDEX).c: $(RAWDATA)
254 ./makeindex $(RAWDATA) > $@
256 $(DATA): squish.stats squish.data
263 ###############################################################################
265 # The next one ensures that $(PROGINDEX).c gets its dependency satisfied.
266 # Note that $(PROGINDEX).c is included in source distributions, while
267 # $(RAWDATA) is NOT included in all distributions. $(PROGINDEX).c does NOT
268 # need to be rebuilt unless someone (probably me) has munged $(RAWDATA).
269 SAFEDATE = 0101000193
271 @touch $(SAFEDATE) $@
272 @if [ -r $(SAFEDATE) ]; then \
273 /bin/rm $(SAFEDATE) $@; \
274 if [ -x /usr/5bin/touch ]; then \
275 /usr/5bin/touch $(SAFEDATE) $@; \
277 # major kludge alert! ... \
278 touch brl-startverse.h brl-startchapter.h; \
281 @echo " A dummy $(RAWDATA) file has been created."
283 # The dependency on $(RAWDATA) helps to ensure that the raw concordance file
284 # is not rebuilt unnecessarily.
285 $(PROGRAM).rawconcordance: $(RAWDATA)
286 @echo "To exclude \"stopwords\" from concordance use this:"
287 @echo " ./makeconc.pl bible.stopwords"
288 @echo "NOTE: The next command will FAIL if you don't have PERL."
289 @echo " If it fails, edit Makefile to use this instead:"
290 @echo " ./makeconcordance"
291 @echo "Here we go..."
297 gzip < $(MAN) > $(MAN).gz
299 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
301 #Don't use this. Use clean :-)
302 #clobber:; @rm -f $(PROGOBJS) $(TOOLOBJS) $(PROGRAM) $(TOOLS) $(DATA) \
303 $(PROGINDEX).c squish.stats squish.data core tags
305 # depend:; @mkmf -f $(MAKEFILE) ROOT=$(ROOT)
307 echo:; @echo $(HDRS) $(SRCS)
309 index:; @ctags -wx $(HDRS) $(SRCS)
311 print:; @$(PRINT) $(HDRS) $(SRCS)
313 tags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
317 ###############################################################################
318 # Distribution Targets
319 ###############################################################################
320 shar: $(PROGRAM).shar $(DATA).shar $(PROGRAM)-tools.shar
322 $(PROGRAM).shar: $(PROGDIST)
323 shar -cstem $(PROGDIST) > $<
325 $(DATA).shar: $(DATADIST)
326 shar -cstem $(DATADIST) > $<
328 $(PROGRAM)-tools.shar: $(TOOLSDIST)
329 shar -cstem $(TOOLSDIST) > $<
332 TARFILES = $(PROGRAM).tar.Z \
334 $(PROGRAM)-tools.tar.Z \
339 $(PROGRAM).tar.Z: $(PROGDIST)
340 tar cvf $(PROGRAM).tar $(PROGDIST)
341 compress $(PROGRAM).tar
343 $(DATA).tar: $(DATADIST)
344 tar cvf $@ $(DATADIST)
346 $(PROGRAM)-tools.tar.Z: $(TOOLSDIST)
347 tar cvf $(PROGRAM)-tools.tar $(TOOLSDIST)
348 compress $(PROGRAM)-tools.tar
350 # compress raw text data (without deleting uncompressed)
351 $(PROGRAM).rawtext.Z: $(PROGRAM).rawtext
352 compress <$(PROGRAM).rawtext >$@
355 @echo "Writing Linus tape on device /dev/rct...\c"
356 @echo $(TARFILES) | cpio -ocv | tcio -orveVS 8 /dev/rct
360 @echo "Writing tar-format tape on device /dev/dat...\c"
361 tar cvf /dev/dat README.ftp $(TARFILES)
366 ###############################################################################
368 ###############################################################################
369 stdresults: test.results
370 @echo "Storing Standard test results in test.stdresults...\c"
371 @cp test.results test.stdresults
375 test.results: testall $(PROGRAM)
376 @echo "Running Test Suite (results in test.results)...\c"
377 @./testall > test.results 2>&1
378 @echo " test suite completed"
380 test: test.results test.stdresults
381 @echo "Comparing results to standard results"
382 @if diff -c test.results test.stdresults; \
383 then echo " results OK."; \
384 else echo " results differ. Possible error."; fi
387 ###############################################################################
388 # Release/Version Control/Installation Targets
389 # Except for "install" this will be of no interest to users other than
391 ###############################################################################
397 @if [ "$(RELNAME)" = "" ]; \
398 then echo "*** No RELNAME value specified ***"; \
399 echo "*** Set RELNAME to release name and export it ***"; \
401 @if [ "$(CFLAGS)" != "-O" ]; \
402 then echo "*** CFLAGS not set to -O for release ***"; \
403 echo "*** Set CFLAGS to -O and export it ***"; \
405 rcs -n"$(RELNAME):" -sRel $(RCSFILES)
406 echo "$(RELNAME)" > relcheckin
408 ## $(RCSFILES):; co $@
410 # The nested makes are here because the timestamps don't get updated
411 # correctly from the ci -l otherwise.
420 # The "relinstall" target puts all the pieces of a new release into place on
421 # my home distribution machine. Probably nobody else will want this...
422 relinstall: $(PROGRAM) $(DATA) $(DATA).conc $(TARFILES) \
423 $(MAN) $(README) README.ftp ninstall
424 if hp9000s800;then $(INSTALL) $(PROGRAM) $(RELEASEDIR)/$(PROGRAM).hp-s800;fi
425 $(INSTALL) $(DATA) $(RELEASEDIR)
426 $(INSTALL) $(DATA).conc $(RELEASEDIR)
427 $(INSTALL) $(TARFILES) $(RELEASEDIR)
428 $(INSTALL) $(MAN) $(RELEASEDIR)
429 $(INSTALL) $(README) $(RELEASEDIR)/$(README)
430 $(INSTALL) README.ftp $(RELEASEDIR)/README.ftp
432 ninstall: $(NINSTPKG)
433 $(INSTALL) $(NINSTPKG) $(NINSTPKGDIR)
434 .do $(NINSTDIR)/restartd
436 # The "install" target could be of general use. That's why there are
437 # no explicit dependencies here. They just confuse things...
439 @if [ ! -r $(DEST) ]; then $(MKDIR) $(DEST); fi
440 @echo Installing $(PROGRAM) in $(DESTBIN)
441 @if [ ! -r $(DESTBIN) ]; then $(MKDIR) $(DESTBIN); fi
442 @if [ $(DESTBIN) != . ]; then \
443 ((cd $(DESTBIN);rm -f $(PROGRAM)); \
444 cp $(PROGRAM) $(DESTBIN)); \
445 chown bin $(DESTBIN)/$(PROGRAM); \
446 chgrp bin $(DESTBIN)/$(PROGRAM); \
447 chmod 755 $(DESTBIN)/$(PROGRAM); fi
448 @echo Installing $(DATA) and $(DATA).conc in $(DESTLIB)
449 @if [ ! -r $(DESTLIB) ]; then $(MKDIR) $(DESTLIB); fi
450 @if [ $(DESTLIB) != . ]; then \
451 cp $(DATA) $(DATA).conc $(DESTLIB); \
452 chown bin $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc; \
453 chgrp bin $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc; \
454 chmod 644 $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc; fi
455 @if [ ! -r $(DESTMAN) ]; then $(MKDIR) $(DESTMAN); fi
456 @echo Installing $(MAN) in $(DESTMAN1)
457 @if [ ! -r $(DESTMAN1) ]; then $(MKDIR) $(DESTMAN1); fi
458 @if [ $(DESTMAN1) != . ]; then \
459 cp $(MAN) $(DESTMAN1)/$(MAN); \
460 chown bin $(DESTMAN1)/$(MAN); \
461 chgrp bin $(DESTMAN1)/$(MAN); \
462 chmod 644 $(DESTMAN1)/$(MAN); fi
464 uninstall:; @echo Un-installing $(PROGRAM), $(DATA) and $(MAN)
465 rm -f $(DESTBIN)/$(PROGRAM)
466 rm -f $(DESTLIB)/$(DATA) $(DESTLIB)/$(DATA).conc
467 rm -f $(DESTMAN1)/$(MAN)
469 # update: $(DESTBIN)/$(PROGRAM) $(DESTLIB)/$(DATA)
473 ###############################################################################
474 # Header DEPENDENCIES
475 ###############################################################################
477 $(PROGRAM).o: brl.h tsl.h util.h version.h
478 brl.o: brl.h tsl.h util.h
480 buildcmp.o: tsl.h util.h
481 makeconcfile.o: tsl.h util.h
482 brl-index.o: brl-startverse.h brl-startchapter.h