Skip to content

Instantly share code, notes, and snippets.

@zsoldosp
Created October 13, 2016 12:46
Show Gist options
  • Save zsoldosp/6612049337c789672d86755a82c2f33b to your computer and use it in GitHub Desktop.
Save zsoldosp/6612049337c789672d86755a82c2f33b to your computer and use it in GitHub Desktop.
.PHONY: tag
SHELL=bash
# assuming v0.1.0 is the only tag in the repo
tag: nr_of_existing_tags := $(shell git tag | grep "\<${TAG}\>" | wc -l)
tag:
@echo ${nr_of_existing_tags}
ifeq (1,$(nr_of_existing_tags))
@echo tag ${TAG} already present ${nr_of_existing_tags}
else
@echo tag ${TAG} NOT yet present ${nr_of_existing_tags}
endif
ifeq (0,${nr_of_existing_tags})
@echo tag ${TAG} NOT yet present ${nr_of_existing_tags}
else
@echo tag ${TAG} already present ${nr_of_existing_tags}
endif
.PHONY: tag
SHELL=bash
# assuming v0.1.0 is the only tag in the repo
nr_of_existing_tags := $(shell git tag | grep "\<${TAG}\>" | wc -l)
tag:
@echo ${nr_of_existing_tags}
ifeq (1,$(nr_of_existing_tags))
@echo tag ${TAG} already present ${nr_of_existing_tags}
else
@echo tag ${TAG} NOT yet present ${nr_of_existing_tags}
endif
ifeq (0,${nr_of_existing_tags})
@echo tag ${TAG} NOT yet present ${nr_of_existing_tags}
else
@echo tag ${TAG} already present ${nr_of_existing_tags}
endif
$ make -f Makefile.bad TAG=0.1.0
0
tag 0.1.0 NOT yet present 0
tag 0.1.0 already present 0
$ make -f Makefile.bad TAG=0.2.0
0
tag 0.2.0 NOT yet present 0
tag 0.2.0 already present 0
$ make -f Makefile.bad TAG=0.1.0
0
tag 0.1.0 NOT yet present 0
tag 0.1.0 NOT yet present 0
$ make -f Makefile.bad TAG=0.2.0
0
tag 0.2.0 NOT yet present 0
tag 0.2.0 NOT yet present 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment