#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab ft=make
#-----------------------------------------------------------------------------#
# Copyright (C) 1997-2000, 2003, 2006 The University of Melbourne.
# Copyright (C) 2015, 2020, 2022, 2025 The Mercury team.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#

# extras/odbc/Mmakefile - Mmake file for building the ODBC interface.

#-----------------------------------------------------------------------------#
# Configuration

# The driver manager.
# Legal values for MODBC_DRIVER are MODBC_IODBC, MODBC_UNIX, and MODBC_MS.
# Feel free to add more (and handle them in odbc.m).
MODBC_DRIVER=MODBC_UNIX

# The database.
# Legal values for MODBC_DB are MODBC_MYSQL and MODBC_SQL_SERVER.
# Feel free to add more (and handle them in odbc.m).
MODBC_DB = MODBC_MYSQL

# Pathname for iODBC (only for MODBC_IODBC)
#IODBC_DIR=

# Pathname for the ODBC SDK (only for MODBC_MS)
ODBC_SDK_DIR=/odbcsdk

INSTALL_PREFIX := $(INSTALL_PREFIX)/extras

-include ../Mmake.params

# Do not issue a warning because mercury_odbc does not export anything.
MCFLAGS-mercury_odbc = --no-warn-nothing-exported --no-warn-interface-imports

#-----------------------------------------------------------------------------#

ifeq ($(MODBC_DRIVER),MODBC_MS)
	ODBC_INCL_DIR=$(ODBC_SDK_DIR)/include
	MLLIBS=-lodbc32
else
	#ODBC_LIB_DIR=$(IODBC_DIR)/lib
	#ODBC_INCL_DIR=$(IODBC_DIR)/include

	# The following are for Debian.

	# for unixODBC
	MLLIBS=-lodbc -lpthread -lltdl -ldl

	# for iODBC
	# MLLIBS=-liodbc -lpthread -ldl
	# note: on a DEC Alpha using OSF1 remove the -ldl.
endif

MAIN_TARGET=odbc_test

.PHONY: depend
depend: odbc_test.depend

.PHONY: check
check:
	true

#-----------------------------------------------------------------------------#

MGNUCFLAGS=-D$(MODBC_DRIVER) -D$(MODBC_DB) -I$(ODBC_INCL_DIR)

#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
