# make -f Makefile.ldap
#
# Lib options. Some system require different LIBS

include config.$(config)
include Makefile_$(FIX_OBJ)_fix_obj

#There are a number of example LIBS values here. The default value usually works.
#You may be required to edit the paths in -I and/or -L
#
#LIBS = -L./ -lmysqlclient -lcrypt
#LIBS = -L./ -lmysqlclient -lcrypt -lz
#LIBS = -L/usr/lib/mysql -lmysqlclient -lcrypt -lz
#
# For MYSQL4 users will need to use one of the following
#LIBS = -L/usr/lib/mysql -lmysqlclient -lcrypt -lz 
#LIBS = -L./ -lmysqlclient -lcrypt -lz 
#LIBS = -L/usr/local/mysql-standard-4.0.18-pc-linux-i686/lib/ -lmysqlclient -lcrypt -lz
#LIBS = -L/usr/lib/mysql/ -lmysqlclient -lcrypt -lz -lm -lc -lnsl
#
# For MYSQL4 for Solaris systems
#LIBS = -L/usr/local/mysql/lib/ -lmysqlclient -lcrypt -lz -lm -lc -lsocket -lnsl
#
# Use the following for Mac O/S - 10.2.6
#LIBS = -L/usr/local/opt/mariadb/lib/ -L/usr/local/opt/mariadb/include/mysql/ -lmysqlclient -lz
# -lz <-- use this instead of -lcrypt for the mac OSX
#
#CFLAGS = -Dunix -Dunix_password -DMYSQLAUTH
#CFLAGS = -Dunix -Dunix_password -DMYSQLAUTH -DENABLE_MD5 -DMYSQL4
#CFLAGS = -I/usr/local/mysql-standard-4.0.18-pc-linux-i686/include/ -Dunix -Dunix_password -DMYSQLAUTH -DENABLE_MD5 -DMYSQL4
#CFLAGS = -I/usr/include/mysql/ -Dunix -Dunix_password -DMYSQLAUTH -DENABLE_MD5 -DMYSQL4
#
# FreeBSD 5.x
#CFLAGS = -I/usr/local/mysql/include/mysql -Dunix -Dunix_password -DMYSQLAUTH -DMYSQL4 -DENABLE_MD5 -DHAS_SYS_TYPE -DBSD
#CFLAGS_SLY_ADD = -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/ -I./mysql/ -I/opt/local/include/openssl/ -I/usr/local/Cellar/mariadb/10.8.3_1/include/mysql/ 
#CFLAGS_SLY_ADD = -Du_char="unsigned char" -Du_int="unsigned int" -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/ -I./mysql/ -I/opt/local/include/openssl/ -I/usr/local/Cellar/mariadb/10.8.3_1/include/mysql/ 
CFLAGS_SLY_ADD = -I/opt/local/include/openssl/ -I./mysql/ -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/ 
#LIBS = $(MYSQL_LIBS) -lpthread  -lcrypt  -lm -ldl -lrt
LIBS = $(MYSQL_LIBS) -lmysqlclient -lz -lpthread -lm -ldl 
#CFLAGS = -ggdb $(XFLAGS)  -Dunix -Dunix_password -DMYSQLAUTH -DENABLE_MD5 -DMYSQL5 -DMYSQL4 $(CFLAGS_ADD)
CFLAGS = -ggdb $(XFLAGS) -Dunix -Dunix_password -DMYSQLAUTH -DENABLE_MD5 -DMYSQL5 -DMYSQL4 $(CFLAGS_SLY_ADD) $(CFLAGS_ADD) 
CC = gcc

AUTH_OBJ = 	auth.o ld_sha.o base64.o newcrypt.o sha2.o
ADTS_OBJ = 	../sam/md5.o

# rules to build  
all: clean mysql
	$(CC) -o mysqlauth $(CFLAGS) $(AUTH_OBJ) $(ADTS_OBJ) $(LIBS)
	echo "Done!"

mysql: $(AUTH_OBJ) $(ADTS_OBJ)
	$(CC) -o mysqlauth $(CFLAGS) $(CFLAGS_SLY_ADD) $(AUTH_OBJ) $(ADTS_OBJ) $(LIBS)

clean:
	rm -f *.o *~ 

#mysql: $(AUTH_OBJ) $(ADTS_OBJ)
#	$(CC) -o mysqlauth $(CFLAGS) $(AUTH_OBJ) $(ADTS_OBJ) $(LIBS)
