home *** CD-ROM | disk | FTP | other *** search
Makefile | 1991-10-09 | 7.3 KB | 234 lines |
- #!/bin/make -f
-
- # Copyright (c) 1986, Greg McGary
- # @(#)makefile 1.3 86/11/06
-
- # --------------------------------------------------------------------
- # System Dependent Configuration:
- # Choose a pre-packaged set of options below, or roll your own.
- # The relevant options are as follows:
- #
- # * If you have the `PW' library which includes the regular-expression
- # funcions regcmp(3) and regex(3), then use `-DREGEX' in DEFS, and
- # `-lPW' in LIBS. If you have the regular-expression functions
- # re_comp(3) and re_exec(3), use `-DRE_EXEC' in DEFS. If you don't
- # have any regular-expression functions, don't add either to DEFS.
- #
- # * If you do not have the 4.2 directory access libraries, add `-lndir'
- # to LIBS, and define `-DNDIR' in DEFS.
- #
- # * If your string libraries have index(3) and rindex(3) instead of
- # strchr(3) and strrchr(3), use `-DRINDEX' in DEFS.
- #
- # * If your compiler chokes on pointers to functions returning void,
- # use `-Dvoid=int' in DEFS.
- #
- # * If you have setlinebuf(3) in your stdio to set line-buffering on
- # a stream, use `-DERRLINEBUF' in DEFS.
- #
- # * If you have a System-III/V terminal driver, define `TERMIO' in DEFS.
- #
- # * If you have ranlib(1), define `RANLIB' as such. If you don't have
- # it, set `RANLIB' to something harmless like `@:', or `echo'
- #
- # * If you want lists of file names compressed with csh {} notation by
- # default, set -DCRUNCH_DEFAULT=1. If you want files printed with no
- # "crunching", set -DCRUNCH_DEFAULT=0. (The -k and -g options allow
- # runtime control regardless of the builtin default).
- #
- # * If your system supports the alloca() function for allocating space
- # on the stack, defined -DUSE_ALLOCA
- # --------------------------------------------------------------------
-
- DEFS = -Dvoid=int -DREGEX -DTERMIO # typical System-V defs
- # DEFS = -DREGEX -DNDIR -DTERMIO # typical System-V defs
- # DEFS = -Dvoid=int -DRINDEX -DRE_EXEC -DNDIR # typical V7 defs
- # DEFS = -Dvoid=int -DRINDEX -DRE_EXEC -DERRLINEBUF # BSD defs
-
- LIBS = -lc -lPW # typical System-V libs
- # LIBS = -lndir -lPW # typical System-V libs
- # LIBS = -lndir # typical V7 libs
- # LIBS = # typical BSD libs (none)
-
- RANLIB = @: # system doesn't have ranlib (Sys-V)
- # RANLIB = ranlib # system has ranlib (typically V7 & BSD)
-
- CRUNCH = -DCRUNCH_DEFAULT=1 # Original default - crunch file names
- #CRUNCH = -DCRUNCH_DEFAULT=0 # Don't crunch names by default
-
- ALLOCA = -DUSE_ALLOCA # alloca support exists on system
- #ALLOCA = # system has no alloca() function
-
- # --------------------------------------------------------------------
- # Compilation / Loading options:
- # Choose options to generate a system as an installed product,
- # for debugging, or for performance profiling.
- # --------------------------------------------------------------------
-
- # CCFLG = -g -DDEBUG # debugging
- # CCFLG = -p # profiling
- CCFLG = -O3 -g # production
-
- # LDFLG = -g # debugging
- # LDFLG = -p # profiling
- LDFLG = # production
-
- CC = hc
-
- # --------------------------------------------------------------------
-
- SHELL = /bin/ksh
- TARGETS = libid.a $(PROGS)
- PROGS = mkid lid idx fid iid $(LIDLINKS)
- DESTINATION_DIR = /usr/local
- MANDIR = /usr/catman/local_man/man1
-
- LIDLINKS = gid aid eid pid
- CFLAGS = $(CCFLG) -I. $(DEFS) $(CRUNCH) $(ALLOCA)
- LDFLAGS = $(LDFLG) libid.a $(LIBS)
-
- OFILES = init.o getscan.o scan-c.o scan-asm.o bsearch.o hash.o \
- bitops.o basename.o gets0.o getsFF.o paths.o opensrc.o \
- stoi.o uerror.o document.o bitcount.o wmatch.o bitsvec.o \
- tty.o bzero.o scan-text.o cannoname.o kshgetwd.o unsymlink.o
-
- TEXJUNK=id.aux id.cp id.cps id.dvi id.fn id.fns id.ky id.kys id.log id.pg \
- id.pgs id.toc id.tp id.tps id.vr id.vrs id-info
-
- # --------------------------------------------------------------------
-
- all: $(TARGETS)
-
- libid.a: $(OFILES)
- ar rv $@ $?
- $(RANLIB) $@
-
- mkid: mkid.o libid.a
- $(CC) -o $@ $@.o $(LDFLAGS)
-
- fid: fid.o libid.a
- $(CC) -o $@ $@.o $(LDFLAGS)
-
- lid: lid.o libid.a
- $(CC) -o $@ $@.o $(LDFLAGS)
-
- idx: idx.o libid.a
- $(CC) -o $@ $@.o $(LDFLAGS)
-
- iid: iid.o iidfun.o
- $(CC) -o iid iid.o iidfun.o $(LDFLG) $(LIBS)
-
- iid.c: iid.y
- rm -f iid.c
- yacc iid.y
- mv y.tab.c iid.c
-
- iidfun.o: iidfun.c iiddef.h
-
- iid.o: iid.c iiddef.h
- $(CC) $(CFLAGS) -DDEF -c iid.c
-
- $(LIDLINKS): lid
- -/bin/rm -f $@
- ln lid $@
-
- install: installbin installman
-
- installman: fid.1 iid.1 lid.1 mkid.1
- cp fid.1 iid.1 lid.1 mkid.1 $(MANDIR)
- cd $(MANDIR) ; rm -f fid.1.z iid.1.z lid.1.z mkid.1.z aid.1.z \
- gid.1.z eid.1.z
- cd $(MANDIR) ; chmod 666 fid.1 iid.1 lid.1 mkid.1
- cd $(MANDIR) ; mantocatman fid.1
- cd $(MANDIR) ; mantocatman iid.1
- cd $(MANDIR) ; mantocatman lid.1
- cd $(MANDIR) ; mantocatman mkid.1
- cd $(MANDIR) ; rm -f fid.1 iid.1 lid.1 mkid.1
-
- installbin: $(PROGS)
- chmod 777 $(PROGS)
- -mv $(DESTINATION_DIR)/mkid $(DESTINATION_DIR)/OLDmkid
- -mv $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/OLDlid
- -mv $(DESTINATION_DIR)/idx $(DESTINATION_DIR)/OLDidx
- -mv $(DESTINATION_DIR)/fid $(DESTINATION_DIR)/OLDfid
- -mv $(DESTINATION_DIR)/gid $(DESTINATION_DIR)/OLDgid
- -mv $(DESTINATION_DIR)/aid $(DESTINATION_DIR)/OLDaid
- -mv $(DESTINATION_DIR)/eid $(DESTINATION_DIR)/OLDeid
- -mv $(DESTINATION_DIR)/pid $(DESTINATION_DIR)/OLDpid
- -mv $(DESTINATION_DIR)/iid $(DESTINATION_DIR)/OLDiid
- -rm -f $(DESTINATION_DIR)/iid.help
- cp mkid $(DESTINATION_DIR)/mkid
- cp lid $(DESTINATION_DIR)/lid
- cp idx $(DESTINATION_DIR)/idx
- cp fid $(DESTINATION_DIR)/fid
- cp iid $(DESTINATION_DIR)/iid
- cp iid.help $(DESTINATION_DIR)/iid.help
- chmod 444 $(DESTINATION_DIR)/iid.help
- ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/gid
- ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/aid
- ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/eid
- ln $(DESTINATION_DIR)/lid $(DESTINATION_DIR)/pid
-
- clean:
- rm -f $(TARGETS) *.o iid.c core a.out $(TEXJUNK)
-
- id.tar:
- cd ..; tar cvbf 20 id/id.tar id/*.[ch1-8] id/makefile id/TODO id/TUTORIAL
-
- id.tar.Z: id.tar
- compress -b 14 <id.tar >id.tar.Z
-
- id.shar: id.shar-1 id.shar-2 id.shar-3
-
- id.shar-1:
- shar $(SHARFLAGS) TUTORIAL TODO makefile *.h *.[1-8] >$@
-
- id.shar-2:
- shar $(SHARFLAGS) [a-l]*.c >$@
-
- id.shar-3:
- shar $(SHARFLAGS) [m-z]*.c >$@
-
- debug:
- make CCFLG='-g -DDEBUG' LDFLG='-g'
-
- ID::
- /bin/rm -f ID
- mkid *.[chy]
-
- TAGS::
- /bin/rm -f TAGS
- etags -tw *.[chy]
-
- # TeX stuff - these actions count on several things being installed on
- # your system:
- #
- # tex - the document processor
- # texinfo.tex - the texinfo macro package used to format the document
- # texindex - the index sorting program used to generate the index
- # makeinfo - the program to turn texinfo files into online documentation
- #
- # A tex distribution tape can be obtained from the University of Washington.
- # send email to: elisabet@max.u.washington.edu for more info.
- #
- # The other texinfo tools are part of the Gnuemacs distribution and can
- # be obtained via FTP from prep.ai.mit.edu
-
- # Make the online info file by running makeinfo - texinfo-format-buffer from
- # within emacs probably will not work very well.
- id-info: id.texinfo
- makeinfo id.texinfo
-
- # If you are running TeX from a clean directory, need to run once to get
- # the initial .aux file with the cross reference info in it.
- id.aux: id.texinfo
- tex id.texinfo
- texindex id.??
-
- # Running TeX twice here is probably overkill, but it makes absolutely sure
- # the index agrees with the actual location of text.
- id.dvi: id.aux
- tex id.texinfo
- texindex id.??
- tex id.texinfo
-