You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.3 KiB

  1. VERSION = 2.9.7-mergerfs_2.29.0
  2. ifeq ($(DEBUG),1)
  3. DEBUG_FLAGS := -g
  4. else
  5. DEBUG_FLAGS :=
  6. endif
  7. DESTDIR =
  8. PREFIX = /usr/local
  9. EXEC_PREFIX = $(PREFIX)
  10. DATAROOTDIR = $(PREFIX)/share
  11. DATADIR = $(DATAROOTDIR)
  12. BINDIR = $(EXEC_PREFIX)/bin
  13. SBINDIR = $(EXEC_PREFIX)/sbin
  14. MANDIR = $(DATAROOTDIR)/man
  15. MAN1DIR = $(MANDIR)/man1
  16. INSTALLBINDIR = $(DESTDIR)$(BINDIR)
  17. INSTALLSBINDIR = $(DESTDIR)$(SBINDIR)
  18. INSTALLMAN1DIR = $(DESTDIR)$(MAN1DIR)
  19. SRC = \
  20. lib/buffer.c \
  21. lib/cuse_lowlevel.c \
  22. lib/fuse_dirents.c \
  23. lib/fuse.c \
  24. lib/fuse_kern_chan.c \
  25. lib/fuse_loop.c \
  26. lib/fuse_loop_mt.c \
  27. lib/fuse_lowlevel.c \
  28. lib/fuse_mt.c \
  29. lib/fuse_opt.c \
  30. lib/fuse_session.c \
  31. lib/fuse_signals.c \
  32. lib/helper.c \
  33. lib/mount.c
  34. OBJS = $(SRC:lib/%.c=build/%.o)
  35. DEPS = $(SRC:lib/%.c=build/%.d)
  36. CFLAGS = \
  37. -O2 \
  38. $(DEBUG_FLAGS) \
  39. -Wall \
  40. -pipe \
  41. -MMD
  42. FUSERMOUNT_DIR = $(BINDIR)
  43. FUSE_FLAGS = \
  44. -Iinclude \
  45. -Ibuild \
  46. -D_REENTRANT \
  47. -D_FILE_OFFSET_BITS=64 \
  48. -DFUSE_USE_VERSION=29 \
  49. -DPACKAGE_VERSION=\"$(VERSION)\" \
  50. -DFUSERMOUNT_DIR=\"$(FUSERMOUNT_DIR)\"
  51. LDFLAGS = \
  52. -lrt \
  53. -pthread
  54. all: build/libfuse.a mount.mergerfs mergerfs-fusermount
  55. build/config.h: build/stamp
  56. ecfd/build | tee build/config.h
  57. build/stamp:
  58. mkdir -p build
  59. touch $@
  60. objects: build/config.h
  61. $(MAKE) $(OBJS)
  62. build/libfuse.a: objects
  63. ar rcs build/libfuse.a $(OBJS)
  64. build/mergerfs-fusermount: build/config.h util/fusermount.c lib/mount_util.c
  65. $(CC) $(CFLAGS) $(FUSE_FLAGS) -Ilib -o build/mergerfs-fusermount util/fusermount.c lib/mount_util.c
  66. mergerfs-fusermount: build/mergerfs-fusermount
  67. build/mount.mergerfs: build/libfuse.a util/mount.mergerfs.c
  68. $(CC) $(CFLAGS) $(FUSE_FLAGS) -o build/mount.mergerfs util/mount.mergerfs.c build/libfuse.a $(LDFLAGS)
  69. mount.mergerfs: build/mount.mergerfs
  70. build/%.o: lib/%.c
  71. $(CC) $(CFLAGS) $(FUSE_FLAGS) -c $< -o $@
  72. clean:
  73. rm -rf build
  74. distclean: clean
  75. strip:
  76. strip --strip-all build/mount.mergerfs
  77. strip --strip-all build/mergerfs-fusermount
  78. install: mergerfs-fusermount mount.mergerfs strip
  79. install -D build/mergerfs-fusermount "$(INSTALLBINDIR)/mergerfs-fusermount"
  80. install -D build/mount.mergerfs "$(INSTALLSBINDIR)/mount.mergerfs"
  81. chown root:root "$(INSTALLBINDIR)/mergerfs-fusermount"
  82. chmod u+s "$(INSTALLBINDIR)/mergerfs-fusermount"
  83. .PHONY: objects strip
  84. -include $(DEPS)