#  %W% %G%
#################################################################
############### acedb: R.Durbin and J.Thierry-Mieg ##############
############### wext/makefile.ext  Feb 1998        ##############
#################################################################
#
# ATTENTION:
#   Define in this file machine independant directives
#   to compile external codes linked against acelib
#
#   The makefile is decomposed into 2 parts
#     makefile: which selects the machine and creates ./bin.*
#     then copies the present file into ../bin.*
#     and the present file which gives details on the linking
#  
#   Machine specific choices, like linker and compiler
#     are specified in ../wmake/*_DEF
#
#   Object modules and exe are created in ../bin.*
#     to keep the present directory clean and allow
#     multiple architectures
#
#################################################################
# Before running the make command
# setenv ACEDB_MACHINE to indicate one of the predefined
# Machine dependant option files, or write your own.
# These files are called  $(ACEDB_SRC)/wmake/$(ACEDB_MACHINE)_DEF
#
# See the explanation at the top of ../wmake/truemake
#################################################################

COMPI = $(COMPILER)  -DACEDB -D$(NAME)  -I ../wh  -I../wac -I.

# LINK_ACC is the set of object files needed if you use
# the client version of the new Ace C library

LINK_ACC=libaccl.a libfree.a  libtsfree.a $(LINK_ACC_RPC)

# LINK_ACS is the set of object files needed if you use
# the standalone acinside version of the new Ace C library

LINK_ACS=libace.a libfree.a libtsfree.a

ACCLIBS =  $(LIBS) -L. libaccl.a libacecl.a libfree.a libtsfree.a

.KEEP_STATE: 
## Different platforms use CC or COMPILE.c
CC =        $(COMPI)  -c
COMPILE.c = $(COMPI)  -c


# suppress auto SCCS extraction
.SCCS_GET:

#define defaults  overridable in $(ACEDB_MACHINE)_DEF
RANLIB_NEEDED = true	
AR_OPTIONS = rlu

LINKER = cc
COMPILER = cc

CCFLAGS =  ## to undefine any rubbish
GCFLAGS =  ## to undefine any rubbish

#################################################################
# most versions of lex require you to use -ll
# but not Linux - reset LEX_LIBS in $(ACEDB_MACHINE)_DEF file

LEX_LIBS = -ll

#################################################################
# include your choice from a machine dependant file
# do not edit the present makefile for this purpos
# this simplifies multiple architecture maintainance

include deffile

# Note that you can keep different DEF files for the same machine
# setting  various compiler  options

###########################################################
##  Compiler and library options
## CC, LIBS, NAME are defined in $(ACEDB_MACHINE)_DEF
##
 
IDIR = -I. -I.. -I../wh
# Do not use -I/usr/include
# it prevents gcc from picking up its own includes
# (cc goes to /usr/include anyway)

## to undefine any rubbish
CCFLAGS =
GCFLAGS =

## Different platforms use CC or COMPILE.c
#  (USEROPTS - see comments at top of file)
#
CC =        $(COMPILER) $(USEROPTS) $(IDIR) -D$(NAME) -c
COMPILE.c = $(COMPILER) $(USEROPTS) $(IDIR) -D$(NAME) -c


#################################################################
#################################################################
# Add here your definitions
#################################################################
#################################################################

ALL_ACC_OBJS = kscount.o 

ALL_ACC_SOURCES =  $(ALL_ACC_OBJS:.o=.c)

$(ALL_ACC_SOURCES) :
	ln -s ../wacext/$@ . 

# "all" should always be the first target so that it is the default make action.
all : kscount skscount 


kscount: kscount.o  $(LINK_ACC)
	$(LINKER) -o $@ kscount.o $(LINK_ACC) $(LIBS) $(LEX_LIBS) 

skscount: kscount.o  $(LINK_ACS)
	$(LINKER) -o $@ kscount.o $(LINK_ACS) $(LIBS) $(LEX_LIBS)


# for the acedb libs, rely on the satndard acedb makefile
libaccl.a libace.a libfree.a  libtsfree.a:
	cd ..
	make $@

#$(target): $(target).o libace.a
#	$(LINKER) -o $@  $@.o  $(ACELIBS)

###########################################################
########### end of     acedb makefile.ext  ################
###########################################################
 
