diff --git a/Makefile b/Makefile index 24cdf3a..04599c2 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,16 @@ all: abootimg -abootimg: abootimg.c bootimg.h - echo '#define VERSION_STR "$(shell git describe --tags --abbrev=0)"' > version.h +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 clean: