Skip to content

Instantly share code, notes, and snippets.

@shirohana
Created December 10, 2018 07:03
Show Gist options
  • Save shirohana/eb1706d27eafa9d9fc6ee984300aee97 to your computer and use it in GitHub Desktop.
Save shirohana/eb1706d27eafa9d9fc6ee984300aee97 to your computer and use it in GitHub Desktop.
zx
.PHONY = inc
COUNTER_FILE = COUNTER
SOURCE_COUNTER = if [[ ! -e $(COUNTER_FILE) ]]; then touch $(COUNTER_FILE); fi; set -a; source $(COUNTER_FILE);
inc:
@$(SOURCE_COUNTER) \
echo $$COUNTER; \
echo 'export COUNTER='$$((COUNTER + 1)) > $(COUNTER_FILE)
@zx1986
Copy link

zx1986 commented Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment