libfstree_a_SOURCES = lib/fstree/fstree.c lib/fstree/fstree_from_file.c
libfstree_a_SOURCES += lib/fstree/fstree_sort.c
libfstree_a_SOURCES += include/fstree.h
libfstree_a_CFLAGS = $(AM_CFLAGS)
libfstree_a_CPPFLAGS = $(AM_CPPFLAGS)

libcompress_a_SOURCES = lib/comp/compressor.c lib/comp/internal.h
libcompress_a_SOURCES += include/compress.h
libcompress_a_CFLAGS = $(AM_CFLAGS)
libcompress_a_CPPFLAGS = $(AM_CPPFLAGS)

libsquashfs_a_SOURCES = include/meta_writer.h include/squashfs.h
libsquashfs_a_SOURCES += lib/sqfs/meta_writer.c lib/sqfs/super.c
libsquashfs_a_SOURCES += lib/sqfs/id_table.c include/id_table.h
libsquashfs_a_SOURCES += lib/sqfs/table.c include/table.h
libsquashfs_a_SOURCES += lib/sqfs/read_super.c lib/sqfs/meta_reader.c
libsquashfs_a_SOURCES += include/meta_reader.h lib/sqfs/id_table_write.c
libsquashfs_a_SOURCES += lib/sqfs/id_table_read.c lib/sqfs/read_inode.c
libsquashfs_a_SOURCES += lib/sqfs/readdir.c lib/sqfs/frag_reader.c
libsquashfs_a_SOURCES += include/frag_reader.h

libutil_a_SOURCES = lib/util/canonicalize_name.c lib/util/write_retry.c
libutil_a_SOURCES += lib/util/read_retry.c include/util.h
libutil_a_SOURCES += lib/util/print_version.c lib/util/mkdir_p.c
libutil_a_SOURCES += lib/util/str_table.c lib/util/str_table.c

if WITH_GZIP
libcompress_a_SOURCES += lib/comp/gzip.c

libcompress_a_CFLAGS += $(ZLIB_CFLAGS)
libcompress_a_CPPFLAGS += -DWITH_GZIP
endif

if WITH_XZ
libcompress_a_SOURCES += lib/comp/xz.c

libcompress_a_CFLAGS += $(XZ_CFLAGS)
libcompress_a_CPPFLAGS += -DWITH_XZ
endif

if WITH_LZO
libcompress_a_SOURCES += lib/comp/lzo.c

libcompress_a_CFLAGS += $(LZO_CFLAGS)
libcompress_a_CPPFLAGS += -DWITH_LZO
endif

if WITH_LZ4
libcompress_a_SOURCES += lib/comp/lz4.c

libcompress_a_CFLAGS += $(LZ4_CFLAGS)
libcompress_a_CPPFLAGS += -DWITH_LZ4
endif

if WITH_ZSTD
libcompress_a_SOURCES += lib/comp/zstd.c

libcompress_a_CFLAGS += $(ZSTD_CFLAGS)
libcompress_a_CPPFLAGS += -DWITH_ZSTD
endif

if WITH_SELINUX
libfstree_a_SOURCES += lib/fstree/selinux.c

libfstree_a_CFLAGS += $(LIBSELINUX_CFLAGS)
libfstree_a_CPPFLAGS += -DWITH_SELINUX
endif

noinst_LIBRARIES += libfstree.a libcompress.a libutil.a libsquashfs.a