-
Notifications
You must be signed in to change notification settings - Fork 63
/
Makefile
76 lines (64 loc) · 2.37 KB
/
Makefile
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
#-------------------------------------------------------------------------
#
# Makefile for pg_shard
#
# Copyright (c) 2014-2015, Citus Data, Inc.
#
#-------------------------------------------------------------------------
# grab name and version from META.json file
EXTENSION = $(shell grep -m 1 '"name":' META.json | sed -e 's/[[:space:]]*"name":[[:space:]]*"\([^"]*\)",/\1/')
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
# installation scripts
DATA = $(wildcard updates/*--*.sql)
# documentation and executables
DOCS = $(wildcard doc/*.md)
SCRIPTS = $(wildcard bin/*)
# compilation configuration
MODULE_big = $(EXTENSION)
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
PG_CPPFLAGS = -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter -Iinclude -I$(libpq_srcdir)
SHLIB_LINK = $(libpq)
EXTRA_CLEAN += $(addprefix src/,*.gcno *.gcda) # clean up after profiling runs
# test configuration
TESTS = $(sort $(wildcard test/sql/*.sql))
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-language=plpgsql
REGRESS_OPTS += --launcher=./test/launcher.sh # use custom launcher for tests
# add coverage flags if requested
ifeq ($(enable_coverage),yes)
PG_CPPFLAGS += --coverage
SHLIB_LINK += --coverage
endif
# Handle a Linux issue where the loader might resolve ambiguous symbols to
# those within CitusDB rather than using those in pg_shard by ensuring the
# linker must call the pg_shard functions instead.
OS := $(shell uname)
ifeq ($(OS), Linux)
SHLIB_LINK += -Wl,-Bsymbolic
endif
# be explicit about the default target
all:
# delegate to subdirectory makefiles as needed
include sql/Makefile
include test/Makefile
# detect whether to build with pgxs or build in-tree
ifndef NO_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
SHLIB_PREREQS = submake-libpq
subdir = contrib/pg_shard
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
# ensure MAJORVERSION is defined (missing in older versions)
ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif
# if using a version older than PostgreSQL 9.3, abort
PG93 = $(shell echo $(MAJORVERSION) | grep -qE "8\.|9\.[012]" && echo no || echo yes)
ifeq ($(PG93),no)
$(error PostgreSQL 9.3 or higher is required to compile this extension)
endif