1# pgtclng/Makefile for MinGW32
2# $Id: mingw.mak 385 2014-09-12 21:57:05Z lbayuk $
3# This is a simple Makefile for building pgtclng using the MinGW tools on
4# Windows.
5# You must edit the PGSQL and TCL symbols below, at least, before using.
6#
7# This builds a stubs-enabled DLL for pgtcl-ng. If you want a non-stubs-
8# enabled version, remove the definition of USE_TCL_STUBS and change the
9# TCLLIB definition below.
10#
11# When loading the built libpgtcl.dll into a Tcl shell or application,
12# libpq.dll must be on your PATH.
13
14PACKAGE_VERSION = 2.1.1
15
16# Path to PostgreSQL top-level installation directory:
17PGSQL=e:/local/pgsql
18
19# Path to Tcl installation base directory:
20TCL=c:/local/tcl8.6
21# Tcl stub library name:
22TCLLIB=tclstub86
23
24# PostgreSQL version tests:
25# These require PostgreSQL-9.3.x and higher:
26PG93DEFS=\
27 -DHAVE_LO_TELL64=1\
28 -DHAVE_PQESCAPELITERAL=1
29
30# These require PostgreSQL-8.3.x and higher:
31PG83DEFS=\
32 -DHAVE_LO_TRUNCATE=1\
33 -DHAVE_PQDESCRIBEPREPARED=1\
34 -DHAVE_PQENCRYPTPASSWORD=1\
35 -DHAVE_PQESCAPEBYTEACONN=1\
36 -DHAVE_PQESCAPESTRINGCONN=1
37
38# Uncomment to configure for PostgreSQL-9.3.x or higher:
39PGDEFS=$(PG83DEFS) $(PG93DEFS)
40# Uncomment to configure for PostgreSQL-8.3.x through 9.2.x:
41#PGDEFS=$(PG83DEFS)
42# If you are building with a version older than PostgreSQL-8.3.0, you
43# are on your own. (8.2.x and older are unsupported by the PostgreSQL
44# project as of Dec 2011.)
45
46# Stubs enabled:
47STUBS=-DUSE_TCL_STUBS
48
49# ===========================
50
51PG_INCLUDES = -I"$(PGSQL)/include"
52PG_LIBS = -L"$(PGSQL)/lib" -lpq
53TCL_INCLUDES = -I"$(TCL)/include"
54TCL_LIBS = -L"$(TCL)/lib" -l$(TCLLIB)
55OBJS = pgtcl.o pgtclCmds.o pgtclId.o pgtclres.o
56
57CC = gcc
58CFLAGS_EXTRA = -O2 -Wall
59# Note: enable-runtime-pseudo-reloc-v2 option is via the MinGW mailing
60# list. Without it, programs crash when calling PQisnonblocking.
61# enable-auto-import avoids a warning related to that same function.
62LDFLAGS_EXTRA = -Wl,-enable-runtime-pseudo-reloc-v2 -Wl,-enable-auto-import
63
64# Note: Tcl includes must be first, because EnterpriseDB ships tcl.h
65# from a possibly older version of Tcl inside the PostgreSQL includes dir.
66INCLUDES =  $(TCL_INCLUDES) $(PG_INCLUDES)
67
68DEFS = -DPACKAGE_VERSION=\"$(PACKAGE_VERSION)\" $(PGDEFS) $(STUBS)
69
70CFLAGS = $(CFLAGS_EXTRA) $(INCLUDES) $(DEFS)
71
72LDFLAGS = $(LDFLAGS_EXTRA)
73
74all: dll
75
76dll: $(OBJS)
77	$(CC) -shared -o libpgtcl.dll $(LDFLAGS) $(OBJS) $(TCL_LIBS) $(PG_LIBS)
78
79pgtclres.o: pgtclres.rc
80	windres pgtclres.rc pgtclres.o
81
82clean:
83	-erase $(OBJS)
84