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
113
114
115
116
117
118
119
120
121
122
123
124
|
#-------------------------------------------------------------------------
#
# Makefile.libtool
# Common rules for buildling libtool archives
#
# IDENTIFICATION
# $NetBSD: Makefile.libtool,v 1.2 2007/09/20 21:58:21 jlam Exp $
#
#-------------------------------------------------------------------------
##
## Hacks/workarounds for makefiles in certain directories
##
# The following directories are building loadable shared modules, not
# shared libraries.
#
ifneq (,$(findstring src/backend/utils/mb/conversion_procs/,$(subdir)))
shmodule = yes
else
ifneq (,$(findstring src/pl/,$(subdir)))
shmodule = yes
else
ifneq (,$(findstring contrib/adminpack,$(subdir)))
shmodule = yes
else
shmodule = no
endif
endif
endif
# Fix dependencies in some makefiles that assume the target matches
# %.o so that when built for libtool, the target matches the corresponding
# %.lo.
#
ifeq ($(subdir), src/interfaces/ecpg/ecpglib)
path.lo: path.c $(top_builddir)/src/port/pg_config_paths.h
endif
ifeq ($(subdir), src/interfaces/libpq)
fe-connect.lo: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h
endif
ifeq ($(subdir), src/pl/plpgsql/src)
pl_gram.lo pl_handler.lo pl_comp.lo pl_exec.lo pl_funcs.lo: plpgsql.h $(srcdir)/pl.tab.h
pl_gram.lo: $(srcdir)/pl_scan.c
endif
##
## VARIABLE DEFINITIONS
##
# Loadable shared modules are named differently from shared libraries
# and are installed into $(pkglibdir).
#
ifeq ($(shmodule),yes)
ltlib = $(NAME)$(DLSUFFIX)
ltmodule = -module
rpathdir = $(pkglibdir)
else
ltlib = lib$(NAME)$(DLSUFFIX)
ltmodule =
endif
DLSUFFIX = .la
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS)
LTLINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(ltmodule) -rpath $(rpathdir) -version-info $(SO_MAJOR_VERSION):$(SO_MINOR_VERSION)
LTOBJS = $(OBJS:%.o=%.lo)
# Define INSTALL_SHLIB and shlib for the benefit of Makefiles for
# loadable modules that have their own target for installing the
# module.
#
INSTALL_LTLIB = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_STLIB = $(INSTALL_LTLIB)
INSTALL_SHLIB = $(INSTALL_LTLIB)
shlib = $(ltlib)
%.lo : %.c
$(LTCOMPILE) -c $< -o $@
##
## BUILD
##
.PHONY: all-lib all-static-lib all-shared-lib all-la-lib
all-lib all-static-lib all-shared-lib: all-la-lib
all-la-lib: $(ltlib)
$(ltlib): $(LTOBJS)
$(LTLINK) -o $@ $(LTOBJS) $(SHLIB_LINK)
##
## INSTALL
##
.PHONY: install-lib install-lib-static install-lib-shared install-lib-la
install-lib install-static-lib install-shared-lib: install-lib-la
install-lib-la: $(ltlib)
$(INSTALL_LTLIB) $< $(DESTDIR)$(libdir)/$(ltlib)
##
## UNINSTALL
##
.PHONY: uninstall-lib
uninstall-lib:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(ltlib)
##
## CLEAN
##
.PHONY: clean-lib
clean-lib:
$(LIBTOOL) --mode=clean rm -f $(ltlib) $(LTOBJS)
|