-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (40 loc) · 1.68 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
.PHONY: bintest update-version-file update-version-strings update-version tag-release
PG_CONFIG = pg_config
pg_version := $(word 2,$(shell $(PG_CONFIG) --version))
pg_config_h := $(shell $(PG_CONFIG) --includedir-server)/pg_config.h
use_float_byval := $(shell grep -q 'USE_FLOAT8_BYVAL 1' $(pg_config_h) && echo yes)
comma = ,
GIT_REVISION := $(shell bin/git-revision)
GENERATED_VERSION = 0.8.$(GIT_REVISION)
export GENERATED_VERSION
EXTENSION = crockford
EXTVERSION = $(shell cat VERSION)
MODULE_big = crockford
OBJS = hash.o inout.o magic.o operators.o
DATA_built = crockford--$(EXTVERSION).sql
REGRESS = init hash inout operators example drop
REGRESS_OPTS = --inputdir=test --outputdir=test
EXTRA_CLEAN += operators.c operators.sql test/sql/operators.sql bintest bintest.o
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
crockford--$(EXTVERSION).sql: crockford.sql hash.sql operators.sql
cat $^ | sed 's/@UINT8_PASSEDBYVALUE@/$(if $(use_float_byval),PASSEDBYVALUE$(comma))/' >$@
# Original has this as PYTHON ?= python
PYTHON = python
operators.c operators.sql test/sql/operators.sql: generate.py
$(PYTHON) $< $(pg_version)
pg_include := $(shell $(PG_CONFIG) --includedir)
bintest: bintest.c
cc -c -I$(pg_include) bintest.c
cc -o bintest bintest.o -L$(pg_include) -lpq
bincheck: bintest
./bincheck
update-version-strings:
sed -E -i.bak -e 's~^(default_version = ) *[^ ]*~\1'"'$(EXTVERSION)'"'~' crockford.control
sed -E -i.bak -e 's~^(Latest release: *)[^ ]*~\1$(EXTVERSION)~' README.markdown
rm *.bak
update-version-file:
echo "$$GENERATED_VERSION" > VERSION
update-version: update-version-file update-version-strings
tag-version:
git tag -a "$(EXTVERSION)" -m "Version $(EXTVERSION)"