summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-04-26 22:09:08 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:55 +0100
commitd39ea7019cb204420c53a203ff9ccbb4cab0d4b3 (patch)
tree313257adc2b8242c298d060ea29a256fa7394011
parentf600c700fcc7e703698c1a1164f14ad8d42479b1 (diff)
Change build system to autotools
This patch is largely based on Richards original RFC. The major differences to the RFC patch are: - Add missing sumtools & mtdpart targets - Fix name of mkfs.jffs2 target - Add missing subdir-objects option for non-recursive make - Move all automake options to configure.ac - Add manpages to install target - Make XATTR & LZO support configurable - Install binaries to sbin directory like in the old build system - Install flash_erase wrapper script - Add files missing from distribution target Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--.gitignore5
-rw-r--r--Makefile133
-rw-r--r--Makefile.am35
-rwxr-xr-xautogen.sh3
-rw-r--r--configure.ac47
-rw-r--r--include/common.h1
-rw-r--r--jffsX-utils/Makemodule.am37
-rw-r--r--lib/Makemodule.am8
-rw-r--r--misc-utils/Makemodule.am54
-rw-r--r--nand-utils/Makemodule.am24
-rw-r--r--nor-utils/Makemodule.am10
-rw-r--r--nor-utils/rfddump.c4
-rw-r--r--nor-utils/rfdformat.c4
-rw-r--r--tests/ubi-tests/Makefile.am7
-rw-r--r--ubi-utils/Makemodule.am73
-rw-r--r--ubifs-utils/Makemodule.am40
16 files changed, 342 insertions, 143 deletions
diff --git a/.gitignore b/.gitignore
index 2aac52c..5548e48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,11 +55,6 @@
#
!.gitignore
-#
-# Generated include files
-#
-/include/version.h
-
# stgit generated dirs
patches-*
*.patch
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 977c9c5..0000000
--- a/Makefile
+++ /dev/null
@@ -1,133 +0,0 @@
-
-# -*- sh -*-
-
-VERSION = 1.5.2
-
-CPPFLAGS += -D_GNU_SOURCE -I./include -I$(BUILDDIR)/include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS) $(UUIDCPPFLAGS)
-
-ifeq ($(WITHOUT_XATTR), 1)
- CPPFLAGS += -DWITHOUT_XATTR
-endif
-ifeq ($(WITHOUT_LZO), 1)
- CPPFLAGS += -DWITHOUT_LZO
-else
- LZOLDLIBS = -llzo2
-endif
-
-TESTS = tests
-
-MISC_BINS = \
- ftl_format doc_loadbios ftl_check mtd_debug docfdisk \
- serve_image recv_image mtdpart flash_erase flash_lock \
- flash_unlock flash_otp_info flash_otp_dump flash_otp_lock \
- flash_otp_write flashcp
-UBI_BINS = \
- ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
- ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock
-UBIFS_BINS = \
- mkfs.ubifs/mkfs.ubifs
-JFFSX_BINS = \
- mkfs.jffs2 sumtool jffs2reader jffs2dump
-NAND_BINS = \
- nanddump nandwrite nandtest nftldump nftl_format
-NOR_BINS = \
- rfddump rfdformat
-
-BINS = $(addprefix misc-utils/,$(MISC_BINS))
-BINS += $(addprefix ubi-utils/,$(UBI_BINS))
-BINS += $(addprefix ubifs-utils/,$(UBIFS_BINS))
-BINS += $(addprefix jffsX-utils/,$(JFFSX_BINS))
-BINS += $(addprefix nand-utils/,$(NAND_BINS))
-BINS += $(addprefix nor-utils/,$(NOR_BINS))
-SCRIPTS = $(addprefix misc-utils/,flash_eraseall)
-
-TARGETS = $(BINS)
-TARGETS += lib/libmtd.a
-TARGETS += ubi-utils/libubi.a
-
-OBJDEPS = $(BUILDDIR)/include/version.h
-
-include common.mk
-
-CLEAN_FIND = find "$(BUILDDIR)/" -xdev '(' -name '*.[ao]' -o -name '.*.c.dep' ')'
-
-clean::
-ifneq ($(BUILDDIR)/.git,)
-ifneq ($(BUILDDIR),.)
-ifneq ($(BUILDDIR),$(CURDIR))
- rm -rf $(BUILDDIR)
-endif
-endif
-endif
-# findutils v4.1.x (RHEL 4) do not have '+' syntax
- @if test -d "$(BUILDDIR)/"; then \
- $(CLEAN_FIND) -exec rm -f {} + 2> /dev/null || \
- $(CLEAN_FIND) -exec rm -f {} \; ; \
- fi
- rm -f $(BUILDDIR)/include/version.h
- $(MAKE) -C $(TESTS) clean
-
-install:: $(addprefix $(BUILDDIR)/,${BINS}) ${SCRIPTS}
- mkdir -p ${DESTDIR}/${SBINDIR}
- install -m 0755 $^ ${DESTDIR}/${SBINDIR}/
- mkdir -p ${DESTDIR}/${MANDIR}/man1
- install -m 0644 jffsX-utils/mkfs.jffs2.1 ${DESTDIR}/${MANDIR}/man1/
- -gzip -9f ${DESTDIR}/${MANDIR}/man1/*.1
-
-tests::
- $(MAKE) -C $(TESTS)
-
-cscope:
- cscope -bR
-
-$(BUILDDIR)/include/version.h: $(BUILDDIR)/include/version.h.tmp
- $(call BECHO,CHK)
- $(Q)cmp -s $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
-$(BUILDDIR)/include/version.h.tmp:
- ${Q}mkdir -p $(dir $@)
- $(Q)echo '#define VERSION "$(VERSION)"' > $@
-
-#
-# Utils in top level
-#
-obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o
-LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(CPPFLAGS)
-LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS)
-
-LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS)
-LDLIBS_jffs2reader = -lz $(LZOLDLIBS)
-
-$(foreach v,$(MISC_BINS),$(eval $(call mkdep,misc-utils/,$(v))))
-$(foreach v,$(JFFSX_BINS),$(eval $(call mkdep,jffsX-utils/,$(v))))
-$(foreach v,$(NAND_BINS),$(eval $(call mkdep,nand-utils/,$(v))))
-$(foreach v,$(NOR_BINS),$(eval $(call mkdep,nor-utils/,$(v))))
-
-#
-# Common libmtd
-#
-obj-libmtd.a = libmtd.o libmtd_legacy.o libcrc32.o libfec.o
-$(call _mkdep,lib/,libmtd.a)
-
-#
-# Utils in ubi-utils/ subdir
-#
-obj-libiniparser.a = libiniparser.o dictionary.o
-obj-libscan.a = libscan.o
-obj-libubi.a = libubi.o
-obj-libubigen.a = libubigen.o
-
-obj-mtdinfo = libubigen.a
-obj-ubinize = libubigen.a libiniparser.a
-obj-ubiformat = libubigen.a libscan.a
-
-$(foreach v,libubi.a libubigen.a libiniparser.a libscan.a,$(eval $(call _mkdep,ubi-utils/,$(v))))
-$(foreach v,$(UBI_BINS),$(eval $(call mkdep,ubi-utils/,$(v),libubi.a ubiutils-common.o)))
-
-#
-# Utils in ubifs-utils subdir
-#
-obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \
- hashtable/hashtable.o hashtable/hashtable_itr.o
-LDFLAGS_mkfs.ubifs = $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDFLAGS)
-LDLIBS_mkfs.ubifs = -lz $(LZOLDLIBS) -lm -luuid
-$(call mkdep,ubifs-utils/mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..27b43da
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,35 @@
+AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include
+
+if WITHOUT_XATTR
+AM_CPPFLAGS += -DWITHOUT_XATTR
+endif
+
+if WITHOUT_LZO
+AM_CPPFLAGS += -DWITHOUT_LZO
+endif
+
+sbin_PROGRAMS =
+sbin_SCRIPTS =
+noinst_LIBRARIES =
+noinst_PROGRAMS =
+dist_man1_MANS =
+
+EXTRA_DIST =
+
+GLOBAL_HEADER = \
+ include
+
+GLOBAL_EXTRA = \
+ COPYING
+
+EXTRA_DIST += $(GLOBAL_HEADER) $(GLOBAL_EXTRA)
+
+include lib/Makemodule.am
+include ubi-utils/Makemodule.am
+include ubifs-utils/Makemodule.am
+include misc-utils/Makemodule.am
+include nand-utils/Makemodule.am
+include nor-utils/Makemodule.am
+include jffsX-utils/Makemodule.am
+
+SUBDIRS = tests/ubi-tests
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..c08fadf
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+autoreconf --force --install --symlink
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..c021c6d
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,47 @@
+AC_PREREQ([2.60])
+
+AC_INIT([mtd-utils], 1.5.2, [linux-mtd@lists.infradead.org], mtd-utils)
+AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2])
+AM_SILENT_RULES([yes])
+AC_PROG_LIBTOOL
+AC_DISABLE_STATIC
+AC_PROG_CC
+AC_PROG_INSTALL
+
+AC_ARG_WITH([xattr],
+ [AS_HELP_STRING([--without-xattr],
+ [Disable support forextended file attributes])],
+ [case "${withval}" in
+ yes) AM_CONDITIONAL([WITHOUT_XATTR], [false]) ;;
+ no) AM_CONDITIONAL([WITHOUT_XATTR], [true]) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --without-xattr]) ;;
+ esac],
+ [AM_CONDITIONAL([WITHOUT_XATTR], [false])])
+
+
+AC_ARG_WITH([lzo],
+ [AS_HELP_STRING([--without-lzo], [Disable support for LZO compression])],
+ [case "${withval}" in
+ yes) AM_CONDITIONAL([WITHOUT_LZO], [false]) ;;
+ no) AM_CONDITIONAL([WITHOUT_LZO], [true]) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --without-lzo]) ;;
+ esac],
+ [AM_CONDITIONAL([WITHOUT_LZO], [false])])
+
+
+PKG_CHECK_MODULES(ZLIB, [ zlib ])
+PKG_CHECK_MODULES(UUID, [ uuid ])
+
+AM_COND_IF([WITHOUT_LZO], [], [
+ have_lzo="yes"
+ AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
+ AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
+ AC_CHECK_LIB([lzo2], [lzo1x_1_15_compress], [LZO_LIBS="-llzo2"],
+ [AC_CHECK_LIB([lzo],[lzo1x_1_15_compress],[LZO_LIBS="-llzo"],
+ [have_lzo="no"]
+ )]
+ )
+ test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo missing])
+])
+
+AC_OUTPUT([Makefile])
diff --git a/include/common.h b/include/common.h
index ca4c62e..bf1ade9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -29,7 +29,6 @@
#include <features.h>
#include <inttypes.h>
#include <sys/sysmacros.h>
-#include "version.h"
#ifndef PROGRAM_NAME
# error "You must define PROGRAM_NAME before including this header"
diff --git a/jffsX-utils/Makemodule.am b/jffsX-utils/Makemodule.am
new file mode 100644
index 0000000..fb181de
--- /dev/null
+++ b/jffsX-utils/Makemodule.am
@@ -0,0 +1,37 @@
+mkfs_jffs2_SOURCES = \
+ jffsX-utils/mkfs.jffs2.c \
+ jffsX-utils/rbtree.h \
+ jffsX-utils/compr_zlib.c \
+ jffsX-utils/compr.h \
+ jffsX-utils/rbtree.c \
+ jffsX-utils/compr_lzo.c \
+ jffsX-utils/compr.c \
+ jffsX-utils/compr_rtime.c
+mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS)
+
+jffs2reader_SOURCES = jffsX-utils/jffs2reader.c
+jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+
+jffs2dump_SOURCES = jffsX-utils/jffs2dump.c
+jffs2dump_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
+
+sumtool_SOURCES = jffsX-utils/sumtool.c
+sumtool_LDADD = libmtd.a
+
+JFFSX_BINS = \
+ mkfs.jffs2 jffs2dump jffs2reader sumtool
+
+JFFSX_MAN = \
+ jffsX-utils/mkfs.jffs2.1
+
+JFFSX_EXTRA = \
+ jffsX-utils/device_table.txt jffsX-utils/mkfs.jffs2.1
+
+JFFSX_HEADER = \
+ jffsX-utils/compr.h jffsX-utils/rbtree.h jffsX-utils/summary.h
+
+EXTRA_DIST += $(JFFSX_HEADER) $(JFFSX_EXTRA)
+
+dist_man1_MANS += $(JFFSX_MAN)
+sbin_PROGRAMS += $(JFFSX_BINS)
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
new file mode 100644
index 0000000..2fd933d
--- /dev/null
+++ b/lib/Makemodule.am
@@ -0,0 +1,8 @@
+libmtd_a_SOURCES = \
+ lib/libmtd.c \
+ lib/libfec.c \
+ lib/libcrc32.c \
+ lib/libmtd_legacy.c \
+ lib/libmtd_int.h
+
+noinst_LIBRARIES += libmtd.a
diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am
new file mode 100644
index 0000000..ce1c385
--- /dev/null
+++ b/misc-utils/Makemodule.am
@@ -0,0 +1,54 @@
+ftl_format_SOURCES = misc-utils/ftl_format.c
+
+doc_loadbios_SOURCES = misc-utils/doc_loadbios.c
+
+ftl_check_SOURCES = misc-utils/ftl_check.c
+
+mtd_debug_SOURCES = misc-utils/mtd_debug.c
+
+mtdpart_SOURCES = misc-utils/mtdpart.c
+
+docfdisk_SOURCES = misc-utils/docfdisk.c
+
+serve_image_SOURCES = misc-utils/serve_image.c
+serve_image_LDADD = libmtd.a
+
+recv_image_SOURCES = misc-utils/recv_image.c
+recv_image_LDADD = libmtd.a
+
+flash_lock_SOURCES = misc-utils/flash_lock.c
+
+flash_unlock_SOURCES = misc-utils/flash_unlock.c
+
+flash_otp_info_SOURCES = misc-utils/flash_otp_info.c
+
+flash_otp_dump_SOURCES = misc-utils/flash_otp_dump.c
+
+flash_otp_lock_SOURCES = misc-utils/flash_otp_lock.c
+
+flash_otp_write_SOURCES = misc-utils/flash_otp_write.c
+
+flashcp_SOURCES = misc-utils/flashcp.c
+
+flash_erase_SOURCES = misc-utils/flash_erase.c
+flash_erase_LDADD = libmtd.a
+
+MISC_BINS = \
+ ftl_format doc_loadbios ftl_check mtd_debug docfdisk \
+ serve_image recv_image flash_erase flash_lock \
+ flash_unlock flash_otp_info flash_otp_dump flash_otp_lock \
+ flash_otp_write flashcp mtdpart
+
+MISC_SH = \
+ misc-utils/flash_eraseall
+
+MISC_EXTRA = \
+ misc-utils/MAKEDEV
+
+MISC_HEADER = \
+ misc-utils/mcast_image.h
+
+EXTRA_DIST += $(MISC_HEADER) $(MISC_EXTRA) $(MISC_SH)
+
+sbin_PROGRAMS += $(MISC_BINS)
+sbin_SCRIPTS += $(MISC_SH)
diff --git a/nand-utils/Makemodule.am b/nand-utils/Makemodule.am
new file mode 100644
index 0000000..1d3a2b3
--- /dev/null
+++ b/nand-utils/Makemodule.am
@@ -0,0 +1,24 @@
+nanddump_SOURCES = nand-utils/nanddump.c
+nanddump_LDADD = libmtd.a
+
+nandwrite_SOURCES = nand-utils/nandwrite.c
+nandwrite_LDADD = libmtd.a
+
+nandtest_SOURCES = nand-utils/nandtest.c
+nandtest_LDADD = libmtd.a
+
+nftldump_SOURCES = nand-utils/nftldump.c
+nftldump_LDADD = libmtd.a
+
+nftl_format_SOURCES = nand-utils/nftl_format.c
+nftl_format_LDADD = libmtd.a
+
+NAND_BINS = \
+ nanddump nandwrite nandtest nftldump nftl_format
+
+NAND_SH = \
+ nand-utils/load_nandsim.sh
+
+EXTRA_DIST += $(NAND_SH)
+
+sbin_PROGRAMS += $(NAND_BINS)
diff --git a/nor-utils/Makemodule.am b/nor-utils/Makemodule.am
new file mode 100644
index 0000000..a5a0d4d
--- /dev/null
+++ b/nor-utils/Makemodule.am
@@ -0,0 +1,10 @@
+rfddump_SOURCES = nor-utils/rfddump.c
+rfddump_LDADD = libmtd.a
+
+rfdformat_SOURCES = nor-utils/rfdformat.c
+rfdformat_LDADD = libmtd.a
+
+NOR_BINS = \
+ rfddump rfdformat
+
+sbin_PROGRAMS += $(NOR_BINS)
diff --git a/nor-utils/rfddump.c b/nor-utils/rfddump.c
index 0375bac..32810f5 100644
--- a/nor-utils/rfddump.c
+++ b/nor-utils/rfddump.c
@@ -10,7 +10,7 @@
*/
#define PROGRAM_NAME "rfddump"
-#define VERSION "$Revision 1.0 $"
+#define PROGRAM_VERSION "$Revision 1.0 $"
#define _XOPEN_SOURCE 500 /* For pread */
@@ -69,7 +69,7 @@ void display_help(void)
void display_version(void)
{
- printf("%s " VERSION "\n"
+ printf("%s " PROGRAM_VERSION "\n"
"\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
diff --git a/nor-utils/rfdformat.c b/nor-utils/rfdformat.c
index 17d9d2d..a8a44a9 100644
--- a/nor-utils/rfdformat.c
+++ b/nor-utils/rfdformat.c
@@ -13,7 +13,7 @@
*/
#define PROGRAM_NAME "rfdformat"
-#define VERSION "$Revision 1.0 $"
+#define PROGRAM_VERSION "$Revision 1.0 $"
#define _XOPEN_SOURCE 500 /* For pread/pwrite */
@@ -42,7 +42,7 @@ void display_help(void)
void display_version(void)
{
- printf("%s " VERSION "\n"
+ printf("%s " PROGRAM_VERSION "\n"
"\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
diff --git a/tests/ubi-tests/Makefile.am b/tests/ubi-tests/Makefile.am
new file mode 100644
index 0000000..d57316a
--- /dev/null
+++ b/tests/ubi-tests/Makefile.am
@@ -0,0 +1,7 @@
+io_basic_SOURCES = io_basic.c helpers.c
+io_basic_LDADD = libmtd.a libubi.a
+io_basic_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+UBITEST_BINS = io_basic
+
+noinst_PROGRAMS += $(UBITEST_BINS)
diff --git a/ubi-utils/Makemodule.am b/ubi-utils/Makemodule.am
new file mode 100644
index 0000000..ea18235
--- /dev/null
+++ b/ubi-utils/Makemodule.am
@@ -0,0 +1,73 @@
+libubi_a_SOURCES = ubi-utils/libubi.c ubi-utils/ubiutils-common.c ubi-utils/libubi_int.h
+libubi_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+libubigen_a_SOURCES = ubi-utils/libubigen.c
+libubigen_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubiupdatevol_SOURCES = ubi-utils/ubiupdatevol.c
+ubiupdatevol_LDADD = libmtd.a libubi.a
+ubiupdatevol_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubimkvol_SOURCES = ubi-utils/ubimkvol.c
+ubimkvol_LDADD = libmtd.a libubi.a
+ubimkvol_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubirmvol_SOURCES = ubi-utils/ubirmvol.c
+ubirmvol_LDADD = libmtd.a libubi.a
+ubirmvol_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubicrc32_SOURCES = ubi-utils/ubicrc32.c
+ubicrc32_LDADD = libmtd.a libubi.a
+ubicrc32_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubinfo_SOURCES = ubi-utils/ubinfo.c
+ubinfo_LDADD = libmtd.a libubi.a
+ubinfo_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubiattach_SOURCES = ubi-utils/ubiattach.c
+ubiattach_LDADD = libmtd.a libubi.a
+ubiattach_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubidetach_SOURCES = ubi-utils/ubidetach.c
+ubidetach_LDADD = libmtd.a libubi.a
+ubidetach_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubinize_SOURCES = ubi-utils/ubinize.c ubi-utils/libiniparser.c ubi-utils/dictionary.c
+ubinize_LDADD = libubi.a libubigen.a libmtd.a
+ubinize_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubiformat_SOURCES = ubi-utils/ubiformat.c ubi-utils/libscan.c
+ubiformat_LDADD = libubi.a libubigen.a libmtd.a
+ubiformat_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubirename_SOURCES = ubi-utils/ubirename.c
+ubirename_LDADD = libmtd.a libubi.a
+ubirename_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+mtdinfo_SOURCES = ubi-utils/mtdinfo.c
+mtdinfo_LDADD = libubi.a libubigen.a libmtd.a
+mtdinfo_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubirsvol_SOURCES = ubi-utils/ubirsvol.c
+ubirsvol_LDADD = libmtd.a libubi.a
+ubirsvol_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+ubiblock_SOURCES = ubi-utils/ubiblock.c
+ubiblock_LDADD = libmtd.a libubi.a
+ubiblock_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+UBI_BINS = \
+ ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
+ ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock
+
+UBI_EXTRA = \
+ ubi-utils/LICENSE.libiniparser
+
+UBI_HEADER = \
+ ubi-utils/include ubi-utils/libubi_int.h
+
+EXTRA_DIST += $(UBI_HEADER) $(UBI_EXTRA)
+
+sbin_PROGRAMS += $(UBI_BINS)
+
+noinst_LIBRARIES += libubi.a libubigen.a
diff --git a/ubifs-utils/Makemodule.am b/ubifs-utils/Makemodule.am
new file mode 100644
index 0000000..5862afb
--- /dev/null
+++ b/ubifs-utils/Makemodule.am
@@ -0,0 +1,40 @@
+mkfs_ubifs_SOURCES = \
+ ubifs-utils/mkfs.ubifs/mkfs.ubifs.c \
+ ubifs-utils/mkfs.ubifs/defs.h \
+ ubifs-utils/mkfs.ubifs/lpt.h \
+ ubifs-utils/mkfs.ubifs/mkfs.ubifs.h \
+ ubifs-utils/mkfs.ubifs/crc16.h \
+ ubifs-utils/mkfs.ubifs/key.h \
+ ubifs-utils/mkfs.ubifs/compr.h \
+ ubifs-utils/mkfs.ubifs/ubifs.h \
+ ubifs-utils/mkfs.ubifs/crc16.c \
+ ubifs-utils/mkfs.ubifs/lpt.c \
+ ubifs-utils/mkfs.ubifs/compr.c \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable.h \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable_itr.h \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable_private.h \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable.c \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable_itr.c \
+ ubifs-utils/mkfs.ubifs/devtable.c
+mkfs_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(UUID_LIBS) -lm
+mkfs_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(UUID_CFLAGS) \
+ -I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/mkfs.ubifs/
+
+UBIFS_BINS = \
+ mkfs.ubifs
+
+UBIFS_HEADER = \
+ ubifs-utils/mkfs.ubifs/compr.h ubifs-utils/mkfs.ubifs/crc16.h \
+ ubifs-utils/mkfs.ubifs/defs.h ubifs-utils/mkfs.ubifs/key.h \
+ ubifs-utils/mkfs.ubifs/lpt.h ubifs-utils/mkfs.ubifs/mkfs.ubifs.h \
+ ubifs-utils/mkfs.ubifs/ubifs.h \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable.h \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable_itr.h \
+ ubifs-utils/mkfs.ubifs/hashtable/hashtable_private.h
+
+UBIFS_EXTRA = \
+ ubifs-utils/mkfs.ubifs/README
+
+EXTRA_DIST += $(UBIFS_HEADER) $(UBIFS_EXTRA)
+
+sbin_PROGRAMS += $(UBIFS_BINS)