mirror of
https://github.com/linux-apfs/apfsprogs.git
synced 2026-05-01 15:01:13 -07:00
apfsprogs: create archive of libraries on build
Instead of linking each library file by itself, assemble an archive with all the common library code. Use this to simplify the fsck Makefile, which no longer needs to relink every single time. Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.d
|
*.d
|
||||||
*.o
|
*.o
|
||||||
|
*.a
|
||||||
/apfsck/apfsck
|
/apfsck/apfsck
|
||||||
/mkapfs/mkapfs
|
/mkapfs/mkapfs
|
||||||
/tags
|
/tags
|
||||||
|
|||||||
+4
-4
@@ -4,7 +4,7 @@ OBJS = $(SRCS:.c=.o)
|
|||||||
DEPS = $(SRCS:.c=.d)
|
DEPS = $(SRCS:.c=.d)
|
||||||
|
|
||||||
LIBDIR = ../lib
|
LIBDIR = ../lib
|
||||||
LIBS = $(LIBDIR)/checksum.o $(LIBDIR)/unicode.o
|
LIBRARY = $(LIBDIR)/libapfs.a
|
||||||
|
|
||||||
BINDIR = ~/bin
|
BINDIR = ~/bin
|
||||||
MANDIR = ~/share/man/man8
|
MANDIR = ~/share/man/man8
|
||||||
@@ -13,13 +13,13 @@ SPARSE_VERSION := $(shell sparse --version 2>/dev/null)
|
|||||||
|
|
||||||
override CFLAGS += -Wall -I$(CURDIR)/../include
|
override CFLAGS += -Wall -I$(CURDIR)/../include
|
||||||
|
|
||||||
apfsck: $(OBJS) libraries
|
apfsck: $(OBJS) $(LIBRARY)
|
||||||
@echo ' Linking...'
|
@echo ' Linking...'
|
||||||
@gcc $(CFLAGS) -o apfsck $(OBJS) $(LIBS)
|
@gcc $(CFLAGS) -o apfsck $(OBJS) $(LIBRARY)
|
||||||
@echo ' Build complete'
|
@echo ' Build complete'
|
||||||
|
|
||||||
# Build the common libraries
|
# Build the common libraries
|
||||||
libraries: FORCE
|
$(LIBRARY): FORCE
|
||||||
@echo ' Building libraries...'
|
@echo ' Building libraries...'
|
||||||
@$(MAKE) -C $(LIBDIR) --silent --no-print-directory
|
@$(MAKE) -C $(LIBDIR) --silent --no-print-directory
|
||||||
@echo ' Library build complete'
|
@echo ' Library build complete'
|
||||||
|
|||||||
+4
-2
@@ -6,7 +6,9 @@ SPARSE_VERSION := $(shell sparse --version 2>/dev/null)
|
|||||||
|
|
||||||
override CFLAGS += -Wall -I$(CURDIR)/../include
|
override CFLAGS += -Wall -I$(CURDIR)/../include
|
||||||
|
|
||||||
all: $(OBJS)
|
libapfs.a: $(OBJS)
|
||||||
|
@echo ' Assembling library archive...'
|
||||||
|
@ar rcs $@ $^
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
@echo ' Compiling $<...'
|
@echo ' Compiling $<...'
|
||||||
@@ -18,4 +20,4 @@ endif
|
|||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(DEPS)
|
rm -f $(OBJS) $(DEPS) libapfs.a
|
||||||
|
|||||||
Reference in New Issue
Block a user