2018-04-17 00:21:17 +08:00
|
|
|
SHELL = bash
|
|
|
|
|
2018-04-28 03:26:46 +08:00
|
|
|
BUILD_DIR = build
|
|
|
|
DEVEL_BUILD_DIR = $(BUILD_DIR)/devel
|
|
|
|
PROD_BUILD_DIR = $(BUILD_DIR)/prod
|
|
|
|
|
|
|
|
FRONTEND_BUILD_DIR = frontend
|
|
|
|
FRONTEND_DEVEL_BUILD_DIR = $(FRONTEND_BUILD_DIR)/$(DEVEL_BUILD_DIR)
|
|
|
|
FRONTEND_DEVEL_ROOT_DIR = $(DEVEL_BUILD_DIR)
|
|
|
|
FRONTEND_PROD_BUILD_DIR = $(FRONTEND_BUILD_DIR)/$(PROD_BUILD_DIR)
|
|
|
|
FRONTEND_PROD_ROOT_DIR = $(PROD_BUILD_DIR)
|
|
|
|
|
|
|
|
API_BUILD_DIR = api
|
|
|
|
API_DEVEL_BUILD_DIR = $(API_BUILD_DIR)/$(DEVEL_BUILD_DIR)
|
|
|
|
API_DEVEL_ROOT_DIR = $(DEVEL_BUILD_DIR)
|
|
|
|
API_PROD_BUILD_DIR = $(API_BUILD_DIR)/$(PROD_BUILD_DIR)
|
|
|
|
API_PROD_ROOT_DIR = $(PROD_BUILD_DIR)
|
|
|
|
|
|
|
|
TEMPLATES_BUILD_DIR = templates
|
|
|
|
TEMPLATES_DEVEL_BUILD_DIR = $(TEMPLATES_BUILD_DIR)/$(DEVEL_BUILD_DIR)
|
2018-06-09 17:48:44 +08:00
|
|
|
TEMPLATES_DEVEL_ROOT_DIR = $(DEVEL_BUILD_DIR)
|
2018-04-28 03:26:46 +08:00
|
|
|
TEMPLATES_PROD_BUILD_DIR = $(TEMPLATES_BUILD_DIR)/$(PROD_BUILD_DIR)
|
2018-06-09 17:48:44 +08:00
|
|
|
TEMPLATES_PROD_ROOT_DIR = $(PROD_BUILD_DIR)
|
2018-04-17 00:21:17 +08:00
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
DB_BUILD_DIR = db
|
|
|
|
DB_DEVEL_BUILD_DIR = $(DB_BUILD_DIR)/$(DEVEL_BUILD_DIR)
|
|
|
|
DB_DEVEL_ROOT_DIR = $(DEVEL_BUILD_DIR)/db
|
|
|
|
DB_PROD_BUILD_DIR = $(DB_BUILD_DIR)/$(PROD_BUILD_DIR)
|
|
|
|
DB_PROD_ROOT_DIR = $(PROD_BUILD_DIR)/db
|
2018-04-28 03:10:52 +08:00
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
devel: frontend api templates db devel-copy
|
|
|
|
|
|
|
|
prod: frontend api templates db prod-copy
|
2018-04-17 00:21:17 +08:00
|
|
|
|
2018-04-17 00:22:52 +08:00
|
|
|
# TODO: This can probably be written better: instead of explicitly defining
|
|
|
|
# each target subdirectory, define them at the top and automatically do stuff.
|
|
|
|
|
2018-04-17 00:21:17 +08:00
|
|
|
.PHONY: frontend
|
|
|
|
frontend:
|
|
|
|
cd frontend && $(MAKE) $(MAKECMDGOALS)
|
|
|
|
|
|
|
|
.PHONY: api
|
|
|
|
api:
|
|
|
|
cd api && $(MAKE) $(MAKECMDGOALS)
|
|
|
|
|
2018-04-28 03:10:52 +08:00
|
|
|
.PHONY: templates
|
|
|
|
templates:
|
2018-06-09 21:25:18 +08:00
|
|
|
cd templates && $(MAKE) $(MAKECMDGOALS)
|
2018-04-28 03:10:52 +08:00
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
.PHONY: db
|
|
|
|
db:
|
2018-06-09 21:25:18 +08:00
|
|
|
cd db && $(MAKE) $(MAKECMDGOALS)
|
2018-05-27 22:39:25 +08:00
|
|
|
|
|
|
|
devel-copy: devel-copy-frontend devel-copy-api devel-copy-templates devel-copy-db
|
2018-04-17 00:21:17 +08:00
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
prod-copy: prod-copy-frontend prod-copy-api prod-copy-templates prod-copy-db
|
2018-04-17 00:21:17 +08:00
|
|
|
|
|
|
|
devel-copy-frontend:
|
2018-04-28 03:26:46 +08:00
|
|
|
cp -r $(FRONTEND_DEVEL_BUILD_DIR)/* $(FRONTEND_DEVEL_ROOT_DIR)
|
2018-04-17 00:21:17 +08:00
|
|
|
|
|
|
|
devel-copy-api:
|
2018-04-28 03:26:46 +08:00
|
|
|
cp -r $(API_DEVEL_BUILD_DIR)/* $(API_DEVEL_ROOT_DIR)
|
2018-04-17 00:21:17 +08:00
|
|
|
|
2018-04-28 03:10:52 +08:00
|
|
|
devel-copy-templates:
|
2018-04-28 03:26:46 +08:00
|
|
|
cp -r $(TEMPLATES_DEVEL_BUILD_DIR)/* $(TEMPLATES_DEVEL_ROOT_DIR)
|
2018-04-28 03:10:52 +08:00
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
devel-copy-db:
|
|
|
|
cp -r $(DB_DEVEL_BUILD_DIR)/* $(DB_DEVEL_ROOT_DIR)
|
|
|
|
|
2018-04-17 00:21:17 +08:00
|
|
|
prod-copy-frontend:
|
2018-04-28 03:26:46 +08:00
|
|
|
cp -r $(FRONTEND_PROD_BUILD_DIR)/* $(FRONTEND_PROD_ROOT_DIR)
|
2018-04-17 00:21:17 +08:00
|
|
|
|
|
|
|
prod-copy-api:
|
2018-04-28 03:26:46 +08:00
|
|
|
cp -r $(API_PROD_BUILD_DIR)/* $(API_PROD_ROOT_DIR)
|
2018-04-17 00:21:17 +08:00
|
|
|
|
2018-04-28 03:10:52 +08:00
|
|
|
prod-copy-templates:
|
2018-04-28 03:26:46 +08:00
|
|
|
cp -r $(TEMPLATES_PROD_BUILD_DIR)/* $(TEMPLATES_PROD_ROOT_DIR)
|
2018-04-28 03:10:52 +08:00
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
prod-copy-db:
|
|
|
|
cp -r $(DB_PROD_BUILD_DIR)/* $(DB_PROD_ROOT_DIR)
|
|
|
|
|
|
|
|
clean: clean-root clean-frontend clean-api clean-templates clean-db
|
2018-04-17 00:21:17 +08:00
|
|
|
|
|
|
|
clean-root:
|
|
|
|
rm -rf build
|
|
|
|
|
|
|
|
clean-frontend:
|
|
|
|
cd frontend && $(MAKE) $(MAKECMDGOALS)
|
|
|
|
|
|
|
|
clean-api:
|
|
|
|
cd api && $(MAKE) $(MAKECMDGOALS)
|
|
|
|
|
2018-04-28 03:26:46 +08:00
|
|
|
clean-templates:
|
|
|
|
cd templates && $(MAKE) $(MAKECMDGOALS)
|
|
|
|
|
2018-05-27 22:39:25 +08:00
|
|
|
clean-db:
|
|
|
|
cd db && $(MAKE) $(MAKECMDGOALS)
|
|
|
|
|
2018-04-28 03:26:46 +08:00
|
|
|
$(shell mkdir -p $(FRONTEND_DEVEL_ROOT_DIR) $(API_DEVEL_ROOT_DIR) $(TEMPLATES_DEVEL_ROOT_DIR) $(FRONTEND_PROD_ROOT_DIR) $(API_PROD_ROOT_DIR) $(TEMPLATES_DEVEL_ROOT_DIR))
|