chore(Makefile): improve/fix .stack-work handling

This commit is contained in:
Sarah Vaupel 2024-01-15 22:53:04 +01:00
parent e49ab76d45
commit 51a14705d4

View File

@ -25,11 +25,12 @@ node_modules: .npmrc package.json
.PHONY: clean
clean:
rm -rf node_modules
rm -rf .stack-work .stack-work-build .stack-work-run .stack-work-test .stack-work-doc
.PHONY: %.lock
%.lock:
[ -e $@ ] || touch $@
flock -en $@ :
flock -en $@ true
.develop.env:
(in-develop | grep -q 'In develop') || (echo "Not in develop!" 2>&1; exit 1)
@ -40,12 +41,13 @@ clean:
.PHONY: --stack-work-%
--stack-work-%: .stack-work.lock
[[ -e .stack-work && -e .stack-work-$* ]] && (echo ".stack-work collides with .stack-work-$*, please resolve manually" 1>&2; exit 1)
[[ -e .stack-work && ! -e .stack-work-$* ]] || mv .stack-work-$* .stack-work
[[ -d .stack-work && -d .stack-work-$* ]] && (echo ".stack-work collides with .stack-work-$*, please resolve manually" 1>&2; exit 1) || :
[[ ! -d .stack-work-$* ]] || mv .stack-work-$* .stack-work
.PHONY: --stack-krow-%
--stack-krow-%:
[[ -e .stack-work-$* && echo ".stack-work-$* already exists, please resolve manually" 1>&2; exit 1 ]] || mv .stack-work .stack-work-$*
[[ -d .stack-work-$* && echo ".stack-work-$* already exists, please resolve manually" 1>&2; exit 1 ]]
mv .stack-work .stack-work-$*
flock -u .stack-work.lock
# TODO: yarn2nix target