Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 852c8c0

Browse files
committed
Squashed 'contrib/pg_shardman/' changes from 302fd15..c350eaf
c350eaf Use PGXS always, except when we are inside 'contrib' directory. git-subtree-dir: contrib/pg_shardman git-subtree-split: c350eaf
1 parent 8c4dabb commit 852c8c0

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

Makefile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,34 @@ MODULE_big = pg_shardman
1010
OBJS = pg_shardman.o
1111
PGFILEDESC = "pg_shardman - sharding for Postgres"
1212

13-
ifdef USE_SOURCETREE # assume the extension is in contrib/ dir of pg distribution
14-
PG_CPPFLAGS = -I$(libpq_srcdir)
15-
SHLIB_LINK = $(libpq)
16-
SHLIB_PREREQS = submake-libpq
17-
subdir = contrib/pg_shardman
18-
top_builddir = ../..
19-
include $(top_builddir)/src/Makefile.global
20-
include $(top_srcdir)/contrib/contrib-global.mk
21-
else # use pgxs
13+
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) # abs path to this makefile
14+
mkfile_dir := $(shell basename $(dir $(mkfile_path))) # parent dir of the project
15+
ifndef USE_PGXS # hmm, user didn't requested to use pgxs
16+
ifneq ($(mkfile_dir),contrib) # a-ha, but we are not inside 'contrib' dir
17+
USE_PGXS := 1 # so use it anyway, most probably that's use user wants
18+
endif
19+
endif
20+
21+
ifdef USE_PGXS # use pgxs
2222
# You can specify path to pg_config in PG_CONFIG var
2323
ifndef PG_CONFIG
2424
PG_CONFIG := pg_config
2525
endif
2626
PG_CONFIG = pg_config
27-
2827
INCLUDEDIR := $(shell $(PG_CONFIG) --includedir)
2928
PG_CPPFLAGS += -I$(INCLUDEDIR) # add server's include directory for libpq-fe.h
3029
SHLIB_LINK += -lpq # add libpq
31-
3230
PGXS := $(shell $(PG_CONFIG) --pgxs)
3331
include $(PGXS)
32+
33+
else # assume the extension is in contrib/ dir of pg distribution
34+
PG_CPPFLAGS = -I$(libpq_srcdir) # include libpq-fe, defined in Makefile.global.in
35+
SHLIB_LINK = $(libpq) # defined in Makefile.global.in
36+
SHLIB_PREREQS = submake-libpq
37+
subdir = contrib/pg_shardman
38+
top_builddir = ../..
39+
include $(top_builddir)/src/Makefile.global
40+
include $(top_srcdir)/contrib/contrib-global.mk
3441
endif
3542

3643
python_tests:

0 commit comments

Comments
 (0)