-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
54 lines (37 loc) · 1.42 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
PG_CONFIG = pg_config
PKG_CONFIG = pkg-config
EXTENSION = pgpdf
EXTVERSION = 0.1.0
MODULE_big = $(EXTENSION)
OBJS = pgpdf.o
DATA = $(wildcard sql/*--*.sql)
PG_CPPFLAGS = $(shell $(PKG_CONFIG) --cflags poppler poppler-glib)
PG_LDFLAGS = $(shell $(PKG_CONFIG) --libs poppler poppler-glib)
SHLIB_LINK =-lpoppler -lpoppler-glib
TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-extension=$(EXTENSION)
TEST_FILES = /tmp/pgintro.pdf /tmp/bad.pdf /tmp/big.pdf
/tmp/pgintro.pdf:
cp test/pgintro.pdf $@
/tmp/bad.pdf:
echo 'not a pdf' >> $@
/tmp/big.pdf:
wget https://www.postgresql.org/files/documentation/pdf/10/postgresql-10-A4.pdf -O $@
installcheck: $(TEST_FILES)
EXTRA_CLEAN = $(TEST_FILES)
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
dev: clean all install installcheck
.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-build
docker-build:
docker build --pull --no-cache --build-arg PG_MAJOR=$(PG_MAJOR) -t florents/pgpdf:pg$(PG_MAJOR) -t florents/pgpdf:$(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/pgpdf:pg$(PG_MAJOR) -t florents/pgpdf:$(EXTVERSION)-pg$(PG_MAJOR) .