mirror of
https://github.com/trapexit/mergerfs.git
synced 2024-11-22 11:02:35 +08:00
rework makefiles for better manage parallel builds
This commit is contained in:
parent
3c2a9cd4f8
commit
1be9900733
25
Makefile
25
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 ($(STATIC),1)
|
||||
STATIC_FLAG := -static
|
||||
ifeq ($(DEBUG),1)
|
||||
DEBUG_FLAGS := -g
|
||||
else
|
||||
STATIC_FLAG :=
|
||||
DEBUG_FLAGS :=
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC),1)
|
||||
STATIC_FLAGS := -static
|
||||
else
|
||||
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 "$<" "$@"
|
||||
|
|
|
@ -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…
Reference in New Issue
Block a user