diff --git a/db/Makefile b/db/Makefile new file mode 100644 index 0000000..f534f12 --- /dev/null +++ b/db/Makefile @@ -0,0 +1,31 @@ +SHELL = bash + +BUILD_DIR = build +DEVEL_BUILD_DIR = $(BUILD_DIR)/devel +PROD_BUILD_DIR = $(BUILD_DIR)/prod + +DB_SRC_DIR = . +DB_SRC_FILES = $(wildcard $(DB_SRC_DIR)/*.sql) +DB_DEVEL_BUILD_DIR = $(DEVEL_BUILD_DIR) +DB_DEVEL_BUILD_FILES = $(patsubst $(DB_SRC_DIR)/%, $(DB_DEVEL_BUILD_DIR)/%, $(DB_SRC_FILES)) +DB_PROD_BUILD_DIR = $(PROD_BUILD_DIR) +DB_PROD_BUILD_FILES = $(patsubst $(DB_SRC_DIR)/%, $(DB_PROD_BUILD_DIR)/%, $(DB_SRC_FILES)) + +devel: devel-db + +prod: prod-db + +clean: + rm -rf $(BUILD_DIR) + +devel-db: $(DB_DEVEL_BUILD_FILES) + +$(DB_DEVEL_BUILD_FILES): $(DB_DEVEL_BUILD_DIR)/%.sql: $(DB_SRC_DIR)/%.sql + cp $^ $@; + +prod-templates: $(DB_PROD_BUILD_FILES) + +$(DB_PROD_BUILD_FILES): $(DB_PROD_BUILD_DIR)/%.sql: $(DB_SRC_DIR)/%.sql + cp $^ $@; + +$(shell mkdir -p $(DB_DEVEL_BUILD_DIR) $(DB_PROD_BUILD_DIR))