Modularize Makefile into client and server Makefiles

Part of the reason that the Makefile in the root directory is a bit
complicated is that it tries to handle tasks that can be handled
separately in the client and server modules.

This commit pushes some of the make logic specific to each module into
their own makefiles and calls out to those makefiles from that in the
project root.
This commit is contained in:
Matt Weiden
2019-12-19 15:19:22 -08:00
parent 12845c9300
commit cc0880560b
3 changed files with 37 additions and 17 deletions
+21 -17
View File
@@ -5,12 +5,30 @@ CLEANFILES := $(BUILDDIR)/ client/build build dist cellxgene.egg-info
PART ?= patch
# CLEANING
.PHONY: clean
clean: clean-lite clean-server clean-client
# cleaning the client's node_modules is the longest one, so we avoid that if possible
.PHONY: clean-lite
clean-lite:
rm -rf $(CLEANFILES)
clean-%:
cd $(*) && $(MAKE) clean
# BUILDING PACKAGE
.PHONY: build
build: clean build-server
@echo "done"
.PHONY: build-client
build-client:
cd client && $(MAKE) install build
.PHONY: build-server
build-server: build-client
mkdir -p $(SERVERBUILD)
@@ -24,11 +42,6 @@ build-server: build-client
cp $(CLIENTBUILD)/service-worker.js $(SERVERBUILD)/app/web/static/js/
cp MANIFEST.in README.md setup.cfg setup.py $(BUILDDIR)
.PHONY: build-client
build-client:
npm install --prefix client/ client
npm run --prefix client build
# If you are actively developing in the server folder use this, dirties the source tree
.PHONY: build-for-server-dev
build-for-server-dev: clean-server build-client
@@ -40,19 +53,8 @@ build-for-server-dev: clean-server build-client
cp client/build/favicon.png server/app/web/static/img
cp client/build/service-worker.js server/app/web/static/js/
.PHONY: clean
clean: clean-lite clean-server
rm -rf client/node_modules
# cleaning node_modules is the longest one, so we avoid that if possible
.PHONY: clean-lite
clean-lite:
rm -rf $(CLEANFILES)
.PHONY: clean-server
clean-server:
rm -f server/app/web/templates/index.html
rm -rf server/app/web/static
# CREATING DISTRIBUTION RELEASE
@@ -61,6 +63,7 @@ pydist: build
cd $(BUILDDIR); python setup.py sdist -d ../dist
@echo "done"
# RELEASE HELPERS
# create new version to commit to master
@@ -91,6 +94,7 @@ release-directly-to-prod: dev-env pydist twine-prod
.PHONY: dev-env
dev-env:
cd client && make install
pip install -r server/requirements-dev.txt
.PHONY: gui-env
@@ -113,7 +117,7 @@ twine-prod:
# quicker than re-building client
.PHONY: gen-package-lock
gen-package-lock:
npm install --prefix client/ client
cd client && $(MAKE) install
# INSTALL
+12
View File
@@ -0,0 +1,12 @@
.PHONY: install
install:
npm install client
.PHONY: build
build: install
npm run build
.PHONY: clean
clean:
rm -rf node_modules
+4
View File
@@ -0,0 +1,4 @@
.PHONY: clean
clean:
rm -f app/web/templates/index.html
rm -rf app/web/static