version_string.sh uses VERSION.txt if not in a Git repo

This commit is contained in:
Andrew Bettison 2014-02-28 17:06:11 +10:30
parent 30590ab140
commit 8e9440860b
3 changed files with 10 additions and 3 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
*.a
*.suo
.*.sw?
VERSION.txt
configure
autom4te.cache
Makefile

View File

@ -99,12 +99,14 @@ sqlite-amalgamation-3070900/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c
@echo CC $<
@$(CC) $(CFLAGS) $(DEFS) -c $< -o sqlite-amalgamation-3070900/sqlite3.o
version.o: *.h *.c version_string.sh COPYRIGHT.txt Makefile
version.o: *.h *.c version_string.sh VERSION.txt COPYRIGHT.txt Makefile
@echo CC version_servald.c
@V=`./version_string.sh --ignore-untracked` \
&& C="`sed -e :a -e N -e '$$!ba' -e 's/[\\\\"]/\\\\&/g' -e 's/\\n/\\\\n/g' COPYRIGHT.txt`" \
&& $(CC) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\"" -DSERVALD_COPYRIGHT="\"$$C\""
VERSION.txt:
%.o: %.c
@echo CC $<
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@

View File

@ -99,8 +99,12 @@ esac
cd "$repo_path" >/dev/null
if [ ! -d .git ]; then
echo "UNKNOWN-VERSION"
exit 0
if [ -s VERSION.txt ] && [ $(cat VERSION.txt | wc -l) -eq 1 ]; then
cat VERSION.txt
else
echo "UNKNOWN-VERSION"
fi
exit 0
fi
get_author_label() {