mirror of
https://github.com/darkk/redsocks.git
synced 2025-08-30 13:45:30 +00:00
Fix gen/version.c generation for non-git builds.
This commit is contained in:
parent
08f9460702
commit
f9b207a21b
18
Makefile
18
Makefile
@ -3,6 +3,7 @@ SRCS := $(OBJS:.o=.c)
|
|||||||
CONF := config.h
|
CONF := config.h
|
||||||
DEPS := .depend
|
DEPS := .depend
|
||||||
OUT := redsocks
|
OUT := redsocks
|
||||||
|
VERSION := 0.2
|
||||||
|
|
||||||
LIBS := -levent
|
LIBS := -levent
|
||||||
CFLAGS += -g -O2
|
CFLAGS += -g -O2
|
||||||
@ -29,15 +30,18 @@ $(CONF):
|
|||||||
;; \
|
;; \
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Dependency on .git is useful to rebuild `version.c' after commit
|
# Dependency on .git is useful to rebuild `version.c' after commit, but it breaks non-git builds.
|
||||||
# FIXME: non-git builds should be supported.
|
gen/version.c: *.c *.h gen/.build
|
||||||
gen/version.c: *.c *.h gen/.build .git
|
|
||||||
rm -f $@.tmp
|
rm -f $@.tmp
|
||||||
echo '/* this file is auto-generated during build */' > $@.tmp
|
echo '/* this file is auto-generated during build */' > $@.tmp
|
||||||
echo '#include "../version.h"' > $@.tmp
|
echo '#include "../version.h"' >> $@.tmp
|
||||||
echo 'const char* redsocks_version = "redsocks.git/"' >> $@.tmp
|
echo 'const char* redsocks_version = ' >> $@.tmp
|
||||||
echo '"'`git describe --tags`'"' >> $@.tmp
|
if [ -d .git ]; then \
|
||||||
[ `git status --porcelain | grep -v -c '^??'` != 0 ] && { echo '"-unclean"' >> $@.tmp; } || true
|
echo '"redsocks.git/'`git describe --tags`'"'; \
|
||||||
|
[ `git status --porcelain | grep -v -c '^??'` != 0 ] && { echo '"-unclean"' ; } \
|
||||||
|
else \
|
||||||
|
echo '"redsocks/$(VERSION)"'; \
|
||||||
|
fi >> $@.tmp
|
||||||
echo ';' >> $@.tmp
|
echo ';' >> $@.tmp
|
||||||
mv -f $@.tmp $@
|
mv -f $@.tmp $@
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user