
# .include "Version.mk"
# .include "Config.mk"
include Version.mk
include Config.mk
#==============================================================================
# Makefile
#
# UNIX Makefile to build the CLI for PostgreSQL/Postgres95
#
#==============================================================================
# Site specific configuration (UNIX)
#==============================================================================
#
# option switches
#
# debug: select this to enable debugging of the software
#DEBUG          = -D_DEBUG
#
#==============================================================================

#---| definitions |------------------------------------------------------------

# NAME	= cli
NAME	= psqlodbc

OBJECTS	= info.o bind.o columninfo.o connection.o convert.o drvconn.o \
	environ.o execute.o lobj.o misc.o options.o \
	pgtypes.o psqlodbc.o qresult.o results.o socket.o statement.o \
	gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX)

#CFLAGS	= -c $(DEBUG) -D$(PG_ENV) -O $(PIC) $(ANSI) -I$(PG_INCLUDE) \
# -I$(ODBC_INCLUDE) -D$(DLDAPI) $(CFLAGSX) -DHAVE_CONFIG_H \
# -DVERSION=\"$(VERSION)$(EXTVER)\"
CFLAGS	= -g -c -Wall $(DEBUG) -O $(PIC) $(ANSI) -I. -I.. \
 -I$(PG_INCLUDE) -I$(ODBC_INCLUDE) $(CFLAGSX) -DHAVE_CONFIG_H 

shlib = lib$(NAME)-$(VERSION).$(DLSUFFIX)
DESTDIR = /usr/local
LIBDIR = /lib

#---| global dependencies |----------------------------------------------------

#all:   $(OBJECTS) lib dll

all:	$(OBJECTS) dll

clean:
	-rm -f core *.o *~ *.core

delete: clean

delete_all:	delete
	-rm -f /usr/local/lib/lib$(NAME)_$(MSQL_ENV).a
	-rm -f /usr/local/lib/lib$(NAME)_$(MSQL_ENV).$(DLSUFFIX)

#---| local dependencies |-----------------------------------------------------
#log.o:  ../SRC_LOG/log.c ../SRC_LOG/log.h
#	$(CC) $(CFLAGS) -I../SRC_LOG ../SRC_LOG/log.c

lib:
	$(AR) lib$(NAME)$(PG_ENV).a $(OBJECTS)
	$(RANLIB) lib$(NAME)$(PG_ENV).a

dll:	$(OBJECTS)
	$(LD) $(LDFLAGS) -L$(PG_LIBPATH) $(OBJECTS) \
	-o $(shlib) $(LIBS) $(PG_LIBS)

install-shlib: $(shlib)
	$(INSTALL_DATA) $(shlib) $(DESTDIR)$(LIBDIR)/$(shlib)
	rm -f $(DESTDIR)$(LIBDIR)/lib$(NAME).so
	ln -sf $(shlib) $(DESTDIR)$(LIBDIR)/lib$(NAME).so

install-headers: $(INSTHEADERS)
	if [ -d $(DESTDIR)$(INCDIR)/iodbc ]; then : ; else $(MKDIR) $(DESTDIR)$(INCDIR)/iodbc; fi
	$(INSTALL_DATA) $(INSTHEADERS) $(DESTDIR)$(INCDIR)/iodbc

install-ini: odbcinst.ini
	$(INSTALL_DATA) odbcinst.ini /etc

install: install-headers install-shlib install-ini

#==============================================================================


