From 60e7e59841e55e4f3adbf6abf7bdc5432598ef47 Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Sun, 27 May 2018 20:09:50 +0530 Subject: [PATCH] db: add Makefile --- db/Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 db/Makefile 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))