Skip to content

Commit

Permalink
Add "tag" command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
DL6ER committed Feb 22, 2017
1 parent fa15f06 commit e930b91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ OBJ = main.o structs.o log.o daemon.o parser.o signals.o socket.o request.o grep
GIT_BRANCH := $(shell git branch | sed -n 's/^\* //p')
GIT_VERSION := $(shell git --no-pager describe --tags --always --dirty)
GIT_DATE := $(shell git --no-pager show --date=short --format="%ai" --name-only | head -n 1)
GIT_TAG := $(shell git describe --tags --abbrev=0)

# -fstack-protector: The program will be resistant to having its stack overflowed
# -D_FORTIFY_SOURCE=2 and -O1 or higher: This causes certain unsafe glibc functions zo be replaced with their safer counterparts
Expand Down Expand Up @@ -47,11 +48,12 @@ clean:

# recreate version.h when GIT_VERSION changes, uses temporary file version~
version~: force
@echo '$(GIT_BRANCH) $(GIT_VERSION) $(GIT_DATE)' | cmp -s - $@ || echo '$(GIT_BRANCH) $(GIT_VERSION) $(GIT_DATE)' > $@
@echo '$(GIT_BRANCH) $(GIT_VERSION) $(GIT_DATE) $(GIT_TAG)' | cmp -s - $@ || echo '$(GIT_BRANCH) $(GIT_VERSION) $(GIT_DATE) $(GIT_TAG)' > $@
version.h: version~
@echo '#define GIT_VERSION "$(GIT_VERSION)"' > "$@"
@echo '#define GIT_DATE "$(GIT_DATE)"' >> "$@"
@echo '#define GIT_BRANCH "$(GIT_BRANCH)"' >> "$@"
@echo '#define GIT_TAG "$(GIT_TAG)"' >> "$@"
@echo "Making FTL version on branch $(GIT_BRANCH) - $(GIT_VERSION) ($(GIT_DATE))"

prefix=/usr/local
Expand Down
5 changes: 5 additions & 0 deletions args.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ void parse_args(int argc, char* argv[])
printf("%s\n",GIT_VERSION);
exit(0);
}
if(strcmp(argv[i], "tag") == 0)
{
printf("%s\n",GIT_TAG);
exit(0);
}
// Other arguments are ignored
}
}

0 comments on commit e930b91

Please sign in to comment.