

CC_FLAGS= $(CFLAGS) $(SIGLIST) $(DIRENT) $(MMAP) $(FAST_MALLOC) $(MSG_LANG) -DINST_DIR='"$(INST_DIR)"' -DTARGET='"$(TARGET)"' $(WORKING_RLIMIT)
CC_OPT= -g 

YACC_FLAGS= -d
LD_LIBS= $(LDLIBS)

!yacc msql_yacc.y

!object msql_proc.o msql_proc.c 
!object msqldb.o msqldb.c 
!object msqld.o msqld.c 
!object acl.o acl.c 
!object cra.o cra.c 
!object msql_lex.o msql_lex.c
!object index.o index.c
!object types.o types.c
!object regex.o regex.c
!object varchar.o varchar.c
!object memory.o memory.c
!object table.o table.c
!object select.o select.c
!object sort.o sort.c
!object distinct.o distinct.c
!object sysvar.o sysvar.c
!object funct.o funct.c
!object avl_tree.o avl_tree.c

#
# We don't need an !object call for net.c as net.o is made from the
# !library call below
# 

!library libmsql.a libmsql.c,net.c,config.c,time.c ../common/strlib.o,../common/tmpnam.o,../common/strerror.o,../common/strptime.o,../common/snprintf.o


all: ../lib/libmsql.a

../lib/libmsql.a : libmsql.a
	rm -f ../lib/libmsql.a
	ln -s ../msql/libmsql.a ../lib/libmsql.a
	$(RANLIB) ../lib/libmsql.a

!object msqladmin.o msqladmin.c
!program msqladmin msqladmin.o,acl.o,libmsql.a

!object msql.o msql.c
!program msql msql.o,libmsql.a

!object msqldump.o msqldump.c
!program msqldump msqldump.o,libmsql.a

!object msqlexport.o msqlexport.c
!program msqlexport msqlexport.o,libmsql.a

!object msqlimport.o msqlimport.c
!program msqlimport msqlimport.o,libmsql.a

!object relshow.o relshow.c 
!program relshow relshow.o,libmsql.a

!object insert_test.o insert_test.c 
!program insert_test insert_test.o,libmsql.a

!object select_test.o select_test.c 
!program select_test select_test.o,libmsql.a

!program msql2d msqld.o,msql_yacc.o,msql_lex.o,msql_proc.o,net.o,msqldb.o,acl.o,index.o,types.o,regex.o,varchar.o,memory.o,table.o,select.o,cra.o,sort.o,distinct.o,sysvar.o,funct.o,avl_tree.o ../common/debug.o,-lregexp,libmsql.a

msql2d: libmsql.a

msqld-clean:
	rm -f msqld.o msql_yacc.o msql_lex.o msql_proc.o net.o \
	msqldb.o 

!install msql $(INST_DIR)/bin/msql 0755
!install msql2d $(INST_DIR)/bin/msql2d 0750 $(ROOT)
!install msqladmin $(INST_DIR)/bin/msqladmin 0750 $(ROOT)
!install msqlexport $(INST_DIR)/bin/msqlexport 0750 $(ROOT)
!install msqlimport $(INST_DIR)/bin/msqlimport 0750 $(ROOT)
!install relshow $(INST_DIR)/bin/relshow 0755 $(ROOT)
!install msqldump $(INST_DIR)/bin/msqldump 0755 $(ROOT)
!libinstall libmsql.a $(INST_DIR)/lib/libmsql.a 744 $(ROOT)
!install msql.h $(INST_DIR)/include/msql.h 744 $(ROOT)
!install sample.acl $(INST_DIR)/msql.acl.sample 700 $(ROOT)

lextest :: msql_lex.c
	$(CC) $(CC_FLAGS) -DDEBUG msql_lex.c -o lextest


msql_proc.o: ../common/debug.h 
msql_proc.o: ../common/portability.h 
msql_proc.o: ../common/config.h
msql_proc.o: msql_priv.h 
msql_proc.o: version.h 
msql_proc.o: msql.h 

msqldb.o: ../common/debug.h 
msqldb.o: ../common/portability.h 
msqldb.o: ../common/config.h
msqldb.o: msql_priv.h 
msqldb.o: version.h 
msqldb.o: msql.h 

msqld.o: ../common/debug.h 
msqld.o: ../common/portability.h 
msqld.o: ../common/config.h
msqld.o: msql_priv.h 
msqld.o: version.h 
msqld.o: msql.h 

table.o: ../common/debug.h 
table.o: ../common/portability.h 
table.o: ../common/config.h
table.o: msql_priv.h 
table.o: version.h 
table.o: msql.h 

select.o: ../common/debug.h 
select.o: ../common/portability.h 
select.o: ../common/config.h
select.o: msql_priv.h 
select.o: version.h 
select.o: msql.h 

index.o: ../common/debug.h 
index.o: ../common/portability.h 
index.o: ../common/config.h
index.o: msql_priv.h 
index.o: version.h 
index.o: msql.h 

sysvar.o: ../common/debug.h 
sysvar.o: ../common/portability.h 
sysvar.o: ../common/config.h
sysvar.o: msql_priv.h 
sysvar.o: version.h 
sysvar.o: msql.h 

types.o: ../common/debug.h 
types.o: ../common/portability.h 
types.o: ../common/config.h
types.o: msql_priv.h 
types.o: version.h 
types.o: msql.h 

libmsql.o: ../common/debug.h 
libmsql.o: ../common/portability.h 
libmsql.o: ../common/config.h
libmsql.o: msql_priv.h 
libmsql.o: version.h 
libmsql.o: msql.h 

msql.o: ../common/debug.h 
msql.o: ../common/portability.h 
msql.o: ../common/config.h
msql.o: msql_priv.h 
msql.o: version.h 
msql.o: msql.h 

