summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2012-06-12 09:48:05 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-06-12 10:02:44 +0200
commitc850c8b4047b8b7bcda0076ce1207018007bb795 (patch)
tree8210eb88cd419e6df222b2164e0a4245d98bcde5
parentfc8f69c8bb591162d9d29191dcc1feccaf85ed5d (diff)
downloadgenimage-c850c8b4047b8b7bcda0076ce1207018007bb795.tar.gz
genimage-c850c8b4047b8b7bcda0076ce1207018007bb795.tar.xz
build with autotools
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--.gitignore2
-rw-r--r--Makefile14
-rw-r--r--Makefile.am47
-rwxr-xr-xautogen.sh19
-rw-r--r--config.c1
-rw-r--r--configure.ac54
-rw-r--r--genimage.c1
-rw-r--r--image-ext2.c1
-rw-r--r--image-file.c1
-rw-r--r--image-flash.c1
-rw-r--r--image-hd.c1
-rw-r--r--image-jffs2.c1
-rw-r--r--image-tar.c1
-rw-r--r--image-ubi.c1
-rw-r--r--image-ubifs.c1
-rw-r--r--m4/.gitignore6
-rw-r--r--util.c1
17 files changed, 128 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index fa4bb99..ce103ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
/*.o
/genimage
+/Makefile.in
+/Makefile
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 6937846..0000000
--- a/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-
-CFLAGS=-Wall
-LDFLAGS=-lconfuse
-all: genimage
-DEPS = genimage.h list.h
-
-%.o: %.c $(DEPS)
- $(CC) -c -o $@ $< $(CFLAGS)
-
-genimage: genimage.o image-jffs2.o image-ext2.o image-ubi.o image-ubifs.o \
- image-flash.o image-file.o image-tar.o image-hd.o util.o config.o
-
-clean:
- rm -f *.o genimage
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..d19760c
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,47 @@
+EXTRA_DIST = \
+ test.config \
+ flash.conf
+
+CLEANFILES =
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AM_MAKEFLAGS = --no-print-directory
+
+AM_CPPFLAGS = \
+ -include $(top_builddir)/config.h \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DLIBEXECDIR=\""$(libexecdir)"\"
+
+AM_CFLAGS = ${my_CFLAGS} \
+ -fvisibility=hidden \
+ -ffunction-sections \
+ -fdata-sections
+
+AM_LDFLAGS = \
+ -Wl,--gc-sections \
+ -Wl,--as-needed
+
+bin_PROGRAMS = genimage
+genimage_SOURCES = \
+ genimage.c \
+ config.c \
+ util.c \
+ image-ext2.c \
+ image-file.c \
+ image-flash.c \
+ image-hd.c \
+ image-jffs2.c \
+ image-tar.c \
+ image-ubi.c \
+ image-ubifs.c
+
+genimage_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(CONFUSE_CFLAGS)
+
+genimage_LDADD = \
+ $(CONFUSE_LIBS)
+
+noinst_HEADERS = \
+ genimage.h \
+ list.h
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..ab7074b
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+
+if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
+ cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
+ chmod +x .git/hooks/pre-commit && \
+ echo "Activated pre-commit hook."
+fi
+
+autoreconf --install --symlink
+
+args="--prefix=/usr"
+
+echo
+echo "----------------------------------------------------------------"
+echo "Initialized build system. For a common configuration please run:"
+echo "----------------------------------------------------------------"
+echo
+echo "./configure CFLAGS='-g -O0' $args"
+echo
diff --git a/config.c b/config.c
index bcad475..0cb546e 100644
--- a/config.c
+++ b/config.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..053d947
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,54 @@
+AC_PREREQ(2.60)
+AC_INIT([genimage],
+ [1],
+ [s.hauer@pengutronix.de],
+ [genimage],
+ [http://www.pengutronix.de/genimage/])
+AC_CONFIG_SRCDIR([genimage.c])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+AC_CONFIG_MACRO_DIR([m4])
+AM_SILENT_RULES([yes])
+LT_INIT([disable-static pic-only])
+AC_PREFIX_DEFAULT([/usr])
+
+AC_PROG_MKDIR_P
+
+AC_ARG_ENABLE([debug],
+ AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
+ [], [enable_debug=no])
+AS_IF([test "x$enable_debug" = "xyes"], [
+ AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
+])
+
+my_CFLAGS="-Wall \
+-Wmissing-declarations -Wmissing-prototypes \
+-Wnested-externs -Wpointer-arith \
+-Wpointer-arith -Wsign-compare -Wchar-subscripts \
+-Wstrict-prototypes -Wshadow \
+-Wformat-security -Wtype-limits"
+AC_SUBST([my_CFLAGS])
+
+PKG_CHECK_MODULES(CONFUSE, libconfuse)
+
+AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_FILES([
+ Makefile
+])
+
+AC_OUTPUT
+AC_MSG_RESULT([
+ $PACKAGE $VERSION
+ =====
+
+ prefix: ${prefix}
+
+ compiler: ${CC}
+ cflags: ${CFLAGS}
+ ldflags: ${LDFLAGS}
+
+ debug: ${enable_debug}
+])
diff --git a/genimage.c b/genimage.c
index 03b84f4..638bcc6 100644
--- a/genimage.c
+++ b/genimage.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <confuse.h>
#include <stdlib.h>
diff --git a/image-ext2.c b/image-ext2.c
index 6edfbc5..99f636a 100644
--- a/image-ext2.c
+++ b/image-ext2.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-file.c b/image-file.c
index 91c0cb6..b291e9d 100644
--- a/image-file.c
+++ b/image-file.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-flash.c b/image-flash.c
index c4f0b67..f18d38e 100644
--- a/image-flash.c
+++ b/image-flash.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-hd.c b/image-hd.c
index 4a314a3..5f1bd21 100644
--- a/image-hd.c
+++ b/image-hd.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-jffs2.c b/image-jffs2.c
index bc722f5..0d81aff 100644
--- a/image-jffs2.c
+++ b/image-jffs2.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-tar.c b/image-tar.c
index 5fca48e..78decbd 100644
--- a/image-tar.c
+++ b/image-tar.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-ubi.c b/image-ubi.c
index 169a472..48a6e79 100644
--- a/image-ubi.c
+++ b/image-ubi.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/image-ubifs.c b/image-ubifs.c
index bf2cbcd..f319a8d 100644
--- a/image-ubifs.c
+++ b/image-ubifs.c
@@ -15,7 +15,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..8bab51c
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,6 @@
+libtool.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+lt~obsolete.m4
+
diff --git a/util.c b/util.c
index c5f1b2c..b7ffeb6 100644
--- a/util.c
+++ b/util.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
#include <confuse.h>
#include <stdio.h>
#include <string.h>