OSDN Git Service

Add RPM SPEC file for 9.6
[pgstoreplans/pg_store_plans.git] / Makefile
1 # pg_stat_plan/Makefile
2
3 MODULES = pg_store_plans
4 STOREPLANSVER = 1.1
5
6 MODULE_big = pg_store_plans
7 OBJS = pg_store_plans.o pgsp_json.o pgsp_json_text.o pgsp_explain.o
8
9 EXTENSION = pg_store_plans
10 DATA = pg_store_plans--1.1.sql pg_store_plans--1.0--1.1.sql
11
12 REGRESS = all
13 REGRESS_OPTS = --temp-config=regress.conf
14 ifdef USE_PGXS
15 PG_CONFIG = pg_config
16 PGXS := $(shell $(PG_CONFIG) --pgxs)
17 include $(PGXS)
18 else
19 subdir = contrib/pg_store_plans
20 top_builddir = ../..
21 include $(top_builddir)/src/Makefile.global
22 include $(top_srcdir)/contrib/contrib-global.mk
23 endif
24
25 STARBALL96 = pg_store_plans96-$(STOREPLANSVER).tar.gz
26 STARBALL95 = pg_store_plans95-$(STOREPLANSVER).tar.gz
27 STARBALL94 = pg_store_plans94-$(STOREPLANSVER).tar.gz
28 STARBALLS = $(STARBALL94) $(STARBALL95) $(STARBALL96)
29
30 TARSOURCES = Makefile *.c  *.h \
31         pg_store_plans--*.sql \
32         pg_store_plans.control \
33         doc/* expected/*.out sql/*.sql \
34
35 ## These entries need running server
36 DBNAME = postgres
37
38 rpms: rpm94 rpm95 rpm96
39
40 $(STARBALLS): $(TARSOURCES)
41         if [ -h $(subst .tar.gz,,$@) ]; then rm $(subst .tar.gz,,$@); fi
42         if [ -e $(subst .tar.gz,,$@) ]; then \
43           echo "$(subst .tar.gz,,$@) is not a symlink. Stop."; \
44           exit 1; \
45         fi
46         ln -s . $(subst .tar.gz,,$@)
47         tar -chzf $@ $(addprefix $(subst .tar.gz,,$@)/, $^)
48         rm $(subst .tar.gz,,$@)
49
50 rpm94: $(STARBALL94)
51         MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans94.spec
52
53 rpm95: $(STARBALL95)
54         MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans95.spec
55
56 rpm96: $(STARBALL96)
57         MAKE_ROOT=`pwd` rpmbuild -bb SPECS/pg_store_plans96.spec
58
59 testfiles: all.out all.sql
60
61 all.out: all.sql
62         psql $(DBNAME) -a -q -f all.sql > all.out
63
64 all.sql: makeplanfile.sql json2sql.pl
65         psql $(DBNAME) -f makeplanfile.sql | ./json2sql.pl > all.sql
66
67 clean-testfiles:
68         rm -f all.out all.sql
69
70 deploy-testfiles: testfiles
71         mv all.sql sql/
72         mv all.out expected/