Skip to content

Commit

Permalink
customize value of TMPDIR to simplify cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <jakub@status.im>
  • Loading branch information
jakubgs committed Oct 14, 2019
1 parent 9ff2134 commit be3223f
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
#----------------
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit be3223f

Please sign in to comment.