Makefile: fix dependency graph to allow -j8

Previously, the dependency graph was messed up; the copy target was
a dependency of the root target, making it run concurrently when a
-j8 flag is passed to make. This causes make to copy the build files
before they are even built.

With this change, each component copies its own files after building.
This commit is contained in:
Adhityaa Chandrasekar 2018-08-08 11:04:11 +05:30
parent 3ad5128cb9
commit e87367d22f

View File

@ -28,9 +28,9 @@ DB_DEVEL_ROOT_DIR = $(DEVEL_BUILD_DIR)/db
DB_PROD_BUILD_DIR = $(DB_BUILD_DIR)/$(PROD_BUILD_DIR) DB_PROD_BUILD_DIR = $(DB_BUILD_DIR)/$(PROD_BUILD_DIR)
DB_PROD_ROOT_DIR = $(PROD_BUILD_DIR)/db DB_PROD_ROOT_DIR = $(PROD_BUILD_DIR)/db
devel: frontend api templates db devel-copy devel: devel-frontend devel-api devel-templates devel-db
prod: frontend api templates db prod-copy prod: prod-frontend prod-api prod-templates prod-db
test: api test: api
@ -53,32 +53,28 @@ templates:
db: db:
cd db && $(MAKE) $(MAKECMDGOALS) cd db && $(MAKE) $(MAKECMDGOALS)
devel-copy: devel-copy-frontend devel-copy-api devel-copy-templates devel-copy-db devel-frontend: frontend
prod-copy: prod-copy-frontend prod-copy-api prod-copy-templates prod-copy-db
devel-copy-frontend:
cp -r $(FRONTEND_DEVEL_BUILD_DIR)/* $(FRONTEND_DEVEL_ROOT_DIR) cp -r $(FRONTEND_DEVEL_BUILD_DIR)/* $(FRONTEND_DEVEL_ROOT_DIR)
devel-copy-api: devel-api: api
cp -r $(API_DEVEL_BUILD_DIR)/* $(API_DEVEL_ROOT_DIR) cp -r $(API_DEVEL_BUILD_DIR)/* $(API_DEVEL_ROOT_DIR)
devel-copy-templates: devel-templates: templates
cp -r $(TEMPLATES_DEVEL_BUILD_DIR)/* $(TEMPLATES_DEVEL_ROOT_DIR) cp -r $(TEMPLATES_DEVEL_BUILD_DIR)/* $(TEMPLATES_DEVEL_ROOT_DIR)
devel-copy-db: devel-db: db
cp -r $(DB_DEVEL_BUILD_DIR)/* $(DB_DEVEL_ROOT_DIR) cp -r $(DB_DEVEL_BUILD_DIR)/* $(DB_DEVEL_ROOT_DIR)
prod-copy-frontend: prod-frontend: frontend
cp -r $(FRONTEND_PROD_BUILD_DIR)/* $(FRONTEND_PROD_ROOT_DIR) cp -r $(FRONTEND_PROD_BUILD_DIR)/* $(FRONTEND_PROD_ROOT_DIR)
prod-copy-api: prod-api: api
cp -r $(API_PROD_BUILD_DIR)/* $(API_PROD_ROOT_DIR) cp -r $(API_PROD_BUILD_DIR)/* $(API_PROD_ROOT_DIR)
prod-copy-templates: prod-templates: templates
cp -r $(TEMPLATES_PROD_BUILD_DIR)/* $(TEMPLATES_PROD_ROOT_DIR) cp -r $(TEMPLATES_PROD_BUILD_DIR)/* $(TEMPLATES_PROD_ROOT_DIR)
prod-copy-db: prod-db: db
cp -r $(DB_PROD_BUILD_DIR)/* $(DB_PROD_ROOT_DIR) cp -r $(DB_PROD_BUILD_DIR)/* $(DB_PROD_ROOT_DIR)
clean: clean-root clean-frontend clean-api clean-templates clean-db clean: clean-root clean-frontend clean-api clean-templates clean-db