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.

104 lines
2.3 KiB

  1. VERSION = 2.9.7-mergerfs_2.29.0
  2. ifeq ($(DEBUG),1)
  3. OPT_FLAGS := -O0 -g
  4. else
  5. OPT_FLAGS := -O2
  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 = /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. $(OPT_FLAGS) \
  38. -Wall \
  39. -pipe \
  40. -MMD
  41. FUSERMOUNT_DIR = $(BINDIR)
  42. FUSE_FLAGS = \
  43. -Iinclude \
  44. -Ibuild \
  45. -D_REENTRANT \
  46. -D_FILE_OFFSET_BITS=64 \
  47. -DFUSE_USE_VERSION=29 \
  48. -DPACKAGE_VERSION=\"$(VERSION)\" \
  49. -DFUSERMOUNT_DIR=\"$(FUSERMOUNT_DIR)\"
  50. LDFLAGS = \
  51. -lrt \
  52. -pthread
  53. all: build/libfuse.a mount.mergerfs mergerfs-fusermount
  54. build/config.h: build/stamp
  55. ecfd/build | tee build/config.h
  56. build/stamp:
  57. mkdir -p build
  58. touch $@
  59. objects: build/config.h
  60. $(MAKE) $(OBJS)
  61. build/libfuse.a: objects
  62. ar rcs build/libfuse.a $(OBJS)
  63. build/mergerfs-fusermount: build/config.h util/fusermount.c lib/mount_util.c
  64. $(CC) $(CFLAGS) $(FUSE_FLAGS) -Ilib -o build/mergerfs-fusermount util/fusermount.c lib/mount_util.c
  65. mergerfs-fusermount: build/mergerfs-fusermount
  66. build/mount.mergerfs: build/libfuse.a util/mount.mergerfs.c
  67. $(CC) $(CFLAGS) $(FUSE_FLAGS) -o build/mount.mergerfs util/mount.mergerfs.c build/libfuse.a $(LDFLAGS)
  68. mount.mergerfs: build/mount.mergerfs
  69. build/%.o: lib/%.c
  70. $(CC) $(CFLAGS) $(FUSE_FLAGS) -c $< -o $@
  71. clean:
  72. rm -rf build
  73. distclean: clean
  74. strip:
  75. strip --strip-all build/mount.mergerfs
  76. strip --strip-all build/mergerfs-fusermount
  77. install: mergerfs-fusermount mount.mergerfs strip
  78. install -D build/mergerfs-fusermount "$(INSTALLBINDIR)/mergerfs-fusermount"
  79. install -D build/mount.mergerfs "$(INSTALLSBINDIR)/mount.mergerfs"
  80. chown root:root "$(INSTALLBINDIR)/mergerfs-fusermount"
  81. chmod u+s "$(INSTALLBINDIR)/mergerfs-fusermount"
  82. .PHONY: objects strip
  83. -include $(DEPS)