-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (25 loc) · 1.15 KB
/
Makefile
File metadata and controls
41 lines (25 loc) · 1.15 KB
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
PREFIX=/home/sven/diplom/local/
PGSERVERINCLUDE:= $(shell ${PREFIX}/bin/pg_config --includedir-server)
PGLIBDIR:= $(shell ${PREFIX}/bin/pg_config --pkglibdir)
PLPGSQLSRC:=/home/sven/diplom/postgresql/src/pl/plpgsql/src
CWD:= $(shell pwd)
INCLUDE= -I${PGSERVERINCLUDE} -I${PLPGSQLSRC}
CFLAGS= -fpic -Wall -g ${INCLUDE} -L${PREFIX}lib
CC=gcc
HEADER_FILES= $(wildcard *.h)
SOURCE_FILES= $(wildcard *.c)
OBJECTS= $(patsubst %.c,%.o, ${SOURCE_FILES})
all: test
binary: dump_module.so
dump_module.so: Makefile ${OBJECTS}
gcc ${CFLAGS} -shared -o dump_module.so ${OBJECTS} ${PGLIBDIR}/plpgsql.so
clean:
rm *.so *.o
test: install_functions
${PREFIX}bin/psql < test.sql
check: install_functions
${PREFIX}bin/psql -t -q < test.sql | xmllint --format -
install_functions: binary
${PREFIX}bin/psql -q -c "CREATE OR REPLACE FUNCTION dump_plpgsql_function(oid) returns text AS '${CWD}/dump_module.so', 'dump_plpgsql_function' LANGUAGE C STRICT;"
${PREFIX}bin/psql -q -c "CREATE OR REPLACE FUNCTION dump_sql_parse_tree(text) returns text AS '${CWD}/dump_module.so', 'dump_sql_parse_tree' LANGUAGE C STRICT;"
.PHONY: all clean binary test nice install_functions