Browse Source

Merge pull request #589 from trapexit/make

rework makefiles for better manage parallel builds
pull/591/head
trapexit 6 years ago
committed by GitHub
parent
commit
cab7033d5b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      Makefile
  2. 24
      libfuse/Makefile

23
Makefile

@ -42,29 +42,36 @@ FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -Ilibfuse/include
FUSE_LIBS = libfuse/obj/libfuse.a
FUSE_TARGET = $(FUSE_LIBS)
ifeq ($(DEBUG),1)
DEBUG_FLAGS := -g
else
DEBUG_FLAGS :=
endif
ifeq ($(STATIC),1)
STATIC_FLAG := -static
STATIC_FLAGS := -static
else
STATIC_FLAG :=
STATIC_FLAGS :=
endif
ifeq ($(LTO),1)
LTO_FLAG := -flto
LTO_FLAGS := -flto
else
LTO_FLAG :=
LTO_FLAGS :=
endif
UGID_USE_RWLOCK = 0
OPTS = -O2 -g
OPTS = -O2
SRC = $(wildcard src/*.cpp)
OBJ = $(SRC:src/%.cpp=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d)
TARGET = mergerfs
MANPAGE = $(TARGET).1
CXXFLAGS = $(OPTS) \
$(STATIC_FLAG) \
$(LTO_FLAG) \
$(DEBUG_FLAGS) \
$(STATIC_FLAGS) \
$(LTO_FLAGS) \
-Wall \
-Wno-unused-result \
$(FUSE_CFLAGS) \
@ -95,7 +102,7 @@ help:
@echo "make LTO=1 - build with link time optimization"
$(TARGET): version obj/obj-stamp $(FUSE_TARGET) $(OBJ)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJ) -o $@ $(FUSE_LIBS) -ldl -pthread -lrt
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJ) -o $@ $(FUSE_LIBS) -pthread -lrt
mount.mergerfs: $(TARGET)
$(LN) -fs "$<" "$@"

24
libfuse/Makefile

@ -1,6 +1,12 @@
VERSION = "2.9.7-mergerfs_2.26.0"
OPT = -O2
ifeq ($(DEBUG),1)
DEBUG_FLAGS := -g
else
DEBUG_FLAGS :=
endif
DESTDIR = "/"
BINDIR = "/bin"
SBINDIR = "/sbin"
@ -22,7 +28,7 @@ SRC = \
OBJ = $(SRC:lib/%.c=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d)
CFLAGS = $(OPT) \
-g \
$(DEBUG_FLAGS) \
-Wall \
-pipe \
'-D_FILE_OFFSET_BITS=64' \
@ -33,18 +39,24 @@ CFLAGS = $(OPT) \
-Iinclude \
-MMD
LDFLAGS = \
-ldl \
-lrt \
-pthread
all: obj/libfuse.a mergerfs-mount mount.mergerfs
all: obj/libfuse.a
libfuse.a: obj/libfuse.a
include/config.h:
ecfd/build | tee include/config.h
obj/libfuse.a: obj/obj-stamp include/config.h $(OBJ)
obj/obj-stamp:
mkdir -p obj
touch $@
obj/libfuse.a:
$(MAKE) obj/obj-stamp
$(MAKE) include/config.h
$(MAKE) $(OBJ)
ar rcs obj/libfuse.a $(OBJ)
mergerfs-mount: include/config.h util/fusermount.c lib/mount_util.c
@ -53,10 +65,6 @@ mergerfs-mount: include/config.h util/fusermount.c lib/mount_util.c
mount.mergerfs: obj/libfuse.a util/mount.fuse.c
$(CC) $(CFLAGS) -o mount.mergerfs util/mount.fuse.c obj/libfuse.a $(LDFLAGS)
obj/obj-stamp:
mkdir -p obj
touch $@
obj/%.o: lib/%.c
$(CC) $(CFLAGS) -c $< -o $@

Loading…
Cancel
Save