From 98e3d5c1ceddd4a32b92c1cfafe929fe006fb98c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 14 Sep 2015 16:59:13 +0200 Subject: [PATCH] Add option to link zlib statically Signed-off-by: Jo-Philipp Wich --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 17b5d88..908e44a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,12 @@ CC ?= gcc CFLAGS += -Iinclude -Ilibsparse/include +ifeq ($(STATIC),1) + ZLIB := -Wl,-Bstatic -lz -Wl,-Bdynamic +else + ZLIB := -lz +endif + OBJ := \ allocate.o \ canned_fs_config.o \ @@ -21,7 +27,7 @@ OBJ := \ $(CC) $(CFLAGS) -c -o $@ $^ make_ext4fs: $(OBJ) libsparse/libsparse.a - $(CC) -o $@ $^ -lz + $(CC) -o $@ $^ $(ZLIB) libsparse/libsparse.a: $(MAKE) -C libsparse/ libsparse.a -- 2.30.2