Add LDFLAGS when building libsparse.a
[project/make_ext4fs.git] / Makefile
1 CC ?= gcc
2 CFLAGS += -Iinclude -Ilibsparse/include
3
4 ifeq ($(STATIC),1)
5 ZLIB := -Wl,-Bstatic -lz -Wl,-Bdynamic
6 else
7 ZLIB := -lz
8 endif
9
10 OBJ := \
11 allocate.o \
12 canned_fs_config.o \
13 contents.o \
14 crc16.o \
15 ext4fixup.o \
16 ext4_sb.o \
17 ext4_utils.o \
18 extent.o \
19 indirect.o \
20 make_ext4fs_main.o \
21 make_ext4fs.o \
22 sha1.o \
23 uuid.o \
24 wipe.o
25
26 %.o: %.c
27 $(CC) $(CFLAGS) -c -o $@ $^
28
29 make_ext4fs: $(OBJ) libsparse/libsparse.a
30 $(CC) -o $@ $^ $(ZLIB)
31
32 libsparse/libsparse.a:
33 $(MAKE) -C libsparse/ libsparse.a
34
35 clean:
36 $(MAKE) -C libsparse/ clean
37 rm -f $(OBJ) make_ext4fs