postgresql/src/interfaces/libpq-oauth/Makefile
Jacob Champion 1443b6c0ea oauth: Add unit tests for multiplexer handling
To better record the internal behaviors of oauth-curl.c, add a unit test
suite for the socket and timer handling code. This is all based on TAP
and driven by our existing Test::More infrastructure.

Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com
2025-08-08 08:45:01 -07:00

97 lines
2.8 KiB
Makefile

#-------------------------------------------------------------------------
#
# Makefile for libpq-oauth
#
# Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# src/interfaces/libpq-oauth/Makefile
#
#-------------------------------------------------------------------------
subdir = src/interfaces/libpq-oauth
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
PGFILEDESC = "libpq-oauth - device authorization OAuth support"
# This is an internal module; we don't want an SONAME and therefore do not set
# SO_MAJOR_VERSION.
NAME = pq-oauth-$(MAJORVERSION)
# Force the name "libpq-oauth" for both the static and shared libraries. The
# staticlib doesn't need version information in its name.
override shlib := lib$(NAME)$(DLSUFFIX)
override stlib := libpq-oauth.a
override CPPFLAGS := -I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS) $(LIBCURL_CPPFLAGS)
OBJS = \
$(WIN32RES)
OBJS_STATIC = oauth-curl.o
# The shared library needs additional glue symbols.
OBJS_SHLIB = \
oauth-curl_shlib.o \
oauth-utils.o \
oauth-utils.o: override CPPFLAGS += -DUSE_DYNAMIC_OAUTH
oauth-curl_shlib.o: override CPPFLAGS_SHLIB += -DUSE_DYNAMIC_OAUTH
# Add shlib-/stlib-specific objects.
$(shlib): override OBJS += $(OBJS_SHLIB)
$(shlib): $(OBJS_SHLIB)
$(stlib): override OBJS += $(OBJS_STATIC)
$(stlib): $(OBJS_STATIC)
SHLIB_LINK_INTERNAL = $(libpq_pgport_shlib)
SHLIB_LINK = $(LIBCURL_LDFLAGS) $(LIBCURL_LDLIBS) $(filter -lintl, $(LIBS))
SHLIB_PREREQS = submake-libpq
SHLIB_EXPORTS = exports.txt
# Disable -bundle_loader on macOS.
BE_DLLLIBS =
# By default, a library without an SONAME doesn't get a static library, so we
# add it to the build explicitly.
all: all-lib all-static-lib
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
# Use src/common/Makefile's trick for tracking dependencies of shlib-specific
# objects.
%_shlib.o: %.c %.o
$(CC) $(CFLAGS) $(CFLAGS_SL) $(CPPFLAGS) $(CPPFLAGS_SHLIB) -c $< -o $@
# Ignore the standard rules for SONAME-less installation; we want both the
# static and shared libraries to go into libdir.
install: all installdirs $(stlib) $(shlib)
$(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(libdir)/$(shlib)'
$(INSTALL_STLIB) $(stlib) '$(DESTDIR)$(libdir)/$(stlib)'
installdirs:
$(MKDIR_P) '$(DESTDIR)$(libdir)'
uninstall:
rm -f '$(DESTDIR)$(libdir)/$(stlib)'
rm -f '$(DESTDIR)$(libdir)/$(shlib)'
.PHONY: all-tests
all-tests: oauth_tests$(X)
oauth_tests$(X): test-oauth-curl.o oauth-utils.o $(WIN32RES) | submake-libpgport submake-libpq
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(SHLIB_LINK) -o $@
check: all-tests
$(prove_check)
installcheck: all-tests
$(prove_installcheck)
clean distclean: clean-lib
rm -f $(OBJS) $(OBJS_STATIC) $(OBJS_SHLIB)
rm -f test-oauth-curl.o oauth_tests$(X)
rm -rf tmp_check