-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (69 loc) · 1.62 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# $Id: Makefile 1460 2012-11-02 18:21:27Z fabien $
#
# PostgreSQL stuff
#
name = pg_comparator
SCRIPTS = $(name)
MODULES = pgc_checksum pgc_casts
DATA_built = $(MODULES:%=%.sql)
DATA = xor_aggregate.sql
DOCS = README.$(name) \
README.xor_aggregate \
README.pgc_checksum \
README.pgc_casts
EXTRA_CLEAN = $(name).1 $(name).html pod2htm?.tmp
# get postgresql extension infrastructure
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
# derive documentation
$(name).1: $(name)
pod2man --name $(name) $< > $@
touch -r $< $@
$(name).html: $(name)
pod2html --title $(name) $< | \
sed -e '/^<body style/a<h1>$(name)</h1>' > $@
touch -r $< $@
pgsql_install: install
pgsql_uninstall: uninstall
#
# MySQL stuff
#
MY.c = $(wildcard mysql_*.c)
MY.so = $(MY.c:%.c=%.so)
MY.sql = $(MY.c:%.c=%.sql)
MY_CONFIG = mysql_config
MYDIR = $(shell $(MY_CONFIG) --plugindir)/
MYCC = $(CC) $(shell $(MY_CONFIG) --cflags)
mysql_%.so: mysql_%.c
$(MYCC) -shared -o $@ $<
chmod a+r-x $@
mysql_install: $(MY.so) $(MY.sql)
chmod a+r $(MY.sql)
cp -a $^ $(MYDIR)
mysql_uninstall:
$(RM) $(addprefix $(MYDIR),$(MY.so) $(MY.sql))
#
# SQLite stuff
#
SQLITE.libdir = /usr/local/lib
sqlite_checksum.so: sqlite_checksum.c
gcc -Wall -fPIC -shared $< -o $@
sqlite_install: sqlite_checksum.so
cp $< $(SQLITE.libdir)/
chmod a+rx $(SQLITE.libdir)/sqlite_checksum.so
sqlite_uninstall:
$(RM) $(SQLITE.libdir)/sqlite_checksum.so
clean: sqlite-clean
sqlite-clean:
$(RM) sqlite_checksum.so
#
# common cleanup
#
clean: local-clean
local-clean:
$(RM) *.so
#
# development stuff is ignored by the distribution
#
-include dev.mk