Skip to content

Commit 98e3d5c

Browse files
committed
Add option to link zlib statically
Signed-off-by: Jo-Philipp Wich <[email protected]>
1 parent 7c15bef commit 98e3d5c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CC ?= gcc
22
CFLAGS += -Iinclude -Ilibsparse/include
33

4+
ifeq ($(STATIC),1)
5+
ZLIB := -Wl,-Bstatic -lz -Wl,-Bdynamic
6+
else
7+
ZLIB := -lz
8+
endif
9+
410
OBJ := \
511
allocate.o \
612
canned_fs_config.o \
@@ -21,7 +27,7 @@ OBJ := \
2127
$(CC) $(CFLAGS) -c -o $@ $^
2228

2329
make_ext4fs: $(OBJ) libsparse/libsparse.a
24-
$(CC) -o $@ $^ -lz
30+
$(CC) -o $@ $^ $(ZLIB)
2531

2632
libsparse/libsparse.a:
2733
$(MAKE) -C libsparse/ libsparse.a

0 commit comments

Comments
 (0)