2020-02-21 21:01:49 +08:00
|
|
|
VERSION = 2.9.7-mergerfs_2.29.0
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2019-03-11 07:29:35 +08:00
|
|
|
ifeq ($(DEBUG),1)
|
2019-09-24 22:27:46 +08:00
|
|
|
OPT_FLAGS := -O0 -g
|
2019-03-11 07:29:35 +08:00
|
|
|
else
|
2019-09-24 22:27:46 +08:00
|
|
|
OPT_FLAGS := -O2
|
2019-03-11 07:29:35 +08:00
|
|
|
endif
|
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
DESTDIR =
|
|
|
|
PREFIX = /usr/local
|
|
|
|
EXEC_PREFIX = $(PREFIX)
|
|
|
|
DATAROOTDIR = $(PREFIX)/share
|
|
|
|
DATADIR = $(DATAROOTDIR)
|
|
|
|
BINDIR = $(EXEC_PREFIX)/bin
|
|
|
|
SBINDIR = $(EXEC_PREFIX)/sbin
|
|
|
|
MANDIR = $(DATAROOTDIR)/man
|
|
|
|
MAN1DIR = $(MANDIR)/man1
|
|
|
|
|
|
|
|
INSTALLBINDIR = $(DESTDIR)$(BINDIR)
|
|
|
|
INSTALLSBINDIR = $(DESTDIR)$(SBINDIR)
|
|
|
|
INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR)
|
|
|
|
|
2019-02-18 03:11:39 +08:00
|
|
|
SRC = \
|
|
|
|
lib/buffer.c \
|
|
|
|
lib/cuse_lowlevel.c \
|
2019-06-14 20:59:04 +08:00
|
|
|
lib/fuse_dirents.c \
|
2019-02-18 03:11:39 +08:00
|
|
|
lib/fuse.c \
|
|
|
|
lib/fuse_kern_chan.c \
|
|
|
|
lib/fuse_loop.c \
|
|
|
|
lib/fuse_loop_mt.c \
|
|
|
|
lib/fuse_lowlevel.c \
|
|
|
|
lib/fuse_mt.c \
|
|
|
|
lib/fuse_opt.c \
|
|
|
|
lib/fuse_session.c \
|
|
|
|
lib/fuse_signals.c \
|
|
|
|
lib/helper.c \
|
|
|
|
lib/mount.c
|
2019-04-25 04:19:01 +08:00
|
|
|
OBJS = $(SRC:lib/%.c=build/%.o)
|
|
|
|
DEPS = $(SRC:lib/%.c=build/%.d)
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
CFLAGS = \
|
2019-09-24 22:27:46 +08:00
|
|
|
$(OPT_FLAGS) \
|
2019-04-25 04:19:01 +08:00
|
|
|
-Wall \
|
|
|
|
-pipe \
|
2020-02-21 21:01:49 +08:00
|
|
|
-MMD
|
|
|
|
FUSERMOUNT_DIR = $(BINDIR)
|
|
|
|
FUSE_FLAGS = \
|
2019-04-25 04:19:01 +08:00
|
|
|
-Iinclude \
|
|
|
|
-Ibuild \
|
2020-02-21 21:01:49 +08:00
|
|
|
-D_REENTRANT \
|
|
|
|
-D_FILE_OFFSET_BITS=64 \
|
|
|
|
-DFUSE_USE_VERSION=29 \
|
|
|
|
-DPACKAGE_VERSION=\"$(VERSION)\" \
|
|
|
|
-DFUSERMOUNT_DIR=\"$(FUSERMOUNT_DIR)\"
|
|
|
|
LDFLAGS = \
|
2019-02-18 03:11:39 +08:00
|
|
|
-lrt \
|
|
|
|
-pthread
|
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
all: build/libfuse.a mount.mergerfs mergerfs-fusermount
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2019-04-25 04:19:01 +08:00
|
|
|
build/config.h: build/stamp
|
|
|
|
ecfd/build | tee build/config.h
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2019-04-25 04:19:01 +08:00
|
|
|
build/stamp:
|
|
|
|
mkdir -p build
|
2019-03-11 07:29:35 +08:00
|
|
|
touch $@
|
|
|
|
|
2019-04-25 04:19:01 +08:00
|
|
|
objects: build/config.h
|
|
|
|
$(MAKE) $(OBJS)
|
|
|
|
|
|
|
|
build/libfuse.a: objects
|
|
|
|
ar rcs build/libfuse.a $(OBJS)
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
build/mergerfs-fusermount: build/config.h util/fusermount.c lib/mount_util.c
|
|
|
|
$(CC) $(CFLAGS) $(FUSE_FLAGS) -Ilib -o build/mergerfs-fusermount util/fusermount.c lib/mount_util.c
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
mergerfs-fusermount: build/mergerfs-fusermount
|
|
|
|
|
|
|
|
build/mount.mergerfs: build/libfuse.a util/mount.mergerfs.c
|
|
|
|
$(CC) $(CFLAGS) $(FUSE_FLAGS) -o build/mount.mergerfs util/mount.mergerfs.c build/libfuse.a $(LDFLAGS)
|
|
|
|
|
|
|
|
mount.mergerfs: build/mount.mergerfs
|
2019-02-18 03:11:39 +08:00
|
|
|
|
2019-04-25 04:19:01 +08:00
|
|
|
build/%.o: lib/%.c
|
2020-02-21 21:01:49 +08:00
|
|
|
$(CC) $(CFLAGS) $(FUSE_FLAGS) -c $< -o $@
|
2019-02-18 03:11:39 +08:00
|
|
|
|
|
|
|
clean:
|
2019-04-25 04:19:01 +08:00
|
|
|
rm -rf build
|
2019-02-18 03:11:39 +08:00
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
strip:
|
|
|
|
strip --strip-all build/mount.mergerfs
|
|
|
|
strip --strip-all build/mergerfs-fusermount
|
|
|
|
|
|
|
|
install: mergerfs-fusermount mount.mergerfs strip
|
|
|
|
install -D build/mergerfs-fusermount "$(INSTALLBINDIR)/mergerfs-fusermount"
|
|
|
|
install -D build/mount.mergerfs "$(INSTALLSBINDIR)/mount.mergerfs"
|
|
|
|
chown root:root "$(INSTALLBINDIR)/mergerfs-fusermount"
|
|
|
|
chmod u+s "$(INSTALLBINDIR)/mergerfs-fusermount"
|
2019-04-25 04:19:01 +08:00
|
|
|
|
2020-02-21 21:01:49 +08:00
|
|
|
.PHONY: objects strip
|
2019-02-18 03:11:39 +08:00
|
|
|
|
|
|
|
-include $(DEPS)
|