2003-03-16 11:42:54 +01:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2004-07-13 02:06:46 +02:00
|
|
|
# Makefile for ecpg pgtypes library
|
2003-03-16 11:42:54 +01:00
|
|
|
#
|
2018-01-03 05:30:12 +01:00
|
|
|
# Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
|
2007-10-05 03:51:40 +02:00
|
|
|
# Portions Copyright (c) 1994, Regents of the University of California
|
2003-03-16 11:42:54 +01:00
|
|
|
#
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/interfaces/ecpg/pgtypeslib/Makefile
|
2003-03-16 11:42:54 +01:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
subdir = src/interfaces/ecpg/pgtypeslib
|
|
|
|
top_builddir = ../../../..
|
|
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
|
2014-07-14 20:07:52 +02:00
|
|
|
PGFILEDESC = "pgtypes - library for data type mapping"
|
2003-03-16 11:42:54 +01:00
|
|
|
NAME= pgtypes
|
2007-10-03 15:20:19 +02:00
|
|
|
SO_MAJOR_VERSION= 3
|
2016-08-16 19:58:44 +02:00
|
|
|
SO_MINOR_VERSION= $(MAJORVERSION)
|
2003-03-16 11:42:54 +01:00
|
|
|
|
2007-09-27 21:53:44 +02:00
|
|
|
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
|
2015-04-25 01:29:09 +02:00
|
|
|
-DFRONTEND $(CPPFLAGS)
|
2005-12-06 06:26:21 +01:00
|
|
|
override CFLAGS += $(PTHREAD_CFLAGS)
|
2004-04-30 06:14:06 +02:00
|
|
|
|
2005-12-06 06:26:21 +01:00
|
|
|
# Need to recompile any libpgport object files
|
|
|
|
LIBS := $(filter-out -lpgport, $(LIBS))
|
2004-10-04 22:36:12 +02:00
|
|
|
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
SHLIB_LINK += $(filter -lm, $(LIBS))
|
2003-03-16 11:42:54 +01:00
|
|
|
|
2008-02-26 07:41:24 +01:00
|
|
|
SHLIB_EXPORTS = exports.txt
|
|
|
|
|
2003-05-09 18:26:29 +02:00
|
|
|
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
|
2018-09-26 19:13:57 +02:00
|
|
|
pgstrcasecmp.o snprintf.o strerror.o \
|
|
|
|
$(filter rint.o strnlen.o, $(LIBOBJS)) \
|
2018-03-13 15:21:09 +01:00
|
|
|
string.o \
|
2017-10-11 17:27:57 +02:00
|
|
|
$(WIN32RES)
|
2003-03-16 11:42:54 +01:00
|
|
|
|
2008-02-26 07:41:24 +01:00
|
|
|
all: all-lib
|
2003-03-16 11:42:54 +01:00
|
|
|
|
|
|
|
# Shared library stuff
|
|
|
|
include $(top_srcdir)/src/Makefile.shlib
|
|
|
|
|
2005-12-06 06:26:21 +01:00
|
|
|
# We use some port modules verbatim, but since we need to
|
|
|
|
# compile with appropriate options to build a shared lib, we can't
|
|
|
|
# necessarily use the same object files as the backend uses. Instead,
|
|
|
|
# symlink the source files in here and build our own object file.
|
2003-05-10 04:05:50 +02:00
|
|
|
|
Convert elog.c's useful_strerror() into a globally-used strerror wrapper.
elog.c has long had a private strerror wrapper that handles assorted
possible failures or deficiencies of the platform's strerror. On Windows,
it also knows how to translate Winsock error codes, which the native
strerror does not. Move all this code into src/port/strerror.c and
define strerror() as a macro that invokes it, so that both our frontend
and backend code will have all of this behavior.
I believe this constitutes an actual bug fix on Windows, since AFAICS
our frontend code did not report Winsock error codes properly before this.
However, the main point is to lay the groundwork for implementing %m
in src/port/snprintf.c: the behavior we want %m to have is this one,
not the native strerror's.
Note that this throws away the prior use of src/port/strerror.c,
which was to implement strerror() on platforms lacking it. That's
been dead code for nigh twenty years now, since strerror() was
already required by C89.
We should likewise cause strerror_r to use this behavior, but
I'll tackle that separately.
Patch by me, reviewed by Michael Paquier
Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
2018-09-26 17:06:42 +02:00
|
|
|
pgstrcasecmp.c rint.c snprintf.c strerror.c strnlen.c: % : $(top_srcdir)/src/port/%
|
2004-05-07 15:42:49 +02:00
|
|
|
rm -f $@ && $(LN_S) $< .
|
|
|
|
|
2018-03-13 15:21:09 +01:00
|
|
|
string.c: % : $(top_srcdir)/src/common/%
|
|
|
|
rm -f $@ && $(LN_S) $< .
|
|
|
|
|
2003-03-16 11:42:54 +01:00
|
|
|
install: all installdirs install-lib
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
installdirs: installdirs-lib
|
2003-03-16 11:42:54 +01:00
|
|
|
|
|
|
|
uninstall: uninstall-lib
|
|
|
|
|
2007-10-05 03:51:40 +02:00
|
|
|
clean distclean: clean-lib
|
Convert elog.c's useful_strerror() into a globally-used strerror wrapper.
elog.c has long had a private strerror wrapper that handles assorted
possible failures or deficiencies of the platform's strerror. On Windows,
it also knows how to translate Winsock error codes, which the native
strerror does not. Move all this code into src/port/strerror.c and
define strerror() as a macro that invokes it, so that both our frontend
and backend code will have all of this behavior.
I believe this constitutes an actual bug fix on Windows, since AFAICS
our frontend code did not report Winsock error codes properly before this.
However, the main point is to lay the groundwork for implementing %m
in src/port/snprintf.c: the behavior we want %m to have is this one,
not the native strerror's.
Note that this throws away the prior use of src/port/strerror.c,
which was to implement strerror() on platforms lacking it. That's
been dead code for nigh twenty years now, since strerror() was
already required by C89.
We should likewise cause strerror_r to use this behavior, but
I'll tackle that separately.
Patch by me, reviewed by Michael Paquier
Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
2018-09-26 17:06:42 +02:00
|
|
|
rm -f $(OBJS) pgstrcasecmp.c rint.c snprintf.c strerror.c strnlen.c string.c
|
2007-10-05 03:51:40 +02:00
|
|
|
|
2008-02-26 07:41:24 +01:00
|
|
|
maintainer-clean: distclean maintainer-clean-lib
|