DEPLOY_HOST=lmno.games DEPLOY_DIR=/srv/lmno.games/www DO_NOT_DEPLOY=Makefile deps *.jsx .babelrc .gitignore README DO_NOT_DELETE=flempires REACT_DEPS=react.js react-dom.js REACT_DOWNLOADS=\ deps/react.development.js \ deps/react-dom.development.js \ deps/react.production.min.js \ deps/react-dom.production.min.js JSX_SOURCE=$(wildcard */*.jsx) JS_TARGETS=$(JSX_SOURCE:.jsx=.js) all: $(JS_TARGETS) $(REACT_DEPS) # Execute either of the following to build things: # # For a development build: # # make # # For a production build: # # make LMNO_BUILD=production # # Note: To switch between these two, either issue a "make clean" # or otherwise start in a clean source tree (such as a # after a fresh "git clone" or use "git clean -f -x -d). # ifeq ($(LMNO_BUILD),production) react.js: deps/react.production.min.js cp $^ $@ react-dom.js: deps/react-dom.production.min.js cp $^ $@ %.js: %.jsx BABEL_ENV=production babeljs $^ --out-file $@ else react.js: deps/react.development.js cp $^ $@ react-dom.js: deps/react-dom.development.js cp $^ $@ %.js: %.jsx BABEL_ENV=development babeljs $^ --out-file $@ endif checksums: $(REACT_DOWNLOADS) sha512sum --strict -c checksums.sha512 deps/react.development.js: wget -nv -nc -P deps https://unpkg.com/react@16/umd/react.development.js deps/react-dom.development.js: wget -nv -nc -P deps https://unpkg.com/react-dom@16/umd/react-dom.development.js deps/react.production.min.js: wget -nv -nc -P deps https://unpkg.com/react@16/umd/react.production.min.js deps/react-dom.production.min.js: wget -nv -nc -P deps https://unpkg.com/react-dom@16/umd/react-dom.production.min.js deploy: rm -rf .deploy-source git clone . .deploy-source make -C .deploy-source LMNO_BUILD=production rm -rf .deploy-source/.git (cd .deploy-source; rsync -avz \ $(DO_NOT_DEPLOY:%=--exclude=%) \ --exclude=$(DO_NOT_DELETE) \ --delete \ --delete-after \ ./ $(DEPLOY_HOST):$(DEPLOY_DIR) ) rm -rf .deploy-source clean: rm -f $(JS_TARGETS) rm -f $(REACT_DEPS) rm -f $(REACT_DOWNLOADS)