1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 21:35:45 +02:00

build: move BEES_VERSION to a separate C file to avoid unnecessary building

Every git commit was causing bees.cc and bees-hash.cc to be rebuilt,
which was expensive and unnecessary.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2017-01-09 23:23:05 -05:00
parent 6980935463
commit 1b261b1ba7
5 changed files with 7 additions and 6 deletions

2
src/.gitignore vendored
View File

@ -1 +1 @@
bees-version.h
bees-version.[ch]

View File

@ -11,8 +11,8 @@ LIBS = -lcrucible -lpthread
LDFLAGS = -L../lib -Wl,-rpath=$(shell realpath ../lib)
depends.mk: Makefile *.cc
echo "#define BEES_VERSION \"$(shell git describe --always --dirty || echo UNKNOWN)\"" > bees-version.new.h
mv -f bees-version.new.h bees-version.h
echo "const char *BEES_VERSION = \"$(shell git describe --always --dirty || echo UNKNOWN)\";" > bees-version.new.c
mv -f bees-version.new.c bees-version.c
for x in *.cc; do $(CXX) $(CXXFLAGS) -M "$$x"; done > depends.mk.new
mv -fv depends.mk.new depends.mk
@ -33,9 +33,11 @@ BEES_OBJS = \
bees-roots.o \
bees-thread.o \
bees-types.o \
bees-version.o \
../bin/bees: $(BEES_OBJS)
$(CXX) $(CXXFLAGS) -o "$@" $(BEES_OBJS) $(LDFLAGS) $(LIBS)
clean:
-rm -fv *.o bees-version.h
-rm -fv bees-version.h
-rm -fv *.o bees-version.c

View File

@ -1,4 +1,3 @@
#include "bees-version.h"
#include "bees.h"
#include "crucible/crc64.h"

View File

@ -1,4 +1,3 @@
#include "bees-version.h"
#include "bees.h"
#include "crucible/limits.h"

View File

@ -819,6 +819,7 @@ public:
};
// And now, a giant pile of extern declarations
extern const char *BEES_VERSION;
string pretty(double d);
extern RateLimiter bees_info_rate_limit;
void bees_sync(int fd);