PACKAGES=sqlite3 uuid
DEBUG=-g #-pg
CXXFLAGS=-O -Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) \
- `pkg-config --cflags $(PACKAGES)`
+ `pkg-config --cflags $(PACKAGES)` -DLBS_VERSION=`cat version`
LDFLAGS=$(DEBUG) -ltar `pkg-config --libs $(PACKAGES)`
SRCS=format.cc localdb.cc ref.cc scandir.cc sha1.cc statcache.cc store.cc
lbs : $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^
+version :
+ (git-describe || echo "Unknown") >version
+$(OBJS) : version
+
dep:
touch Makefile.dep
makedepend -fMakefile.dep $(SRCS)
using std::vector;
using std::ostream;
+/* Version information. This will be filled in by the Makefile. */
+#ifndef LBS_VERSION
+#define LBS_VERSION Unknown
+#endif
+#define LBS_STRINGIFY(s) LBS_STRINGIFY2(s)
+#define LBS_STRINGIFY2(s) #s
+static const char lbs_version[] = LBS_STRINGIFY(LBS_VERSION);
+
static TarSegmentStore *tss = NULL;
/* Buffer for holding a single block of data read from a file. */
{
list<string>::const_iterator i;
+ printf("LBS Version: %s\n", lbs_version);
+
printf("--dest=%s\n--localdb=%s\n\n",
backup_dest.c_str(), localdb_dir.c_str());
std::ofstream descriptor(desc_filename.c_str());
descriptor << "Format: LBS Snapshot v0.1\n";
+ descriptor << "Producer: " << lbs_version << "\n";
strftime(desc_buf, sizeof(desc_buf), "%Y-%m-%d %H:%M:%S %z", &time_buf);
descriptor << "Date: " << desc_buf << "\n";
descriptor << "Root: " << backup_root << "\n";