|
1 |
| -# $PostgreSQL: pgsql/contrib/contrib-global.mk,v 1.7 2003/11/29 19:51:18 pgsql Exp $ |
| 1 | +# $PostgreSQL: pgsql/contrib/contrib-global.mk,v 1.8 2004/07/30 12:26:39 petere Exp $ |
2 | 2 |
|
3 |
| -# This file contains generic rules to build many kinds of simple |
4 |
| -# contrib modules. You only need to set a few variables and include |
5 |
| -# this file, the rest will be done here. |
6 |
| -# |
7 |
| -# Use the following layout for your Makefile: |
8 |
| -# |
9 |
| -# subdir = contrib/xxx |
10 |
| -# top_builddir = ../.. |
11 |
| -# include $(top_builddir)/src/Makefile.global |
12 |
| -# |
13 |
| -# [variable assignments, see below] |
14 |
| -# [custom rules, rarely necessary] |
15 |
| -# |
16 |
| -# include $(top_srcdir)/contrib/contrib-global.mk |
17 |
| -# |
18 |
| -# The following variables can be set: |
19 |
| -# |
20 |
| -# MODULES -- list of shared objects to be build from source file with |
21 |
| -# same stem (do not include suffix in this list) |
22 |
| -# DATA -- random files to install into $PREFIX/share/contrib |
23 |
| -# DATA_built -- random files to install into $PREFIX/share/contrib, |
24 |
| -# which need to be built first |
25 |
| -# DOCS -- random files to install under $PREFIX/doc/contrib |
26 |
| -# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin |
27 |
| -# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin, |
28 |
| -# which need to be built first |
29 |
| -# REGRESS -- list of regression test cases (without suffix) |
30 |
| -# |
31 |
| -# or at most one of these two: |
32 |
| -# |
33 |
| -# PROGRAM -- a binary program to build (list objects files in OBJS) |
34 |
| -# MODULE_big -- a shared object to build (list object files in OBJS) |
35 |
| -# |
36 |
| -# The following can also be set: |
37 |
| -# |
38 |
| -# EXTRA_CLEAN -- extra files to remove in 'make clean' |
39 |
| -# PG_CPPFLAGS -- will be added to CPPFLAGS |
40 |
| -# PG_LIBS -- will be added to PROGRAM link line |
41 |
| -# SHLIB_LINK -- will be added to MODULE_big link line |
42 |
| -# |
43 |
| -# Better look at some of the existing uses for examples... |
44 |
| - |
45 |
| - |
46 |
| -override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) |
47 |
| - |
48 |
| -ifdef MODULES |
49 |
| -override CFLAGS += $(CFLAGS_SL) |
50 |
| -SHLIB_LINK += $(BE_DLLLIBS) |
51 |
| -endif |
52 |
| - |
53 |
| -ifdef PG_CPPFLAGS |
54 |
| -override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS) |
55 |
| -endif |
56 |
| - |
57 |
| -all: $(PROGRAM) $(DATA_built) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) |
58 |
| - |
59 |
| -ifdef MODULE_big |
60 |
| -# shared library parameters |
61 |
| -NAME = $(MODULE_big) |
62 |
| -SO_MAJOR_VERSION= 0 |
63 |
| -SO_MINOR_VERSION= 0 |
64 |
| -rpath = |
65 |
| - |
66 |
| -SHLIB_LINK += $(BE_DLLLIBS) |
67 |
| - |
68 |
| -include $(top_srcdir)/src/Makefile.shlib |
69 |
| - |
70 |
| -all: all-lib |
71 |
| -endif # MODULE_big |
72 |
| - |
73 |
| - |
74 |
| -install: all installdirs |
75 |
| -ifneq (,$(DATA)$(DATA_built)) |
76 |
| - @for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built); do \ |
77 |
| - echo "$(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/contrib"; \ |
78 |
| - $(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/contrib; \ |
79 |
| - done |
80 |
| -endif # DATA |
81 |
| -ifdef MODULES |
82 |
| - @for file in $(addsuffix $(DLSUFFIX), $(MODULES)); do \ |
83 |
| - echo "$(INSTALL_SHLIB) $$file $(DESTDIR)$(pkglibdir)"; \ |
84 |
| - $(INSTALL_SHLIB) $$file $(DESTDIR)$(pkglibdir); \ |
85 |
| - done |
86 |
| -endif # MODULES |
87 |
| -ifdef DOCS |
88 |
| - @for file in $(addprefix $(srcdir)/, $(DOCS)); do \ |
89 |
| - echo "$(INSTALL_DATA) $$file $(DESTDIR)$(docdir)/contrib"; \ |
90 |
| - $(INSTALL_DATA) $$file $(DESTDIR)$(docdir)/contrib; \ |
91 |
| - done |
92 |
| -endif # DOCS |
93 |
| -ifdef PROGRAM |
94 |
| - $(INSTALL_PROGRAM) $(PROGRAM)$(X) $(DESTDIR)$(bindir) |
95 |
| -endif # PROGRAM |
96 |
| -ifdef MODULE_big |
97 |
| - $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX) |
98 |
| -endif # MODULE_big |
99 |
| -ifdef SCRIPTS |
100 |
| - @for file in $(addprefix $(srcdir)/, $(SCRIPTS)); do \ |
101 |
| - echo "$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir)"; \ |
102 |
| - $(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir); \ |
103 |
| - done |
104 |
| -endif # SCRIPTS |
105 |
| -ifdef SCRIPTS_built |
106 |
| - @for file in $(SCRIPTS_built); do \ |
107 |
| - echo "$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir)"; \ |
108 |
| - $(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir); \ |
109 |
| - done |
110 |
| -endif # SCRIPTS_built |
111 |
| - |
112 |
| - |
113 |
| -installdirs: |
114 |
| -ifneq (,$(DATA)$(DATA_built)) |
115 |
| - $(mkinstalldirs) $(DESTDIR)$(datadir)/contrib |
116 |
| -endif |
117 |
| -ifneq (,$(MODULES)$(MODULE_big)) |
118 |
| - $(mkinstalldirs) $(DESTDIR)$(pkglibdir) |
119 |
| -endif |
120 |
| -ifdef DOCS |
121 |
| - $(mkinstalldirs) $(DESTDIR)$(docdir)/contrib |
122 |
| -endif |
123 |
| -ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built)) |
124 |
| - $(mkinstalldirs) $(DESTDIR)$(bindir) |
125 |
| -endif |
126 |
| - |
127 |
| - |
128 |
| -uninstall: |
129 |
| -ifneq (,$(DATA)$(DATA_built)) |
130 |
| - rm -f $(addprefix $(DESTDIR)$(datadir)/contrib/, $(notdir $(DATA) $(DATA_built))) |
131 |
| -endif |
132 |
| -ifdef MODULES |
133 |
| - rm -f $(addprefix $(DESTDIR)$(pkglibdir)/, $(addsuffix $(DLSUFFIX), $(MODULES))) |
134 |
| -endif |
135 |
| -ifdef DOCS |
136 |
| - rm -f $(addprefix $(DESTDIR)$(docdir)/contrib/, $(DOCS)) |
137 |
| -endif |
138 |
| -ifdef PROGRAM |
139 |
| - rm -f $(DESTDIR)$(bindir)/$(PROGRAM)$(X) |
140 |
| -endif |
141 |
| -ifdef MODULE_big |
142 |
| - rm -f $(DESTDIR)$(pkglibdir)/$(MODULE_big)$(DLSUFFIX) |
143 |
| -endif |
144 |
| -ifdef SCRIPTS |
145 |
| - rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS)) |
146 |
| -endif |
147 |
| -ifdef SCRIPTS_built |
148 |
| - rm -f $(addprefix $(DESTDIR)$(bindir)/, $(SCRIPTS_built)) |
149 |
| -endif |
150 |
| - |
151 |
| - |
152 |
| -clean: |
153 |
| -ifdef MODULES |
154 |
| - rm -f $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .o, $(MODULES)) |
155 |
| -endif |
156 |
| -ifdef DATA_built |
157 |
| - rm -f $(DATA_built) |
158 |
| -endif |
159 |
| -ifdef SCRIPTS_built |
160 |
| - rm -f $(SCRIPTS_built) |
161 |
| -endif |
162 |
| -ifdef PROGRAM |
163 |
| - rm -f $(PROGRAM)$(X) |
164 |
| -endif |
165 |
| -ifdef OBJS |
166 |
| - rm -f $(OBJS) |
167 |
| -endif |
168 |
| -ifdef EXTRA_CLEAN |
169 |
| - rm -f $(EXTRA_CLEAN) |
170 |
| -endif |
171 |
| -ifdef REGRESS |
172 |
| -# things created by various check targets |
173 |
| - rm -rf results tmp_check log |
174 |
| - rm -f regression.diffs regression.out regress.out run_check.out |
175 |
| -ifeq ($(PORTNAME), win) |
176 |
| - rm -f regress.def |
177 |
| -endif |
178 |
| -endif # REGRESS |
179 |
| - |
180 |
| -ifdef MODULE_big |
181 |
| -clean: clean-lib |
182 |
| -endif |
183 |
| - |
184 |
| -distclean maintainer-clean: clean |
185 |
| - |
186 |
| - |
187 |
| -ifdef REGRESS |
188 |
| - |
189 |
| -# When doing a VPATH build, must copy over the test .sql and .out |
190 |
| -# files so that the driver script can find them. We have to use an |
191 |
| -# absolute path for the targets, because otherwise make will try to |
192 |
| -# locate the missing files using VPATH, and will find them in |
193 |
| -# $(srcdir), but the point here is that we want to copy them from |
194 |
| -# $(srcdir) to the build directory. |
195 |
| - |
196 |
| -ifdef VPATH |
197 |
| -abs_builddir := $(shell pwd) |
198 |
| -test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(wildcard $(srcdir)/data/*.data) |
199 |
| -test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src)) |
200 |
| - |
201 |
| -all: $(test_files_build) |
202 |
| -$(test_files_build): $(abs_builddir)/%: $(srcdir)/% |
203 |
| - ln -s $< $@ |
204 |
| -endif # VPATH |
205 |
| - |
206 |
| -.PHONY: submake |
207 |
| -submake: |
208 |
| - $(MAKE) -C $(top_builddir)/src/test/regress pg_regress |
209 |
| - |
210 |
| -# against installed postmaster |
211 |
| -installcheck: submake |
212 |
| - $(top_builddir)/src/test/regress/pg_regress $(REGRESS) |
213 |
| - |
214 |
| -# in-tree test doesn't work yet (no way to install my shared library) |
215 |
| -#check: all submake |
216 |
| -# $(top_builddir)/src/test/regress/pg_regress --temp-install \ |
217 |
| -# --top-builddir=$(top_builddir) $(REGRESS) |
218 |
| -check: |
219 |
| - @echo "'make check' is not supported." |
220 |
| - @echo "Do 'make install', then 'make installcheck' instead." |
221 |
| -endif # REGRESS |
222 |
| - |
223 |
| - |
224 |
| -# STANDARD RULES |
225 |
| - |
226 |
| -ifneq (,$(MODULES)$(MODULE_big)) |
227 |
| -%.sql: %.sql.in |
228 |
| - sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@ |
229 |
| -endif |
230 |
| - |
231 |
| -ifdef PROGRAM |
232 |
| -$(PROGRAM): $(OBJS) |
233 |
| - $(CC) $(CFLAGS) $(OBJS) $(PG_LIBS) $(LDFLAGS) $(LIBS) -o $@ |
234 |
| -endif |
| 3 | +NO_PGXS = 1 |
| 4 | +include $(top_srcdir)/src/makefiles/pgxs.mk |
0 commit comments