# 
# ========================================================================
# CORAL 
#   Copyright R. Ramakrishnan and The CORAL Group, 
# University of Wisconsin at Madison.
# 1992 All Rights Reserved.
# Version 0.1
# ========================================================================
#
#
#
# ------------------------------------------------------------------------
# CORAL Version 0.1
# RESEARCH SOFTWARE DISCLAIMER -------------------------------------------
# ------------------------------------------------------------------------
#
#    As unestablished, research software, this program is provided free of 
#    charge on an "as is" basis without warranty of any kind, either 
#    express or implied.  Acceptance and use of this program constitutes 
#    the user's understanding that she will have no recourse for any 
#    actual or consequential damages, including, but not limited to, 
#    lost profits or savings, arising out of the use of or inability to 
#    use this program.  
#
# ------------------------------------------------------------------------
# USER AGREEMENT ---------------------------------------------------------
# ------------------------------------------------------------------------
#
#     BY ACCEPTANCE AND USE OF THIS EXPERIMENTAL PROGRAM
#     THE USER AGREES TO THE FOLLOWING:
#
#     a.  This program is provided free of charge for the user's personal, 
#	 non-commercial, experimental use.
#
#     b.  All title, ownership and rights to this program and any copies 
#         remain with the copyright holder, irrespective of the ownership 
#	 of the media on which the program resides.
#
#     c.  The user is permitted to create derivative works to this program.  
#         However, all copies of the program and its derivative works must
#         contain the CORAL copyright notice, the UNESTABLISHED SOFTWARE 
#         DISCLAIMER and this USER AGREEMENT.
#
#     d.  The user understands and agrees that this program and any 
#         derivative works are to be used solely for experimental purposes 
#	 and are not to be sold or commercially exploited in any manner 
#	 WITHOUT EXPRESS WRITTEN PERMISSION.
#
#     e.  We request that the user supply us with a copy of any changes, 
#         enhancements, or derivative works which the user may create,
#	 with the user's permission to redistribute it.
#	 Copies of such material should be sent to:  CORAL@CS.WISC.EDU
#
# -------------------------------------------------------------------------

#
#  File of defaults to be included in all Makefiles
#
include	../make_include

CFLAGS=-I$(CORALROOT)/includes $(DFLAGS)
CPlusFlags=$(CFLAGS)

CPLUS_SRCS= annotations.C \
    apply.C \
    arg.C \
    arrays.C \
    backtrack.C \
    bitvector.C \
    builtin-rel.C \
    cor_error.C \
    database.C \
    db-builtin.C \
    derived-rel.C \
    dir.c \
    generic-index.C \
    generic-rel.C \
    gennum.C \
    grouping.C \
    hash-index.C \
    hash-rel.C \
    hashtab.C \
    hashtable.C \
    incr-loader.C \
    interface.C \
    interp.C \
    join.C \
    linked-rel.C \
    ordsearch.C \
    parse-actions.C \
    parse-utils.C \
    pipelined.C \
    profile.C \
    set-hash-cons.C \
    symbol.C \
    term.C \
    unparse.C \
    user-builtin1.C \
    user-builtin2.C \
    util.C
    
    
CPLUS_OBJS=\
    annotations.o \
    apply.o \
    arg.o \
    arrays.o \
    backtrack.o \
    bitvector.o \
    builtin-rel.o \
    cor_error.o \
    database.o \
    db-builtin.o \
    derived-rel.o \
    dir.o \
    generic-index.o \
    generic-rel.o \
    gennum.o \
    grouping.o \
    hash-index.o \
    hash-rel.o \
    hashtab.o \
    hashtable.o \
    incr-loader.o \
    interface.o \
    interp.o \
    join.o \
    linked-rel.o \
    ordsearch.o \
    parse-actions.o \
    parse-utils.o \
    pipelined.o \
    profile.o \
    set-hash-cons.o \
    symbol.o \
    term.o \
    unparse.o \
    user-builtin1.o \
    user-builtin2.o \
    util.o
    
FILES=y.tab.o lex.yy.o $(CPLUS_OBJS)
SRCS=gram.y scanner.l $(CPLUS_SRCS) coral-int.C
OTHERS=README Makefile hash.h hashfunc.h
# This is to help makedepend find include files.
OTHERINCLUDES=-I$(CPlusROOT)/include
LIBS=../bignum/BigNum.a -ll -lm

all: coral

coral: coral-int.o coral.o
#	$(CPlus) -N -o coral coral-int.o coral.o $(LIBS)
	$(CPlus) $(IMP_OPS) -o coral coral-int.o coral.o $(LIBS)
	chmod a+x coral

#this is too slow and painful to use !! 
libcoral.a: $(FILES)
	rm -f libcoral.a
	ar clqs libcoral.a $(FILES) ../persist/persist.o
	ranlib libcoral.a

coral.o : $(FILES) persist
#coral.o : $(FILES)
	ld -o coral.o -N -r $(FILES) ../persist/persist.o

persist : 
	(cd ../persist; make)

dir.o : dir.c
	$(CC) -c $(CFLAGS) dir.c

.C.o:
	$(CPlus) -c $(CPlusFlags) $*.C

y.tab.c y.tab.h: gram.y ../includes/arg.h \
	../includes/term.h ../includes/externs.h \
           ../includes/rules.h ../includes/generic-rel.h\
	   ../includes/collection.h ../includes/parser.h \
           ../includes/builtin-syms.h ../includes/parse-utils.h
	yacc -d gram.y

y.tab.o: y.tab.c
	$(CPlus) -c $(CPlusFlags) y.tab.c

lex.yy.c: scanner.l y.tab.h
	$(SCANNER) scanner.l

builtin-syms.hh: ../includes/builtin-syms.h
	../utils/encode-syms ../includes/builtin-syms.h >builtin-syms.hh

clean:
	rm -f *.o *~ core y.tab.c y.tab.h lex.yy.c libcoral.a builtin-syms.hh

depend:
	makedepend -- $(CFLAGS) -- $(SRCS) $(OTHERINCLUDES)

coq:  
	co -q RCS/*

col:  
	co -l $(CPLUS_SRCS) $(SRCS) $(OTHERS) 

co:  
	co RCS/*

ci:  
	ci $(CPLUS_SRCS) $(SRCS) $(OTHERS)

ciu:  
	ci -u $(CPLUS_SRCS) $(SRCS) $(OTHERS)

# DO NOT DELETE THIS LINE -- make depend depends on it.

