1 # pg_dbms_stats/Makefile
6 MODULE_big = pg_dbms_stats
7 OBJS = pg_dbms_stats.o dump.o import.o
11 PG_CPPFLAGS = -DUNIT_TEST
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
18 REGRESS = init-common ut_fdw_init init ut-common ut ut_imp_exp
19 EXTRA_INSTALL = contrib/file_fdw
21 REGRESS_OPTS = --encoding=UTF8 --temp-config=regress.conf
23 # Pick up only the install scripts needed for the PG version.
24 DATA = pg_dbms_stats--$(DBMSSTATSVER).sql
26 DOCS = $(DOCDIR)/export_effective_stats-$(MAJORVERSION).sql.sample \
27 $(DOCDIR)/export_plain_stats-$(MAJORVERSION).sql.sample
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)
33 # Generate RPM target names for all target PG versions
34 RPMS = $(foreach v,$(PGVERS),rpm$(v))
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/*/* \
43 ifeq ($(wildcard ../../contrib/contrib-global.mk),)
50 PGXS := $(shell $(PG_CONFIG) --pgxs)
53 subdir = contrib/pg_dbms_stats
55 include $(top_builddir)/src/Makefile.global
56 include $(top_srcdir)/contrib/contrib-global.mk
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
66 LDFLAGS+=-Wl,--build-id
72 sourcetar: $(STARBALL)
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."; \
83 ln -s . $(subst .tar.gz,,$@)
84 tar -chzf $@ $(addprefix $(subst .tar.gz,,$@)/, $^)
85 rm $(subst .tar.gz,,$@)
87 $(RPMS): rpm% : SPECS/pg_dbms_stats%.spec pg_dbms_stats%-$(DBMSSTATSVER).tar.gz
88 MAKE_ROOT=`pwd` rpmbuild -bb $<