# Makefile
# 	 Makefile for the pl/perlu triggers that restrict certain updates 
# 	 to the target table
#
subdir = contrib/check_updates

out_in := $(wildcard expected/*.out.in)
out := $(out_in:.out.in=.out)

DATA = deny_updates.sql check_updates.sql
DATA_built = allow_on_condition.sql
REGRESS = deny_updates_test allow_on_condition_test check_updates_test
PG_CONFIG = pg_config

PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

noassert: all

all:
ifeq (,$(findstring noassert, $(MAKECMDGOALS)))
	@echo "Assertions are enabled"
else
	@echo "Assertions are disabled"
endif
	@echo "Run make install to install the trigger functions"

# Remove # <ASSERT> unless our make target is noassert, in which case
# just copy over the files.
%.sql: %.sql.in
ifeq (, $(findstring noassert, $(MAKECMDGOALS)))
	@sed 's,^[[:space:]]*#[[:space:]]*<ASSERT>,,' <$< >$@
else
	@cp $< $@
endif
