OSDN Git Service

43d395a97083a77ef2be091113d1c2b83ecc1056
[pgdbmsstats/pg_dbms_stats.git] / Makefile
1 # pg_dbms_stats/Makefile
2
3 DBMSSTATSVER = 1.5.0b1
4 PGVERS = 13
5
6 MODULE_big = pg_dbms_stats
7 OBJS = pg_dbms_stats.o dump.o import.o
8 DOCDIR = doc
9
10 ifdef UNIT_TEST
11 PG_CPPFLAGS = -DUNIT_TEST
12 endif
13
14 LAST_LIBPATH=$(shell echo $(LD_LIBRARY_PATH) | sed -e "s/^.*;//")
15 CHECKING=$(shell echo $(LAST_LIBPATH)| grep './tmp_check/install/' | wc -l)
16 EXTENSION = pg_dbms_stats
17
18 REGRESS = init-common ut_fdw_init init ut-common ut ut_imp_exp
19 EXTRA_INSTALL = contrib/file_fdw
20
21 REGRESS_OPTS = --encoding=UTF8 --temp-config=regress.conf
22
23 # Pick up only the install scripts needed for the PG version.
24 DATA = pg_dbms_stats--$(DBMSSTATSVER).sql
25
26 DOCS = $(DOCDIR)/export_effective_stats-$(MAJORVERSION).sql.sample \
27         $(DOCDIR)/export_plain_stats-$(MAJORVERSION).sql.sample
28
29 # Source tarballs required for rpmbuild
30 STARBALL = pg_dbms_stats-$(DBMSSTATSVER).tar.gz
31 STARBALLS = $(STARBALL) $(foreach v,$(PGVERS),pg_dbms_stats$(v)-$(DBMSSTATSVER).tar.gz)
32
33 # Generate RPM target names for all target PG versions
34 RPMS = $(foreach v,$(PGVERS),rpm$(v))
35
36 EXTRA_CLEAN = sql/ut_anyarray-*.sql expected/ut_anyarray-*.out \
37         sql/ut_imp_exp-*.sql expected/ut_imp_exp-*.out \
38         sql/ut_fdw_init.sql expected/ut_fdw_init.out \
39         export_stats.dmp ut-fdw.csv $(STARBALLS) RPMS/*/* \
40         *~
41
42 ifndef USE_PGXS
43 ifeq ($(wildcard ../../contrib/contrib-global.mk),)
44         USE_PGXS=1
45 endif
46 endif
47
48 ifdef USE_PGXS
49 PG_CONFIG = pg_config
50 PGXS := $(shell $(PG_CONFIG) --pgxs)
51 include $(PGXS)
52 else
53 subdir = contrib/pg_dbms_stats
54 top_builddir = ../..
55 include $(top_builddir)/src/Makefile.global
56 include $(top_srcdir)/contrib/contrib-global.mk
57 endif
58
59 TARSOURCES = Makefile *.c  *.h \
60         pg_dbms_stats.control COPYRIGHT ChangeLog ChangeLog.ja \
61         README.installcheck regress.conf $(DATA) \
62         doc/* expected/init-*.out expected/ut-*.out \
63         sql/init-*.sql sql/ut-*.sql \
64         input/*.source input/*.csv output/*.source SPECS/*.spec
65
66 LDFLAGS+=-Wl,--build-id
67
68 all: $(DOCS)
69
70 rpms: $(RPMS)
71
72 sourcetar: $(STARBALL)
73
74 # Source tar balls are the same for all target PG versions.
75 # This is because rpmbuild requires a tar ball with the same base name
76 # with target rpm file.
77 $(STARBALLS): $(TARSOURCES)
78         if [ -h $(subst .tar.gz,,$@) ]; then rm $(subst .tar.gz,,$@); fi
79         if [ -e $(subst .tar.gz,,$@) ]; then \
80           echo "$(subst .tar.gz,,$@) is not a symlink. Stop."; \
81           exit 1; \
82         fi
83         ln -s . $(subst .tar.gz,,$@)
84         tar -chzf $@ $(addprefix $(subst .tar.gz,,$@)/, $^)
85         rm $(subst .tar.gz,,$@)
86
87 $(RPMS): rpm% : SPECS/pg_dbms_stats%.spec pg_dbms_stats%-$(DBMSSTATSVER).tar.gz
88         MAKE_ROOT=`pwd` rpmbuild -bb $<
89