cartodb-postgresql/Makefile

117 lines
2.9 KiB
Makefile
Raw Normal View History

2013-12-02 23:29:02 +08:00
# cartodb/Makefile
EXTENSION = cartodb
2015-02-19 00:31:04 +08:00
EXTVERSION = 0.6.0
2013-12-02 23:29:02 +08:00
2014-06-04 18:58:19 +08:00
SED = sed
2013-12-02 23:29:02 +08:00
CDBSCRIPTS = \
scripts-enabled/*.sql \
scripts-available/CDB_SearchPath.sql \
scripts-available/CDB_DDLTriggers.sql \
scripts-available/CDB_ExtensionPost.sql \
scripts-available/CDB_ExtensionUtils.sql \
$(END)
UPGRADABLE = \
unpackaged \
0.1.0 \
0.1.1 \
2014-06-09 19:04:42 +08:00
0.2.0 \
0.2.1 \
2014-07-16 18:30:19 +08:00
0.3.0 \
2014-07-28 21:16:19 +08:00
0.3.0dev \
2014-07-28 23:53:19 +08:00
0.3.1 \
0.3.2 \
2014-08-02 00:21:48 +08:00
0.3.3 \
0.3.4 \
2014-08-11 22:18:02 +08:00
0.3.5 \
0.3.6 \
2014-10-21 22:19:44 +08:00
0.4.0 \
0.4.1 \
2014-12-06 00:30:47 +08:00
0.5.0 \
2015-01-30 00:37:59 +08:00
0.5.1 \
2015-02-17 22:47:18 +08:00
0.5.2 \
2015-02-19 00:31:04 +08:00
0.5.3 \
$(EXTVERSION)dev \
$(EXTVERSION)next \
$(END)
UPGRADES = \
$(shell echo $(UPGRADABLE) | \
2014-06-04 18:58:19 +08:00
$(SED) 's/^/$(EXTENSION)--/' | \
$(SED) 's/$$/--$(EXTVERSION).sql/' | \
$(SED) 's/ /--$(EXTVERSION).sql $(EXTENSION)--/g')
GITDIR=$(shell test -d .git && echo '.git' || cat .git | $(SED) 's/^gitdir: //')
DATA_built = \
$(EXTENSION)--$(EXTVERSION).sql \
$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql \
$(UPGRADES) \
$(EXTENSION).control
EXTRA_CLEAN = cartodb_version.sql
DOCS = README.md
REGRESS_NEW = test_ddl_triggers
REGRESS_OLD = $(wildcard test/*.sql)
REGRESS_LEGACY = $(REGRESS_OLD:.sql=)
REGRESS = test_setup $(REGRESS_NEW) $(REGRESS_LEGACY)
2013-12-02 23:29:02 +08:00
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
$(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_version.sql Makefile
echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@
cat $(CDBSCRIPTS) | \
$(SED) -e 's/public\./cartodb./g' \
-e 's/:DATABASE_USERNAME/cdb_org_admin/g' >> $@
2014-05-05 18:20:38 +08:00
echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@
2014-05-08 16:07:47 +08:00
cat cartodb_version.sql >> $@
$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql util/create_from_unpackaged.sh Makefile
./util/create_from_unpackaged.sh $(EXTVERSION)
$(EXTENSION)--%--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql
cp $< $@
$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: $(EXTENSION)--$(EXTVERSION).sql
cp $< $@
$(EXTENSION).control: $(EXTENSION).control.in Makefile
2014-06-04 18:58:19 +08:00
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' $< > $@
cartodb_version.sql: cartodb_version.sql.in Makefile $(GITDIR)/index
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' $< > $@
2014-05-08 16:07:47 +08:00
legacy_regress: $(REGRESS_OLD) Makefile
mkdir -p sql/test/
mkdir -p expected/test/
mkdir -p results/test/
for f in $(REGRESS_OLD); do \
tn=`basename $${f} .sql`; \
of=sql/test/$${tn}.sql; \
2015-02-17 22:40:26 +08:00
echo '\\set ECHO none' > $${of}; \
echo '\\a' >> $${of}; \
echo '\\t' >> $${of}; \
echo '\\set QUIET off' >> $${of}; \
cat $${f} | \
$(SED) -e 's/public\./cartodb./g' >> $${of}; \
exp=expected/test/$${tn}.out; \
2015-02-17 22:40:26 +08:00
echo '\\set ECHO none' > $${exp}; \
cat test/$${tn}_expect >> $${exp}; \
done
test_organization:
bash test/organization/test.sh
test_extension_new:
bash test/extension/test.sh
legacy_tests: legacy_regress
installcheck: legacy_tests test_extension_new test_organization