mergerfs/libfuse/Makefile

105 lines
2.3 KiB
Makefile
Raw Normal View History

2020-02-21 21:01:49 +08:00
VERSION = 2.9.7-mergerfs_2.29.0
ifeq ($(DEBUG),1)
OPT_FLAGS := -O0 -g
else
OPT_FLAGS := -O2
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)
SRC = \
lib/buffer.c \
lib/cuse_lowlevel.c \
lib/fuse_dirents.c \
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)
2020-02-21 21:01:49 +08:00
CFLAGS = \
$(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 = \
-lrt \
-pthread
2020-02-21 21:01:49 +08:00
all: build/libfuse.a mount.mergerfs mergerfs-fusermount
2019-04-25 04:19:01 +08:00
build/config.h: build/stamp
ecfd/build | tee build/config.h
2019-04-25 04:19:01 +08:00
build/stamp:
mkdir -p build
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)
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
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-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 $@
clean:
2019-04-25 04:19:01 +08:00
rm -rf build
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
-include $(DEPS)