-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (50 loc) · 2.38 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
PG_CONFIG = pg_config
PKG_CONFIG = pkg-config
extension_version = 0.24
EXTENSION = datalink
DATA_built = datalink--$(extension_version).sql
PROGRAM = dlcat
INCLUDES = -I/usr/include/postgresql
PG_LIBS = -L$(shell $(PG_CONFIG) --pkglibdir)
BINDIR = $(shell $(PG_CONFIG) --bindir)
REGRESS = init type sqlmed selective link linker uri user bfile
REGRESS_OPTS = --inputdir=test
SCRIPTS = bin/pg_datalinker bin/dlfm
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
INSTALL_PROGRAM = $(INSTALL) -m 6755 -o www-data -g www-data
install: installextras
installcheck: testfiles
installextras:
if [ ! -f /usr/sbin/pg_datalinker ] ; then ln -s /usr/share/postgresql-common/pg_wrapper /usr/sbin/pg_datalinker ; fi
if [ ! -f /usr/sbin/dlfm ] ; then ln -s /usr/share/postgresql-common/pg_wrapper /usr/sbin/dlfm ; fi
if [ ! -f /usr/bin/dlcat ] ; then ln -s /usr/share/postgresql-common/pg_wrapper /usr/bin/dlcat ; fi
if [ ! -f /etc/postgresql-common/pg_datalinker.prefix ] ; then /usr/bin/install -m 644 pg_datalinker.prefix /etc/postgresql-common ; fi
if [ ! -f /etc/apache2/sites-available/datalink.conf ] ; then /usr/bin/install -m 644 datalink.conf /etc/apache2/sites-available ; fi
/usr/bin/install -m 644 pg_datalinker.service /etc/systemd/system
testfiles:
if [ ! -d /var/www/datalink ] ; then mkdir /var/www/datalink ; fi
chgrp postgres /var/www/datalink ; chmod g+w /var/www/datalink
# cp CHANGELOG.md /var/www/datalink/CHANGELOG.md
echo "Hello" > /var/www/datalink/test1.txt
cp docs/utf8.txt /var/www/datalink/test2.txt
cp -a LICENSE.md /var/www/datalink/test3.txt#11111111-2222-3333-4444-abecedabeced
rm -f /var/www/datalink/test3.txt
date +%F > /var/www/datalink/test4.txt
rm -f /var/www/datalink/test5.txt /var/www/datalink/test6.txt
dump:
pg_dump -Fc contrib_regression > db.pg_dump
dropdb contrib_regression
pg_restore -v -C -d postgres db.pg_dump
datalink--$(extension_version).sql: datalink.sql
cat $^ >$@
dlcat: dlcat.c
$(CC) -Wall -Wextra -I`$(PG_CONFIG) --includedir` dlcat.c -lpq -o dlcat
chown www-data:www-data dlcat
chmod 755 dlcat
chmod g+s dlcat
chmod u+s dlcat
dlfusefs: dlfusefs.c
$(CC) -Wall -Wextra `$(PKG_CONFIG) --cflags --libs fuse` -I`$(PG_CONFIG) --includedir` dlfusefs.c -lpq -o dlfusefs
testall.sh:
pg_lsclusters -h | perl -ne '@_=split("\\s+",$$_); print "make PGPORT=$$_[2] PG_CONFIG=/usr/lib/postgresql/$$_[0]/bin/pg_config clean install installcheck\n";' > testall.sh