home *** CD-ROM | disk | FTP | other *** search
Makefile | 1990-12-28 | 5.6 KB | 189 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'
- # --------------------------------------------------------------------
-
- 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)
-
- # --------------------------------------------------------------------
- # 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)
- 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
-
- # --------------------------------------------------------------------
-
- 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
-
- 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:
- rm -f ../TOOLS/ID ../EXEC/ID ../SRC/ID
- cd ../TOOLS ; find ../SRC -name '*.[ch]' -print | mkid -v -
- ln ../TOOLS/ID ../EXEC/ID
- ln ../TOOLS/ID ../SRC/ID
-
- TAGS:
- rm -f ../TOOLS/TAGS ../EXEC/TAGS ../SRC/TAGS
- cd ../TOOLS ; find ../SRC -name '*.[ch]' -print | etags -twS
- ln ../TOOLS/TAGS ../EXEC/TAGS
- ln ../TOOLS/TAGS ../SRC/TAGS
-