Fix version.h creation.

Only create version.h if file not present and only try to read
git version if .git present.
This commit is contained in:
Heiko Stuebner 2011-07-04 13:12:55 +02:00
parent f8525d5c9e
commit 63ad881fac

View File

@ -1,8 +1,16 @@
all: abootimg all: abootimg
abootimg: abootimg.c bootimg.h version.h:
echo '#define VERSION_STR "$(shell git describe --tags --abbrev=0)"' > version.h if [ ! -f version.h ]; then \
if [ -d .git ]; then \
echo '#define VERSION_STR "$(shell git describe --tags --abbrev=0)"' > version.h; \
else \
echo '#define VERSION_STR ""' > version.h; \
fi \
fi
abootimg: abootimg.c bootimg.h version.h
gcc -g -O2 -Wno-unused-result -o abootimg abootimg.c -DHAS_BLKID -lblkid gcc -g -O2 -Wno-unused-result -o abootimg abootimg.c -DHAS_BLKID -lblkid
clean: clean: