commento/db/Makefile

32 lines
905 B
Makefile
Raw Permalink Normal View History

2018-05-27 22:39:50 +08:00
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)
2018-06-03 16:34:56 +08:00
DB_DEVEL_BUILD_DIR = $(DEVEL_BUILD_DIR)/db
2018-05-27 22:39:50 +08:00
DB_DEVEL_BUILD_FILES = $(patsubst $(DB_SRC_DIR)/%, $(DB_DEVEL_BUILD_DIR)/%, $(DB_SRC_FILES))
2018-06-03 16:34:56 +08:00
DB_PROD_BUILD_DIR = $(PROD_BUILD_DIR)/db
2018-05-27 22:39:50 +08:00
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 $^ $@;
2018-06-04 16:22:06 +08:00
prod-db: $(DB_PROD_BUILD_FILES)
2018-05-27 22:39:50 +08:00
$(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))