commento/Makefile

72 lines
1.8 KiB
Makefile
Raw Normal View History

2018-04-17 00:21:17 +08:00
SHELL = bash
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_PROD_BUILD_DIR = $(FRONTEND_BUILD_DIR)/$(PROD_BUILD_DIR)
API_BUILD_DIR = api
API_DEVEL_BUILD_DIR = $(API_BUILD_DIR)/$(DEVEL_BUILD_DIR)
API_PROD_BUILD_DIR = $(API_BUILD_DIR)/$(PROD_BUILD_DIR)
2018-04-28 03:10:52 +08:00
TMPL_BUILD_DIR = templates
TMPL_DEVEL_BUILD_DIR = $(TMPL_BUILD_DIR)/$(DEVEL_BUILD_DIR)
TMPL_PROD_BUILD_DIR = $(TMPL_BUILD_DIR)/$(PROD_BUILD_DIR)
2018-04-17 00:21:17 +08:00
2018-04-28 03:10:52 +08:00
devel: frontend api templates devel-copy
prod: frontend api templates 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:
cd templates && $(MAKE) $(MAKECDMGOALS)
devel-copy: devel-copy-frontend devel-copy-api devel-copy-templates
2018-04-17 00:21:17 +08:00
2018-04-28 03:10:52 +08:00
prod-copy: prod-copy-frontend prod-copy-api prod-copy-templates
2018-04-17 00:21:17 +08:00
devel-copy-frontend:
cp -r $(FRONTEND_DEVEL_BUILD_DIR)/* $(DEVEL_BUILD_DIR)
devel-copy-api:
cp -r $(API_DEVEL_BUILD_DIR)/* $(DEVEL_BUILD_DIR)
2018-04-28 03:10:52 +08:00
devel-copy-templates:
cp -r $(TMPL_DEVEL_BUILD_DIR)/* $(DEVEL_BUILD_DIR)
2018-04-17 00:21:17 +08:00
prod-copy-frontend:
cp -r $(FRONTEND_PROD_BUILD_DIR)/* $(PROD_BUILD_DIR)
prod-copy-api:
cp -r $(API_PROD_BUILD_DIR)/* $(PROD_BUILD_DIR)
2018-04-28 03:10:52 +08:00
prod-copy-templates:
cp -r $(TMPL_PROD_BUILD_DIR)/* $(PROD_BUILD_DIR)
2018-04-17 00:21:17 +08:00
clean: clean-root clean-frontend clean-api
clean-root:
rm -rf build
clean-frontend:
cd frontend && $(MAKE) $(MAKECMDGOALS)
clean-api:
cd api && $(MAKE) $(MAKECMDGOALS)
$(shell mkdir -p $(DEVEL_BUILD_DIR) $(PROD_BUILD_DIR))