1#------------------------------------------------------------------------- 2# 3# Makefile for src/interfaces/libpq library 4# 5# Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group 6# Portions Copyright (c) 1994, Regents of the University of California 7# 8# src/interfaces/libpq/Makefile 9# 10#------------------------------------------------------------------------- 11 12subdir = src/interfaces/libpq 13top_builddir = ../../.. 14include $(top_builddir)/src/Makefile.global 15 16 17PGFILEDESC = "PostgreSQL Access Library" 18 19# shared library parameters 20NAME= pq 21SO_MAJOR_VERSION= 5 22SO_MINOR_VERSION= $(MAJORVERSION) 23 24override CPPFLAGS := -DFRONTEND -DUNSAFE_STAT_OK -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port -I$(top_srcdir)/src/port 25ifneq ($(PORTNAME), win32) 26override CFLAGS += $(PTHREAD_CFLAGS) 27endif 28 29# The MSVC build system scrapes OBJS from this file. If you change any of 30# the conditional additions of files to OBJS, update Mkvcbuild.pm to match. 31 32OBJS = \ 33 $(WIN32RES) \ 34 fe-auth-scram.o \ 35 fe-connect.o \ 36 fe-exec.o \ 37 fe-lobj.o \ 38 fe-misc.o \ 39 fe-print.o \ 40 fe-protocol3.o \ 41 fe-secure.o \ 42 fe-trace.o \ 43 legacy-pqsignal.o \ 44 libpq-events.o \ 45 pqexpbuffer.o \ 46 fe-auth.o 47 48# File shared across all SSL implementations supported. 49ifneq ($(with_ssl),no) 50OBJS += \ 51 fe-secure-common.o 52endif 53 54ifeq ($(with_ssl),openssl) 55OBJS += \ 56 fe-secure-openssl.o 57endif 58 59ifeq ($(with_gssapi),yes) 60OBJS += \ 61 fe-gssapi-common.o \ 62 fe-secure-gssapi.o 63endif 64 65ifeq ($(PORTNAME), cygwin) 66override shlib = cyg$(NAME)$(DLSUFFIX) 67endif 68 69ifeq ($(PORTNAME), win32) 70OBJS += \ 71 win32.o 72 73ifeq ($(enable_thread_safety), yes) 74OBJS += pthread-win32.o 75endif 76endif 77 78 79# Add libraries that libpq depends (or might depend) on into the 80# shared library link. (The order in which you list them here doesn't 81# matter.) Note that we filter out -lpgcommon and -lpgport from LIBS and 82# instead link with -lpgcommon_shlib and -lpgport_shlib, to get object files 83# that are built correctly for use in a shlib. 84SHLIB_LINK_INTERNAL = -lpgcommon_shlib -lpgport_shlib 85ifneq ($(PORTNAME), win32) 86SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS) 87else 88SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE) 89endif 90ifeq ($(PORTNAME), win32) 91SHLIB_LINK += -lshell32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS)) 92endif 93SHLIB_PREREQS = submake-libpgport 94 95SHLIB_EXPORTS = exports.txt 96 97PKG_CONFIG_REQUIRES_PRIVATE = libssl libcrypto 98 99all: all-lib 100 101# Shared library stuff 102include $(top_srcdir)/src/Makefile.shlib 103backend_src = $(top_srcdir)/src/backend 104 105 106# Make dependencies on pg_config_paths.h visible in all builds. 107fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h 108fe-misc.o: fe-misc.c $(top_builddir)/src/port/pg_config_paths.h 109 110$(top_builddir)/src/port/pg_config_paths.h: 111 $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h 112 113install: all installdirs install-lib 114 $(INSTALL_DATA) $(srcdir)/libpq-fe.h '$(DESTDIR)$(includedir)' 115 $(INSTALL_DATA) $(srcdir)/libpq-events.h '$(DESTDIR)$(includedir)' 116 $(INSTALL_DATA) $(srcdir)/libpq-int.h '$(DESTDIR)$(includedir_internal)' 117 $(INSTALL_DATA) $(srcdir)/pqexpbuffer.h '$(DESTDIR)$(includedir_internal)' 118 $(INSTALL_DATA) $(srcdir)/pg_service.conf.sample '$(DESTDIR)$(datadir)/pg_service.conf.sample' 119 120installcheck: 121 $(MAKE) -C test $@ 122 123installdirs: installdirs-lib 124 $(MKDIR_P) '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)' '$(DESTDIR)$(datadir)' 125 126uninstall: uninstall-lib 127 rm -f '$(DESTDIR)$(includedir)/libpq-fe.h' 128 rm -f '$(DESTDIR)$(includedir)/libpq-events.h' 129 rm -f '$(DESTDIR)$(includedir_internal)/libpq-int.h' 130 rm -f '$(DESTDIR)$(includedir_internal)/pqexpbuffer.h' 131 rm -f '$(DESTDIR)$(datadir)/pg_service.conf.sample' 132 133clean distclean: clean-lib 134 $(MAKE) -C test $@ 135 rm -f $(OBJS) pthread.h 136# Might be left over from a Win32 client-only build 137 rm -f pg_config_paths.h 138 139maintainer-clean: distclean 140 $(MAKE) -C test $@ 141