2013-12-02 23:29:02 +08:00
|
|
|
# cartodb/Makefile
|
|
|
|
|
|
|
|
EXTENSION = cartodb
|
2014-07-23 00:15:17 +08:00
|
|
|
EXTVERSION = 0.3.1
|
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
|
|
|
|
2014-05-01 01:03:14 +08:00
|
|
|
CDBSCRIPTS = \
|
2014-05-05 23:13:06 +08:00
|
|
|
scripts-enabled/*.sql \
|
2014-05-19 19:26:01 +08:00
|
|
|
scripts-available/CDB_SearchPath.sql \
|
2014-05-23 23:40:14 +08:00
|
|
|
scripts-available/CDB_DDLTriggers.sql \
|
|
|
|
scripts-available/CDB_ExtensionPost.sql \
|
2014-06-04 16:28:48 +08:00
|
|
|
scripts-available/CDB_ExtensionUtils.sql \
|
2014-05-01 01:03:14 +08:00
|
|
|
$(END)
|
|
|
|
|
2014-05-28 15:43:21 +08:00
|
|
|
UPGRADABLE = \
|
|
|
|
unpackaged \
|
|
|
|
0.1.0 \
|
|
|
|
0.1.1 \
|
2014-06-09 19:04:42 +08:00
|
|
|
0.2.0 \
|
2014-06-12 01:30:32 +08:00
|
|
|
0.2.1 \
|
2014-07-16 18:30:19 +08:00
|
|
|
0.3.0 \
|
2014-07-17 21:43:19 +08:00
|
|
|
$(EXTVERSION)dev \
|
2014-05-28 15:43:21 +08:00
|
|
|
$(EXTVERSION)next \
|
2014-05-01 01:03:14 +08:00
|
|
|
$(END)
|
|
|
|
|
2014-05-28 15:43:21 +08:00
|
|
|
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')
|
2014-05-28 15:43:21 +08:00
|
|
|
|
2014-06-03 19:20:49 +08:00
|
|
|
REV=$(shell git describe)
|
2014-06-06 22:13:47 +08:00
|
|
|
GITDIR=$(shell test -d .git && echo '.git' || cat .git | $(SED) 's/^gitdir: //')
|
2014-06-03 19:20:49 +08:00
|
|
|
|
2014-05-08 15:58:58 +08:00
|
|
|
DATA_built = \
|
|
|
|
$(EXTENSION)--$(EXTVERSION).sql \
|
2014-05-28 15:43:21 +08:00
|
|
|
$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql \
|
|
|
|
$(UPGRADES) \
|
2014-05-27 21:51:45 +08:00
|
|
|
$(EXTENSION).control
|
|
|
|
|
|
|
|
EXTRA_CLEAN = cartodb_version.sql
|
2014-05-08 15:58:58 +08:00
|
|
|
|
2014-05-01 01:03:14 +08:00
|
|
|
DOCS = README.md
|
2014-05-06 16:18:38 +08:00
|
|
|
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)
|
|
|
|
|
2014-05-23 23:40:14 +08:00
|
|
|
$(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_version.sql Makefile
|
2014-05-14 18:39:53 +08:00
|
|
|
echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@
|
2014-05-06 00:04:14 +08:00
|
|
|
cat $(CDBSCRIPTS) | \
|
2014-06-04 21:11:30 +08:00
|
|
|
$(SED) -e 's/public\./cartodb./g' \
|
2014-05-06 00:04:14 +08:00
|
|
|
-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 >> $@
|
2014-05-06 16:18:38 +08:00
|
|
|
|
2014-05-08 15:58:58 +08:00
|
|
|
$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql util/create_from_unpackaged.sh Makefile
|
|
|
|
./util/create_from_unpackaged.sh $(EXTVERSION)
|
|
|
|
|
2014-05-28 15:43:21 +08:00
|
|
|
$(EXTENSION)--%--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
$(EXTENSION)--$(EXTVERSION)--$(EXTVERSION)next.sql: $(EXTENSION)--$(EXTVERSION).sql
|
|
|
|
cp $< $@
|
|
|
|
|
2014-05-23 22:43:01 +08:00
|
|
|
$(EXTENSION).control: $(EXTENSION).control.in Makefile
|
2014-06-04 18:58:19 +08:00
|
|
|
$(SED) -e 's/@@VERSION@@/$(EXTVERSION)/' $< > $@
|
2014-05-08 00:06:20 +08:00
|
|
|
|
2014-06-06 22:13:47 +08:00
|
|
|
cartodb_version.sql: cartodb_version.sql.in Makefile $(GITDIR)/index
|
2014-06-04 18:58:19 +08:00
|
|
|
$(SED) -e 's/@@VERSION@@/$(EXTVERSION) $(REV)/' $< > $@
|
2014-05-08 16:07:47 +08:00
|
|
|
|
2014-05-06 16:18:38 +08:00
|
|
|
legacy_regress: $(REGRESS_OLD) Makefile
|
|
|
|
mkdir -p sql/test/
|
|
|
|
mkdir -p expected/test/
|
2014-05-08 16:31:23 +08:00
|
|
|
mkdir -p results/test/
|
2014-05-06 16:18:38 +08:00
|
|
|
for f in $(REGRESS_OLD); do \
|
|
|
|
tn=`basename $${f} .sql`; \
|
|
|
|
of=sql/test/$${tn}.sql; \
|
|
|
|
echo '\\set ECHO off' > $${of}; \
|
|
|
|
echo '\\a' >> $${of}; \
|
|
|
|
echo '\\t' >> $${of}; \
|
|
|
|
echo '\\set QUIET off' >> $${of}; \
|
|
|
|
cat $${f} | \
|
2014-06-04 21:11:30 +08:00
|
|
|
$(SED) -e 's/public\./cartodb./g' >> $${of}; \
|
2014-05-06 16:18:38 +08:00
|
|
|
exp=expected/test/$${tn}.out; \
|
|
|
|
echo '\\set ECHO off' > $${exp}; \
|
|
|
|
cat test/$${tn}_expect >> $${exp}; \
|
|
|
|
done
|
|
|
|
|
2014-06-16 22:10:53 +08:00
|
|
|
test_organization:
|
2014-06-16 22:28:28 +08:00
|
|
|
bash test/organization/test.sh
|
2014-06-16 22:10:53 +08:00
|
|
|
|
2014-05-06 16:18:38 +08:00
|
|
|
legacy_tests: legacy_regress
|
|
|
|
|
2014-06-16 22:10:53 +08:00
|
|
|
installcheck: legacy_tests test_organization
|
2014-05-06 16:18:38 +08:00
|
|
|
|