1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 21:35:45 +02:00
bees/lib/Makefile
Kai Krakow fdf434e8eb Makefile: fix dependency generation
Let's generalize the depends.mk target so we can easily move files
around later. While doing it, let's also fix the "gcc -M" call to use
explicit target names and not clobber it with preprocessor output.

Signed-off-by: Kai Krakow <kai@kaishome.de>
2018-01-18 22:53:00 +01:00

42 lines
804 B
Makefile

TAG := $(shell git describe --always --dirty || echo UNKNOWN)
default: libcrucible.so
%.so: Makefile
CRUCIBLE_OBJS = \
chatter.o \
cleanup.o \
crc64.o \
error.o \
extentwalker.o \
fd.o \
fs.o \
ntoa.o \
path.o \
process.o \
string.o \
task.o \
time.o \
uuid.o \
.version.o \
libcrucible.so: $(CRUCIBLE_OBJS)
include ../makeflags
depends.mk: *.cc
for x in $^; do $(CXX) $(CXXFLAGS) -M -MG -MT "$${x/%.cc/.o}" "$$x"; done > $@.new
mv -fv $@.new $@
.version.cc: Makefile ../makeflags *.cc ../include/crucible/*.h
echo "namespace crucible { const char *VERSION = \"$(TAG)\"; }" > .version.new.cc
mv -f .version.new.cc .version.cc
include depends.mk
%.o: %.cc ../makeflags
$(CXX) $(CXXFLAGS) -fPIC -o $@ -c $<
%.so:
$(CXX) $(LDFLAGS) -fPIC -o $@ $^ -shared -Wl,-soname,$@ -luuid