diff --git a/Makefile.am b/Makefile.am
index 14caa371..74634d43 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,46 +21,13 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = doc examples
-
-lib_LTLIBRARIES = libkdumpfile.la
-libkdumpfile_la_SOURCES = \
- attr.c \
- context.c \
- devmem.c \
- diskdump.c \
- elfdump.c \
- ia32.c \
- lkcd.c \
- notes.c \
- open.c \
- read.c \
- s390x.c \
- s390dump.c \
- todo.c \
- util.c \
- vtop.c \
- x86_64.c
-
-EXTRA_libkdumpfile_la_DEPENDENCIES = libkdumpfile.map
-
-libkdumpfile_la_LDFLAGS = -version-info 5:0:5
-libkdumpfile_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libkdumpfile.map
-
-include_HEADERS = \
- kdumpfile.h
-
-noinst_HEADERS = \
- kdumpfile-priv.h \
- global-attr.def \
- static-attr.def
+SUBDIRS = doc src examples
dist_noinst_DATA = \
COPYING.GPLv2 \
COPYING.GPLv3 \
COPYING.LGPLv3 \
- README.md \
- libkdumpfile.map
+ README.md
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA=libkdumpfile.pc
diff --git a/configure.ac b/configure.ac
index 234834b3..89ac72f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl along with this program. If not, see .
AC_INIT([Library for reading kernel core dumps],
[0.1.6],[ptesarik@suse.cz],[libkdumpfile])
-AC_CONFIG_SRCDIR([diskdump.c])
+AC_CONFIG_SRCDIR([src/diskdump.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([config.h])
@@ -46,6 +46,7 @@ AC_CONFIG_FILES([
Makefile
doc/Makefile
examples/Makefile
+ src/Makefile
libkdumpfile.pc
])
diff --git a/examples/Makefile.am b/examples/Makefile.am
index cce06e66..c7b47887 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -19,8 +19,10 @@
## along with this program. If not, see .
##
+AM_CPPFLAGS = -I$(top_srcdir)/src
+LIBS = $(top_srcdir)/src/libkdumpfile.la
+
dumpattr_SOURCES = \
dumpattr.c
-dumpattr_LDADD = ../libkdumpfile.la
bin_PROGRAMS = dumpattr
diff --git a/attr.c b/src/attr.c
similarity index 100%
rename from attr.c
rename to src/attr.c
diff --git a/context.c b/src/context.c
similarity index 100%
rename from context.c
rename to src/context.c
diff --git a/devmem.c b/src/devmem.c
similarity index 100%
rename from devmem.c
rename to src/devmem.c
diff --git a/diskdump.c b/src/diskdump.c
similarity index 100%
rename from diskdump.c
rename to src/diskdump.c
diff --git a/elfdump.c b/src/elfdump.c
similarity index 100%
rename from elfdump.c
rename to src/elfdump.c
diff --git a/src/global-attr.def b/src/global-attr.def
new file mode 100644
index 00000000..b40b2583
--- /dev/null
+++ b/src/global-attr.def
@@ -0,0 +1,32 @@
+/* Definitions for global (but not static) attributes
+ *
+ * To use this file, provide a definition for the ATTR() macro:
+ *
+ * ATTR(dir, key, id, type, ctype)
+ *
+ * @param dir Directory identifier (without the dir_ prefix).
+ * @param key Key name (a constant C string).
+ * @param id C identifier.
+ * @param type Attribute type (kdump_attr_type).
+ * @param ctype Suggested C type for the attribute.
+ *
+ * A typical stanza is:
+ * #define ATTR(dir, key, field, type, ctype) \
+ * // use macro arguments to construct whatever you need
+ * #include "global-attr.def"
+ * #undef ATTR
+ */
+
+/* utsname */
+ATTR(linux_uts, "sysname", linux_uts_sysname, string, const char *)
+ATTR(linux_uts, "nodename", linux_uts_nodename, string, const char *)
+ATTR(linux_uts, "release", linux_uts_release, string, const char *)
+ATTR(linux_uts, "version", linux_uts_version, string, const char *)
+ATTR(linux_uts, "machine", linux_uts_machine, string, const char *)
+ATTR(linux_uts, "domainname", linux_uts_domainname, string, const char *)
+
+/* Xen */
+ATTR(xen_version, "major", xen_ver_major, number, unsigned long)
+ATTR(xen_version, "minor", xen_ver_minor, number, unsigned long)
+ATTR(xen_version, "extra", xen_ver_extra, string, const char *)
+ATTR(xen_version, "extra_addr", xen_ver_extra_addr, address, kdump_vaddr_t)
diff --git a/ia32.c b/src/ia32.c
similarity index 100%
rename from ia32.c
rename to src/ia32.c
diff --git a/kdumpfile-priv.h b/src/kdumpfile-priv.h
similarity index 100%
rename from kdumpfile-priv.h
rename to src/kdumpfile-priv.h
diff --git a/kdumpfile.h b/src/kdumpfile.h
similarity index 100%
rename from kdumpfile.h
rename to src/kdumpfile.h
diff --git a/libkdumpfile.map b/src/libkdumpfile.map
similarity index 100%
rename from libkdumpfile.map
rename to src/libkdumpfile.map
diff --git a/lkcd.c b/src/lkcd.c
similarity index 100%
rename from lkcd.c
rename to src/lkcd.c
diff --git a/notes.c b/src/notes.c
similarity index 100%
rename from notes.c
rename to src/notes.c
diff --git a/open.c b/src/open.c
similarity index 100%
rename from open.c
rename to src/open.c
diff --git a/read.c b/src/read.c
similarity index 100%
rename from read.c
rename to src/read.c
diff --git a/s390dump.c b/src/s390dump.c
similarity index 100%
rename from s390dump.c
rename to src/s390dump.c
diff --git a/s390x.c b/src/s390x.c
similarity index 100%
rename from s390x.c
rename to src/s390x.c
diff --git a/static-attr.def b/src/static-attr.def
similarity index 100%
rename from static-attr.def
rename to src/static-attr.def
diff --git a/todo.c b/src/todo.c
similarity index 100%
rename from todo.c
rename to src/todo.c
diff --git a/util.c b/src/util.c
similarity index 100%
rename from util.c
rename to src/util.c
diff --git a/vtop.c b/src/vtop.c
similarity index 100%
rename from vtop.c
rename to src/vtop.c
diff --git a/x86_64.c b/src/x86_64.c
similarity index 100%
rename from x86_64.c
rename to src/x86_64.c