2010-05-15 19:26:35 +04:00
|
|
|
|
2010-12-16 12:22:45 +03:00
|
|
|
PREFIX=/usr
|
2013-10-07 01:13:05 +04:00
|
|
|
INSTALL=install
|
2016-10-12 04:50:54 +03:00
|
|
|
CFLAGS+=-std=gnu99 -O2 -Wall -g -MMD -D_FILE_OFFSET_BITS=64 -I.
|
2015-03-16 01:49:05 +03:00
|
|
|
LDFLAGS+=-static
|
2010-05-15 19:26:35 +04:00
|
|
|
|
2016-10-06 18:19:55 +03:00
|
|
|
PKGCONFIG_LIBS="blkid uuid"
|
2016-08-24 06:50:31 +03:00
|
|
|
CFLAGS+=`pkg-config --cflags ${PKGCONFIG_LIBS}`
|
2016-10-04 12:10:24 +03:00
|
|
|
LDLIBS+=`pkg-config --libs ${PKGCONFIG_LIBS}` -lscrypt -lsodium -lkeyutils -lm
|
2016-08-24 06:50:31 +03:00
|
|
|
|
2016-08-29 05:00:50 +03:00
|
|
|
ifeq ($(PREFIX),/usr)
|
2016-04-26 04:13:15 +03:00
|
|
|
ROOT_SBINDIR=/sbin
|
|
|
|
else
|
|
|
|
ROOT_SBINDIR=$(PREFIX)/sbin
|
|
|
|
endif
|
2010-05-15 19:26:35 +04:00
|
|
|
|
2016-08-29 05:00:50 +03:00
|
|
|
.PHONY: all
|
2016-04-26 04:13:15 +03:00
|
|
|
all: bcache
|
|
|
|
|
2016-03-12 09:18:42 +03:00
|
|
|
CCANSRCS=$(wildcard ccan/*/*.c)
|
|
|
|
CCANOBJS=$(patsubst %.c,%.o,$(CCANSRCS))
|
2014-12-06 06:20:03 +03:00
|
|
|
|
2016-03-12 09:18:42 +03:00
|
|
|
libccan.a: $(CCANOBJS)
|
|
|
|
$(AR) r $@ $(CCANOBJS)
|
|
|
|
|
|
|
|
bcache-objs = bcache.o bcache-assemble.o bcache-device.o bcache-format.o\
|
2016-08-24 06:50:31 +03:00
|
|
|
bcache-fs.o bcache-run.o bcache-key.o libbcache.o crypto.o util.o
|
2014-12-06 06:20:03 +03:00
|
|
|
|
2016-10-12 04:50:54 +03:00
|
|
|
-include $(bcache-objs:.o=.d)
|
|
|
|
|
2016-08-24 06:50:31 +03:00
|
|
|
bcache: $(bcache-objs) libccan.a
|
2016-04-26 04:13:15 +03:00
|
|
|
|
2016-08-29 05:00:50 +03:00
|
|
|
.PHONY: install
|
|
|
|
install: bcache
|
|
|
|
mkdir -p $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8/
|
|
|
|
$(INSTALL) -m0755 bcache $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
$(INSTALL) -m0755 mkfs.bcache $(DESTDIR)$(ROOT_SBINDIR)
|
|
|
|
$(INSTALL) -m0644 bcache.8 $(DESTDIR)$(PREFIX)/share/man/man8/
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2016-10-12 04:50:54 +03:00
|
|
|
$(RM) bcache *.o *.d *.a
|
2016-08-29 05:00:50 +03:00
|
|
|
|
|
|
|
.PHONY: deb
|
|
|
|
deb: all
|
2016-04-26 04:13:15 +03:00
|
|
|
debuild -nc -us -uc -i -I
|