Commit b5efe41f190cbb76eb1ca8ddf0c96990ddb83704

Ran Benita 2012-03-24T04:48:31

Make build non-recursive Unify all the different Makefile.am into a single short top level one (the test/Makefile.am file is left intact though). This makes the build system simpler to look and should encourage unifying more currently-disparate code. Some further motivation can be found in this page: http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/.gitignore b/.gitignore
index 72c4a0b..f66b0a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,3 +76,5 @@ core
 #		Edit the following section as needed
 # For example, !report.pc overrides *.pc. See 'man gitignore'
 #
+
+.dirstamp
diff --git a/Makefile.am b/Makefile.am
index 2a4d448..bc29464 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
-# Order: makekeys before src
-SUBDIRS = include makekeys src test
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = . test
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = xkbcommon.pc
@@ -15,3 +16,74 @@ ChangeLog:
 	$(CHANGELOG_CMD)
 
 dist-hook: ChangeLog INSTALL
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src
+AM_CFLAGS = \
+	$(X11_CFLAGS) \
+	$(XORG_COMPILER_FLAGS) \
+	$(XMALLOC_ZERO_CFLAGS) \
+	-DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"'
+AM_YFLAGS = -d
+
+xkbcommonincludedir = $(includedir)/xkbcommon
+xkbcommoninclude_HEADERS = include/xkbcommon/xkbcommon.h
+
+lib_LTLIBRARIES = libxkbcommon.la
+libxkbcommon_la_LDFLAGS = -no-undefined
+libxkbcommon_la_SOURCES = \
+	src/xkbcomp/action.c \
+	src/xkbcomp/action.h \
+	src/xkbcomp/alias.c \
+	src/xkbcomp/alias.h \
+	src/xkbcomp/compat.c \
+	src/xkbcomp/expr.c \
+	src/xkbcomp/expr.h \
+	src/xkbcomp/indicators.c \
+	src/xkbcomp/indicators.h \
+	src/xkbcomp/keycodes.c \
+	src/xkbcomp/keycodes.h \
+	src/xkbcomp/keymap.c \
+	src/xkbcomp/keytypes.c \
+	src/xkbcomp/misc.c \
+	src/xkbcomp/misc.h \
+	src/xkbcomp/parseutils.c \
+	src/xkbcomp/parseutils.h \
+	src/xkbcomp/symbols.c \
+	src/xkbcomp/vmod.c \
+	src/xkbcomp/vmod.h \
+	src/xkbcomp/xkbcomp.c \
+	src/xkbcomp/xkbcomp.h \
+	src/xkbcomp/xkbparse.y \
+	src/xkbcomp/xkbpath.c \
+	src/xkbcomp/xkbpath.h \
+	src/xkbcomp/xkbscan.l \
+	src/alloc.c \
+	src/atom.c \
+	src/keysym.c \
+	src/malloc.c \
+	src/map.c \
+	src/maprules.c \
+	src/misc.c \
+	src/state.c \
+	src/text.c \
+	src/utils.c \
+	src/utils.h \
+	src/xkb.c \
+	src/xkballoc.h \
+	src/xkbmisc.h \
+	src/xkbrules.h \
+	src/XKBcommonint.h \
+	include/xkbcommon/xkbcommon.h
+
+BUILT_SOURCES = src/xkbcomp/xkbparse.h src/ks_tables.h
+CLEANFILES = src/ks_tables.h
+
+noinst_PROGRAMS = makekeys/makekeys
+makekeys_makekeys_SOURCES = makekeys/makekeys.c
+makekeys_makekeys_CC = $(CC_FOR_BUILD)
+makekeys_makekeys_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD)
+makekeys_makekeys_CFLAGS = $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
+makekeys_makekeys_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
+
+src/ks_tables.h: $(KEYSYMDEFS) $(top_builddir)/makekeys/makekeys$(EXEEXT)
+	$(top_builddir)/makekeys/makekeys $(KEYSYMDEFS) > $@
diff --git a/configure.ac b/configure.ac
index 724fe0d..3a4519a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ AC_CONFIG_HEADERS([src/config.h])
 AC_CONFIG_MACRO_DIR([m4])
 
 # Initialize Automake
-AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
 AM_MAINTAINER_MODE
 
 # Initialize libtool
@@ -104,11 +104,7 @@ AC_ARG_WITH([xkb_config_root],
 AC_SUBST([XKBCONFIGROOT])
 
 AC_CONFIG_FILES([
-	Makefile
-	xkbcommon.pc
-	include/Makefile
-	makekeys/Makefile
-	src/Makefile
-	src/xkbcomp/Makefile
-	test/Makefile])
+        Makefile
+        test/Makefile
+        xkbcommon.pc])
 AC_OUTPUT
diff --git a/include/Makefile.am b/include/Makefile.am
deleted file mode 100644
index b929cf9..0000000
--- a/include/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-nobase_include_HEADERS = xkbcommon/xkbcommon.h
diff --git a/m4/.gitkeep b/m4/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/m4/.gitkeep
diff --git a/makekeys/Makefile.am b/makekeys/Makefile.am
deleted file mode 100644
index 1ed50a5..0000000
--- a/makekeys/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = $(X11_CFLAGS) $(CWARNFLAGS)
-
-# need to use build-native compiler
-CC = $(CC_FOR_BUILD)
-CPPFLAGS = $(CPPFLAGS_FOR_BUILD)
-CFLAGS = $(CFLAGS_FOR_BUILD)
-LDFLAGS = $(LDFLAGS_FOR_BUILD)
-noinst_PROGRAMS = makekeys
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index 2aed33d..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-SUBDIRS = xkbcomp
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = $(X11_CFLAGS) $(CWARNFLAGS) $(XMALLOC_ZERO_CFLAGS)
-
-lib_LTLIBRARIES = libxkbcommon.la
-libxkbcommon_la_LIBADD = xkbcomp/libxkbcomp.la
-libxkbcommon_la_LDFLAGS = -no-undefined
-libxkbcommon_la_SOURCES = \
-	XKBcommonint.h \
-	alloc.c \
-	atom.c \
-	keysym.c \
-	malloc.c \
-	map.c \
-	maprules.c \
-	misc.c \
-	state.c \
-	text.c \
-	utils.c \
-	utils.h \
-	xkb.c \
-	xkballoc.h \
-	xkbmisc.h \
-	xkbrules.h
-
-BUILT_SOURCES = ks_tables.h
-CLEANFILES = $(BUILT_SOURCES)
-
-ks_tables.h: $(KEYSYMDEFS) $(top_builddir)/makekeys/makekeys$(EXEEXT)
-	$(top_builddir)/makekeys/makekeys $(KEYSYMDEFS) > $@
diff --git a/src/xkbcomp/Makefile.am b/src/xkbcomp/Makefile.am
deleted file mode 100644
index 473f94d..0000000
--- a/src/xkbcomp/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src
-AM_CFLAGS = $(X11_CFLAGS) $(CWARNFLAGS) \
-	-DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"'
-AM_YFLAGS = -d
-
-noinst_LTLIBRARIES = libxkbcomp.la
-libxkbcomp_la_SOURCES = \
-	action.c \
-	action.h \
-	alias.c \
-	alias.h \
-	compat.c \
-	expr.c \
-	expr.h \
-	indicators.c \
-	indicators.h \
-	keycodes.c \
-	keycodes.h \
-	keymap.c \
-	keytypes.c \
-	misc.c \
-	misc.h \
-	parseutils.c \
-	parseutils.h \
-	symbols.c \
-	vmod.c \
-	vmod.h \
-	xkbcomp.c \
-	xkbcomp.h \
-	xkbparse.y \
-	xkbpath.c \
-	xkbpath.h \
-	xkbscan.l
-
-BUILT_SOURCES = xkbparse.h
diff --git a/test/Makefile.am b/test/Makefile.am
index efe11cb..1f9d537 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,6 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src
-AM_CFLAGS = $(X11_CFLAGS) $(CWARNFLAGS)
-LDADD = $(top_builddir)/src/libxkbcommon.la
+AM_CFLAGS = $(X11_CFLAGS) $(XORG_COMPILER_FLAGS)
+LDADD = $(top_builddir)/libxkbcommon.la
 
 TESTS_ENVIRONMENT = $(SHELL)