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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
# pgmp -- pgxs-based makefile
#
# Copyright (C) 2011-2020 Daniele Varrazzo
#
# This file is part of the PostgreSQL GMP Module
#
# The PostgreSQL GMP Module is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# The PostgreSQL GMP Module is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the PostgreSQL GMP Module. If not, see
# https://www.gnu.org/licenses/.
.PHONY: docs
# You may have to customize this to run the test suite
# REGRESS_OPTS=--user postgres
PG_CONFIG=pg_config
SHLIB_LINK=-lgmp -lm
EXTENSION = pgmp
MODULEDIR = $(EXTENSION)
MODULE_big = $(EXTENSION)
EXT_LONGVER = $(shell grep '"version":' META.json | head -1 | sed -e 's/\s*"version":\s*"\(.*\)",/\1/')
EXT_SHORTVER = $(shell grep 'default_version' $(EXTENSION).control | head -1 | sed -e "s/default_version\s*=\s'\(.*\)'/\1/")
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\.| 9\.0" && echo pre91 || echo 91)
SRC_C = $(sort $(wildcard src/*.c))
SRC_H = $(sort $(wildcard src/*.h))
SRCFILES = $(SRC_C) $(SRC_H)
OBJS = $(patsubst %.c,%.o,$(SRC_C))
TESTFILES = $(sort $(wildcard test/sql/*.sql) $(wildcard test/expected/*.out))
BENCHFILES = $(sort $(wildcard bench/*.py) $(wildcard bench/*.txt))
DOCFILES = $(sort $(wildcard docs/*.rst))
TOOLSFILES = $(sort $(wildcard tools/*.py))
PKGFILES = $(SRCFILES) $(DOCFILES) $(TESTFILES) $(BENCHFILES) $(TOOLSFILES) \
AUTHORS COPYING README.rst Makefile META.json pgmp.control \
sql/pgmp.pysql sql/uninstall_pgmp.sql \
docs/conf.py docs/Makefile docs/_static/pgmp.css \
docs/html-gitignore docs/requirements.txt
ifeq ($(PG91),91)
INSTALLSCRIPT=sql/pgmp--$(EXT_SHORTVER).sql
UPGRADESCRIPT=sql/pgmp--unpackaged--$(EXT_SHORTVER).sql
DATA = $(INSTALLSCRIPT) $(UPGRADESCRIPT)
else
INSTALLSCRIPT=sql/pgmp.sql
DATA = $(INSTALLSCRIPT) sql/uninstall_pgmp.sql
endif
# the += doesn't work if the user specified his own REGRESS_OPTS
REGRESS = --inputdir=test setup-$(PG91) mpz mpq
EXTRA_CLEAN = $(INSTALLSCRIPT) $(UPGRADESCRIPT)
PKGNAME = pgmp-$(EXT_LONGVER)
SRCPKG = $(SRCPKG_TGZ) $(SRCPKG_ZIP)
SRCPKG_TGZ = dist/$(PKGNAME).tar.gz
SRCPKG_ZIP = dist/$(PKGNAME).zip
USE_PGXS=1
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
# added to the targets defined in pgxs
all: $(INSTALLSCRIPT) $(UPGRADESCRIPT)
$(INSTALLSCRIPT): sql/pgmp.pysql
tools/unmix.py < $< > $@
$(UPGRADESCRIPT): $(INSTALLSCRIPT)
tools/sql2extension.py --extname pgmp $< > $@
docs:
$(MAKE) -C docs
sdist: $(SRCPKG)
$(SRCPKG): $(PKGFILES)
ln -sf . $(PKGNAME)
mkdir -p dist
rm -f $(SRCPKG_TGZ)
tar czvf $(SRCPKG_TGZ) $(addprefix $(PKGNAME)/,$^)
rm -f $(SRCPKG_ZIP)
zip -r $(SRCPKG_ZIP) $(addprefix $(PKGNAME)/,$^)
rm $(PKGNAME)
# Required for testing in pgxn client on PG < 9.1
installcheck: $(INSTALLSCRIPT)
|