Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3
Created August 20, 2024 17:56
Show Gist options
  • Save h0tw1r3/15f9ee948e60d646afa44ab247c6afd0 to your computer and use it in GitHub Desktop.
Save h0tw1r3/15f9ee948e60d646afa44ab247c6afd0 to your computer and use it in GitHub Desktop.

Revisions

  1. h0tw1r3 created this gist Aug 20, 2024.
    5 changes: 5 additions & 0 deletions Makefile scratch with auto cleanup
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    ifeq (${MAKELEVEL},0)
    export SCRATCH := $(shell mktemp -d ./.tmp_XXXXXXXX)
    $(info Launching clean up task for ${SCRATCH})
    $(shell bash -c "set -m ; trap 'rm -rvf ${SCRATCH};' EXIT; lsof -p $$PPID +r 1;" </dev/null >/dev/null 2>/dev/null & disown)
    endif