############################################################################
#  Copyright (C) 2008 Nippon Telegraph and Telephone Corporation
############################################################################

MODULE_big = stats_info
PG_CPPFLAGS = -I$(libpq_srcdir)
DATA_built = stats_info.sql
DATA = uninstall_stats_info.sql
OBJS = stats_info.o

ifndef MAJORVERSION
MAJORVERSION = $(basename $(VERSION))
endif

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
ifeq ($(MAJORVERSION),8.3)
stats_info.sql.in:
	cp stats_info.83_sql.in stats_info.sql.in
	cp uninstall_stats_info_83.sql uninstall_stats_info.sql
else
stats_info.sql.in:
	cp stats_info.84_sql.in stats_info.sql.in
	cp uninstall_stats_info_84.sql uninstall_stats_info.sql
endif
else
REGRESS = init stats #fini
subdir = contrib/stats_info
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
ifeq ($(MAJORVERSION),8.3)
stats_info.sql.in:
	cp stats_info.83_sql.in stats_info.sql.in
	cp uninstall_stats_info_83.sql uninstall_stats_info.sql
expected/init.out: expected/init.83.out
	cp expected/init.83.out expected/init.out
expected/stats.out: expected/stats.83.out
	cp expected/stats.83.out expected/stats.out
else
stats_info.sql.in:
	cp stats_info.84_sql.in stats_info.sql.in
	cp uninstall_stats_info_84.sql uninstall_stats_info.sql
expected/init.out: expected/init.84.out
	cp expected/init.84.out expected/init.out
expected/stats.out: expected/stats.84.out
	cp expected/stats.84.out expected/stats.out
endif
endif

.PHONY: subclean
clean: subclean

subclean:
	rm -rf stats_info.sql.in uninstall_stats_info.sql expected/init.out expected/stats.out

installcheck: expected/init.out expected/stats.out
