###############################################################################
#
# GISH Shared Function Library
#
# getopt.c is (C) Copyright by the Regents of the University of California.
# See that file for specific copyright information.
#
# Curator:  Warren Gish, gish *AT* watson.wustl.edu
###############################################################################
#
# This software depends on the NCBI coretool library.  Make sure a proper
# ncbilcl.h file has been installed for your platform in the coretool library
# before attempting to make this library.

# Point NCBI to the directory containing the ncbi libraries
NCBI = ../ncbi
RANLIB = bin/ranlib
ARFLAGS = cru
GISHLIB = lib/libgish.a
CC = cc
CCOPT = -O
MKDEPFLAG = -M
# Unbundled Sun C compiler is different
#MKDEPFLAG = -xM
INCLUDE = -I../include -I../ncbi/include
LINKS = ncbi

all: comp/dfa comp/fct comp/mem comp/misc comp/str comp/sys always

dfa: comp/dfa always
fct: comp/fct always
mem: comp/mem always
misc: comp/misc always
str: comp/str always
sys: comp/sys always

always:
	$(RANLIB) $(GISHLIB)

ncbi:
	ln -s $(NCBI) .

comp/dfa comp/fct comp/mem comp/misc comp/str comp/sys: $(LINKS)
	cd $(@F); $(MAKE) $(MFLAGS) CC="$(CC)" CCOPT="$(CCOPT)" INCLUDE="$(INCLUDE)" GISHLIB="../$(GISHLIB)" ARFLAGS="$(ARFLAGS)"

depend: dep/dfa dep/fct dep/mem dep/misc dep/str dep/sys

dep/dfa dep/fct dep/mem dep/misc dep/str dep/sys: $(LINKS)
	cd $(@F); $(MAKE) $(MFLAGS) depend CC="$(CC)" MKDEPFLAG="$(MKDEPFLAG)" INCLUDE="$(INCLUDE)"

clean: clean/dfa clean/fct clean/mem clean/misc clean/str clean/sys
	- rm -f $(LINKS) $(GISHLIB)

clean/dfa clean/fct clean/mem clean/misc clean/str clean/sys:
	cd $(@F); $(MAKE) $(MFLAGS) clean

