| @@ -1,145 +1,149 @@ | | | @@ -1,145 +1,149 @@ |
1 | #------------------------------------------------------------------------- | | 1 | #------------------------------------------------------------------------- |
2 | # | | 2 | # |
3 | # Makefile.libtool | | 3 | # Makefile.libtool |
4 | # Common rules for buildling libtool archives | | 4 | # Common rules for buildling libtool archives |
5 | # | | 5 | # |
6 | # IDENTIFICATION | | 6 | # IDENTIFICATION |
7 | # $NetBSD: Makefile.libtool,v 1.2 2010/08/01 17:01:02 jdolecek Exp $ | | 7 | # $NetBSD: Makefile.libtool,v 1.3 2010/08/04 06:00:55 mbalmer Exp $ |
8 | # | | 8 | # |
9 | #------------------------------------------------------------------------- | | 9 | #------------------------------------------------------------------------- |
10 | | | 10 | |
11 | ## | | 11 | ## |
12 | ## Hacks/workarounds for makefiles in certain directories | | 12 | ## Hacks/workarounds for makefiles in certain directories |
13 | ## | | 13 | ## |
14 | | | 14 | |
15 | # The following directories are building loadable shared modules, not | | 15 | # The following directories are building loadable shared modules, not |
16 | # shared libraries. | | 16 | # shared libraries. |
17 | # | | 17 | # |
18 | ifneq (,$(findstring src/backend/utils/mb/conversion_procs/,$(subdir))) | | 18 | ifneq (,$(findstring src/backend/utils/mb/conversion_procs/,$(subdir))) |
19 | shmodule = yes | | 19 | shmodule = yes |
20 | else | | 20 | else |
21 | ifneq (,$(findstring src/backend/snowball,$(subdir))) | | 21 | ifneq (,$(findstring src/backend/snowball,$(subdir))) |
22 | shmodule = yes | | 22 | shmodule = yes |
23 | else | | 23 | else |
24 | ifneq (,$(findstring src/pl/,$(subdir))) | | 24 | ifneq (,$(findstring src/pl/,$(subdir))) |
25 | shmodule = yes | | 25 | shmodule = yes |
26 | else | | 26 | else |
27 | ifneq (,$(findstring contrib/adminpack,$(subdir))) | | 27 | ifneq (,$(findstring contrib/adminpack,$(subdir))) |
28 | shmodule = yes | | 28 | shmodule = yes |
29 | else | | 29 | else |
30 | ifneq (,$(findstring contrib/pgcrypto,$(subdir))) | | 30 | ifneq (,$(findstring contrib/pgcrypto,$(subdir))) |
31 | shmodule = yes | | 31 | shmodule = yes |
32 | else | | 32 | else |
| | | 33 | ifneq (,$(findstring contrib/dblink,$(subdir))) |
| | | 34 | shmodule = yes |
| | | 35 | else |
33 | shmodule = no | | 36 | shmodule = no |
34 | endif | | 37 | endif |
35 | endif | | 38 | endif |
36 | endif | | 39 | endif |
37 | endif | | 40 | endif |
38 | endif | | 41 | endif |
| | | 42 | endif |
39 | | | 43 | |
40 | # Fix dependencies in some makefiles that assume the target matches | | 44 | # Fix dependencies in some makefiles that assume the target matches |
41 | # %.o so that when built for libtool, the target matches the corresponding | | 45 | # %.o so that when built for libtool, the target matches the corresponding |
42 | # %.lo. | | 46 | # %.lo. |
43 | # | | 47 | # |
44 | ifeq ($(subdir), src/interfaces/ecpg/ecpglib) | | 48 | ifeq ($(subdir), src/interfaces/ecpg/ecpglib) |
45 | path.lo: path.c $(top_builddir)/src/port/pg_config_paths.h | | 49 | path.lo: path.c $(top_builddir)/src/port/pg_config_paths.h |
46 | endif | | 50 | endif |
47 | | | 51 | |
48 | ifeq ($(subdir), src/interfaces/libpq) | | 52 | ifeq ($(subdir), src/interfaces/libpq) |
49 | fe-connect.lo: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h | | 53 | fe-connect.lo: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h |
50 | endif | | 54 | endif |
51 | | | 55 | |
52 | ifeq ($(subdir), src/pl/plpgsql/src) | | 56 | ifeq ($(subdir), src/pl/plpgsql/src) |
53 | pl_gram.lo pl_handler.lo pl_comp.lo pl_exec.lo pl_funcs.lo: plpgsql.h | | 57 | pl_gram.lo pl_handler.lo pl_comp.lo pl_exec.lo pl_funcs.lo: plpgsql.h |
54 | pl_gram.lo: $(srcdir)/pl_scan.c | | 58 | pl_gram.lo: $(srcdir)/pl_scan.c |
55 | endif | | 59 | endif |
56 | | | 60 | |
57 | | | 61 | |
58 | ## | | 62 | ## |
59 | ## VARIABLE DEFINITIONS | | 63 | ## VARIABLE DEFINITIONS |
60 | ## | | 64 | ## |
61 | | | 65 | |
62 | # Loadable shared modules are named differently from shared libraries | | 66 | # Loadable shared modules are named differently from shared libraries |
63 | # and are installed into $(pkglibdir). | | 67 | # and are installed into $(pkglibdir). |
64 | # | | 68 | # |
65 | ifeq ($(shmodule),yes) | | 69 | ifeq ($(shmodule),yes) |
66 | ltlib = $(NAME)$(DLSUFFIX) | | 70 | ltlib = $(NAME)$(DLSUFFIX) |
67 | ltmodule = -module | | 71 | ltmodule = -module |
68 | rpathdir = $(pkglibdir) | | 72 | rpathdir = $(pkglibdir) |
69 | else | | 73 | else |
70 | ltlib = lib$(NAME)$(DLSUFFIX) | | 74 | ltlib = lib$(NAME)$(DLSUFFIX) |
71 | ltmodule = | | 75 | ltmodule = |
72 | endif | | 76 | endif |
73 | | | 77 | |
74 | DLSUFFIX = .la | | 78 | DLSUFFIX = .la |
75 | SO_MAJOR_VERSION?=0 | | 79 | SO_MAJOR_VERSION?=0 |
76 | SO_MINOR_VERSION?=0 | | 80 | SO_MINOR_VERSION?=0 |
77 | | | 81 | |
78 | LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) | | 82 | LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) |
79 | LTLINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(ltmodule) -rpath $(rpathdir) -version-info $(SO_MAJOR_VERSION):$(SO_MINOR_VERSION) | | 83 | LTLINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(ltmodule) -rpath $(rpathdir) -version-info $(SO_MAJOR_VERSION):$(SO_MINOR_VERSION) |
80 | LTOBJS = $(OBJS:%.o=%.lo) | | 84 | LTOBJS = $(OBJS:%.o=%.lo) |
81 | | | 85 | |
82 | # Define INSTALL_SHLIB and shlib for the benefit of Makefiles for | | 86 | # Define INSTALL_SHLIB and shlib for the benefit of Makefiles for |
83 | # loadable modules that have their own target for installing the | | 87 | # loadable modules that have their own target for installing the |
84 | # module. | | 88 | # module. |
85 | # | | 89 | # |
86 | INSTALL_LTLIB = $(LIBTOOL) --mode=install $(INSTALL) | | 90 | INSTALL_LTLIB = $(LIBTOOL) --mode=install $(INSTALL) |
87 | INSTALL_STLIB = $(INSTALL_LTLIB) | | 91 | INSTALL_STLIB = $(INSTALL_LTLIB) |
88 | INSTALL_SHLIB = $(INSTALL_LTLIB) | | 92 | INSTALL_SHLIB = $(INSTALL_LTLIB) |
89 | shlib = $(ltlib) | | 93 | shlib = $(ltlib) |
90 | | | 94 | |
91 | %.lo : %.c | | 95 | %.lo : %.c |
92 | $(LTCOMPILE) -c $< -o $@ | | 96 | $(LTCOMPILE) -c $< -o $@ |
93 | | | 97 | |
94 | | | 98 | |
95 | ## | | 99 | ## |
96 | ## BUILD | | 100 | ## BUILD |
97 | ## | | 101 | ## |
98 | | | 102 | |
99 | .PHONY: all-lib all-static-lib all-shared-lib all-la-lib | | 103 | .PHONY: all-lib all-static-lib all-shared-lib all-la-lib |
100 | all-lib all-static-lib all-shared-lib: all-la-lib | | 104 | all-lib all-static-lib all-shared-lib: all-la-lib |
101 | | | 105 | |
102 | all-la-lib: $(ltlib) | | 106 | all-la-lib: $(ltlib) |
103 | | | 107 | |
104 | $(ltlib): $(LTOBJS) | | 108 | $(ltlib): $(LTOBJS) |
105 | $(LTLINK) -o $@ $(LTOBJS) $(SHLIB_LINK) | | 109 | $(LTLINK) -o $@ $(LTOBJS) $(SHLIB_LINK) |
106 | | | 110 | |
107 | | | 111 | |
108 | ## | | 112 | ## |
109 | ## INSTALL | | 113 | ## INSTALL |
110 | ## | | 114 | ## |
111 | | | 115 | |
112 | .PHONY: install-lib install-lib-static install-lib-shared installdirs-lib install-lib-la | | 116 | .PHONY: install-lib install-lib-static install-lib-shared installdirs-lib install-lib-la |
113 | install-lib install-static-lib install-shared-lib: install-lib-la | | 117 | install-lib install-static-lib install-shared-lib: install-lib-la |
114 | | | 118 | |
115 | install-lib-la: $(ltlib) | | 119 | install-lib-la: $(ltlib) |
116 | ifeq ($(shmodule),yes) | | 120 | ifeq ($(shmodule),yes) |
117 | $(INSTALL_LTLIB) $< $(DESTDIR)$(pkglibdir)/$(shlib) | | 121 | $(INSTALL_LTLIB) $< $(DESTDIR)$(pkglibdir)/$(shlib) |
118 | else | | 122 | else |
119 | $(INSTALL_LTLIB) $< $(DESTDIR)$(libdir)/$(ltlib) | | 123 | $(INSTALL_LTLIB) $< $(DESTDIR)$(libdir)/$(ltlib) |
120 | endif | | 124 | endif |
121 | | | 125 | |
122 | installdirs-lib: | | 126 | installdirs-lib: |
123 | ifeq ($(shmodule),yes) | | 127 | ifeq ($(shmodule),yes) |
124 | $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)' | | 128 | $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)' |
125 | else | | 129 | else |
126 | $(mkinstalldirs) '$(DESTDIR)$(libdir)' | | 130 | $(mkinstalldirs) '$(DESTDIR)$(libdir)' |
127 | endif | | 131 | endif |
128 | | | 132 | |
129 | | | 133 | |
130 | ## | | 134 | ## |
131 | ## UNINSTALL | | 135 | ## UNINSTALL |
132 | ## | | 136 | ## |
133 | | | 137 | |
134 | .PHONY: uninstall-lib | | 138 | .PHONY: uninstall-lib |
135 | uninstall-lib: | | 139 | uninstall-lib: |
136 | $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(ltlib) | | 140 | $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(ltlib) |
137 | | | 141 | |
138 | | | 142 | |
139 | ## | | 143 | ## |
140 | ## CLEAN | | 144 | ## CLEAN |
141 | ## | | 145 | ## |
142 | | | 146 | |
143 | .PHONY: clean-lib | | 147 | .PHONY: clean-lib |
144 | clean-lib: | | 148 | clean-lib: |
145 | $(LIBTOOL) --mode=clean rm -f $(ltlib) $(LTOBJS) | | 149 | $(LIBTOOL) --mode=clean rm -f $(ltlib) $(LTOBJS) |