blob: 51145f085a8aca9fe33a42343177febd67416b82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#-------------------------------------------------------------------------
#
# 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)
override CFLAGS += $(PTHREAD_CFLAGS)
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 -lm $(PTHREAD_LIBS), $(LIBS))
SHLIB_PREREQS = submake-libpq
SHLIB_EXPORTS = exports.txt
# Disable -bundle_loader on macOS.
BE_DLLLIBS =
# 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 $@
.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 $@
#
# Top-Level Targets
#
# The existence of a t/ folder induces the buildfarm to run Make directly on
# this subdirectory, bypassing the recursion skip in src/interfaces/Makefile.
# Wrap the standard build targets in a with_libcurl conditional to avoid
# building OAuth code on platforms that haven't requested it. (The "clean"-style
# targets remain available.)
#
ifeq ($(with_libcurl), yes)
# 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
# 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)'
check: all-tests
$(prove_check)
installcheck: all-tests
$(prove_installcheck)
endif # with_libcurl
uninstall:
rm -f '$(DESTDIR)$(libdir)/$(stlib)'
rm -f '$(DESTDIR)$(libdir)/$(shlib)'
clean distclean: clean-lib
rm -f $(OBJS) $(OBJS_STATIC) $(OBJS_SHLIB)
rm -f test-oauth-curl.o oauth_tests$(X)
rm -rf tmp_check
|