Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6697aa2

Browse files
committed
Improve support for building PGXS modules with VPATH.
A VPATH build will be performed when the module's make file path is notthe current directory or when USE_VPATH is set.This will assist packagers and others who prefer to build withoutpolluting the source directories.There is still a bit of work to do here, notably documentation, but it'sprobably a good idea to commit what we have so far and let people testit out on their modules.Cédric Villemain, with an addition from me.
1 parent6d43215 commit6697aa2

File tree

2 files changed

+49
-19
lines changed

2 files changed

+49
-19
lines changed

‎src/Makefile.global.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,23 @@ libpq_pgport = -L$(top_builddir)/src/port -lpgport \
415415
-L$(top_builddir)/src/common -lpgcommon$(libpq)
416416
endif
417417

418-
418+
# If PGXS is not defined, build libpq and libpgport dependancies as required.
419+
# If the build is with PGXS, then these are supposed to be already built and
420+
# installed, and we just ensure that the expected files exist.
421+
ifndefPGXS
419422
submake-libpq:
420423
$(MAKE) -C$(libpq_builddir) all
424+
else
425+
submake-libpq:$(libdir)/libpq.so ;
426+
endif
421427

428+
ifndefPGXS
422429
submake-libpgport:
423430
$(MAKE) -C$(top_builddir)/src/port all
424431
$(MAKE) -C$(top_builddir)/src/common all
432+
else
433+
submake-libpgport:$(libdir)/libpgport.a$(libdir)/libpgcommon.a ;
434+
endif
425435

426436
.PHONY: submake-libpq submake-libpgport
427437

‎src/makefiles/pgxs.mk

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,20 @@ top_builddir := $(dir $(PGXS))../..
6262
include$(top_builddir)/src/Makefile.global
6363

6464
top_srcdir =$(top_builddir)
65+
# If USE_VPATH is set or Makefile is not in current directory we are building
66+
# the extension with VPATH so we set the variable here
67+
ifdefUSE_VPATH
68+
srcdir =$(USE_VPATH)
69+
VPATH =$(USE_VPATH)
70+
else
71+
ifeq ($(CURDIR),$(dir$(firstword$(MAKEFILE_LIST))))
6572
srcdir = .
6673
VPATH =
74+
else
75+
srcdir =$(dir$(firstword$(MAKEFILE_LIST)))
76+
VPATH =$(srcdir)
77+
endif
78+
endif
6779

6880
# These might be set in Makefile.global, but if they were not found
6981
# during the build of PostgreSQL, supply default values so that users
@@ -112,33 +124,40 @@ all: all-lib
112124
endif# MODULE_big
113125

114126

115-
install: all installdirs
116-
ifneq (,$(EXTENSION))
117-
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(addsuffix .control, $(EXTENSION))) '$(DESTDIR)$(datadir)/extension/'
118-
endif# EXTENSION
119-
ifneq (,$(DATA)$(DATA_built))
120-
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) $(DATA_built) '$(DESTDIR)$(datadir)/$(datamoduledir)/'
121-
endif# DATA
122-
ifneq (,$(DATA_TSEARCH))
123-
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA_TSEARCH)) '$(DESTDIR)$(datadir)/tsearch_data/'
124-
endif# DATA_TSEARCH
127+
install: all installdirs installcontrol installdata installdatatsearch installdocs installscripts
125128
ifdefMODULES
126129
$(INSTALL_SHLIB) $(addsuffix $(DLSUFFIX), $(MODULES)) '$(DESTDIR)$(pkglibdir)/'
127130
endif# MODULES
131+
ifdefPROGRAM
132+
$(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
133+
endif# PROGRAM
134+
135+
installcontrol:$(addsuffix .control,$(EXTENSION))
136+
ifneq (,$(EXTENSION))
137+
$(INSTALL_DATA) $< '$(DESTDIR)$(datadir)/extension/'
138+
endif
139+
140+
installdata:$(DATA)$(DATA_built)
141+
ifneq (,$(DATA)$(DATA_built))
142+
$(INSTALL_DATA) $^ '$(DESTDIR)$(datadir)/$(datamoduledir)/'
143+
endif
144+
145+
installdatatsearch:$(DATA_TSEARCH)
146+
ifneq (,$(DATA_TSEARCH))
147+
$(INSTALL_DATA) $^ '$(DESTDIR)$(datadir)/tsearch_data/'
148+
endif
149+
150+
installdocs:$(DOCS)
128151
ifdefDOCS
129152
ifdefdocdir
130-
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DOCS)) '$(DESTDIR)$(docdir)/$(docmoduledir)/'
153+
$(INSTALL_DATA) $^ '$(DESTDIR)$(docdir)/$(docmoduledir)/'
131154
endif# docdir
132155
endif# DOCS
133-
ifdefPROGRAM
134-
$(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
135-
endif# PROGRAM
156+
157+
installscripts:$(SCRIPTS)$(SCRIPTS_built)
136158
ifdefSCRIPTS
137-
$(INSTALL_SCRIPT) $(addprefix $(srcdir)/, $(SCRIPTS)) '$(DESTDIR)$(bindir)/'
159+
$(INSTALL_SCRIPT) $^ '$(DESTDIR)$(bindir)/'
138160
endif# SCRIPTS
139-
ifdefSCRIPTS_built
140-
$(INSTALL_SCRIPT) $(SCRIPTS_built) '$(DESTDIR)$(bindir)/'
141-
endif# SCRIPTS_built
142161

143162
ifdefMODULE_big
144163
install: install-lib
@@ -263,6 +282,7 @@ test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src)
263282

264283
all:$(test_files_build)
265284
$(test_files_build):$(abs_builddir)/%:$(srcdir)/%
285+
$(MKDIR_P)$(dir$@)
266286
ln -s$<$@
267287
endif# VPATH
268288

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp