diff --git a/Makefile b/Makefile index c72ddd6202a0..cf15f047dfb1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: nix-add-gcroots clean nix-clean disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-node-perms +.PHONY: nix-add-gcroots clean nix-clean disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-node-perms tmpdir-mk tmpdir-rm help: SHELL := /bin/sh help: ##@other Show this help @@ -31,10 +31,21 @@ HOST_OS := $(shell uname | tr '[:upper:]' '[:lower:]') export _NIX_KEEP ?= BUILD_ENV export NIX_CONF_DIR = $(PWD)/nix # We don't want to use /run/user/$UID because it runs out of space too easilly -export TMPDIR = /tmp +export TMPDIR = /tmp/tmp-status-react export REACT_SERVER_PORT ?= 5001 # any value different from default 5000 will work; this has to be specified for both the Node.JS server process and the Qt process +#---------------- +# Required targets +#---------------- + +tmpdir-mk: SHELL := /bin/sh +tmpdir-mk: ##@prepare Create a TMPDIR for temporary files + @mkdir -p "$(TMPDIR)" + +# Run these tasks every time make is called +-include tmpdir-mk + #---------------- # Nix targets #---------------- @@ -85,19 +96,12 @@ _fix-node-perms: ##@prepare Fix permissions so that directory can be cleaned $(shell test -d node_modules && chmod -R 744 node_modules) $(shell test -d node_modules.tmp && chmod -R 744 node_modules.tmp) +tmpdir-rm: ##@prepare Remove TMPDIR + rm -r "$(TMPDIR)" + clean: SHELL := /bin/sh -clean: _fix-node-perms ##@prepare Remove all output folders - echo "Cleaning status-react repo ..."; \ - git clean -dxf -f; \ - echo "Cleaning Yarn/Metro caches in temp dirs ..."; \ - for d in "$$TMPDIR" "/tmp"; do \ - if [ -d "$$d" ]; then \ - pushd $$TMPDIR; \ - rm -rf ./*metro*; \ - rm -rf ./*yarn*; \ - popd; \ - fi; \ - done +clean: _fix-node-perms tmpdir-rm ##@prepare Remove all output folders + git clean -dxf -f watchman-clean: export _NIX_ATTR := targets.watchman.shell watchman-clean: ##@prepare Delete repo directory from watchman