-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
69 lines (46 loc) · 1.49 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
EXTENSION = vasco
EXTVERSION = 0.1.0
PG_CONFIG ?= pg_config
MODULE_big = $(EXTENSION)
OBJS = src/mine.o src/vasco.o
EXT_SQL_FILE = sql/$(EXTENSION)--$(EXTVERSION).sql
# Order of .sql files matters!
SQL_FILES = sql/preamble.sql \
sql/schemas.sql \
sql/vasco.sql \
sql/explore.sql
$(EXT_SQL_FILE): $(SQL_FILES)
@cat $^ > $@
all: $(EXT_SQL_FILE)
DATA = $(EXT_SQL_FILE)
TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-extension=$(EXTENSION)
EXTRA_CLEAN = $(EXT_SQL_FILE)
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
######### DIST / RELEASE #########
.PHONY: dist
dist:
mkdir -p dist
git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ --output dist/$(EXTENSION)-$(EXTVERSION).zip main
# for Docker
PG_MAJOR ?= 17
.PHONY: docker
docker:
docker build --pull --no-cache --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/vasco:pg$(PG_MAJOR) -t florents/vasco:$(EXTVERSION)-pg$(PG_MAJOR) .
.PHONY: docker-release
docker-release:
docker buildx build --push --pull --no-cache --platform linux/amd64,linux/arm64 --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/vasco:pg$(PG_MAJOR) -t florents/vasco:$(EXTVERSION)-pg$(PG_MAJOR) .
######### DEVELOPMENT #########
PGDATA = ./pgdata
PG_CTL = pg_ctl
.PHONY: restart-db
restart-db:
$(PG_CTL) -D $(PGDATA) restart
stop-db:
$(PG_CTL) -D $(PGDATA) stop
start-db:
postgres -D $(PGDATA)
dev: restart-db uninstall clean all install installcheck restart-db