aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2016-01-31 05:04:50 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2016-01-31 05:04:50 +0100
commitea0179e342343f5fbefb265bde4dea0d475f0781 (patch)
tree70af3013fe80707c802e88cae93bb5d504da2f55
parent2951f147ad24737e2c40a5fa4ace611a9b3fb829 (diff)
downloadsciteco-ea0179e342343f5fbefb265bde4dea0d475f0781.tar.gz
interfaces have their own automake subdirectories and convenience libraries now
* use libtool convenience libraries as much as possible (for all static libraries except Scintilla) * improves separation of language and user interface implementations (e.g. the Gtk widgets are not interesting for the rest of SciTECO) * the Curses popup widget can now be factored out of interface-curses.cpp * some common CPPFLAGS are now defined by ./configure via AM_CPPFLAGS, so they don't have to be repeated in each submodule. * fixed building the Curses UI: GTK_FLOW_BOX_FALLBACK conditional must always be defined.
-rw-r--r--configure.ac20
-rw-r--r--src/Makefile.am93
-rw-r--r--src/interface-curses/Makefile.am9
-rw-r--r--src/interface-curses/interface-curses.cpp (renamed from src/interface-curses.cpp)0
-rw-r--r--src/interface-curses/interface-curses.h (renamed from src/interface-curses.h)0
-rw-r--r--src/interface-gtk/Makefile.am23
-rw-r--r--src/interface-gtk/gtk-info-popup.gob (renamed from src/gtk-info-popup.gob)0
-rw-r--r--src/interface-gtk/gtkflowbox.c (renamed from src/gtkflowbox.c)0
-rw-r--r--src/interface-gtk/gtkflowbox.h (renamed from src/gtkflowbox.h)0
-rw-r--r--src/interface-gtk/interface-gtk.cpp (renamed from src/interface-gtk.cpp)0
-rw-r--r--src/interface-gtk/interface-gtk.h (renamed from src/interface-gtk.h)0
-rw-r--r--src/interface.h4
12 files changed, 86 insertions, 63 deletions
diff --git a/configure.ac b/configure.ac
index a31658b..d44689b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,10 +19,19 @@ AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
+# Automake build flag substitutions.
+# Necessary so we can change their default values here
+AC_SUBST(AM_CPPFLAGS)
+
# SciTECO library macro directory
scitecolibdir=$datadir/$PACKAGE/lib
AC_SUBST(scitecolibdir)
+# These paths can be changed at install-time and
+# should not be written into config.h:
+AM_CPPFLAGS="$AM_CPPFLAGS -D'SCITECODATADIR=\"\$(pkgdatadir)\"' \
+ -D'SCITECOLIBDIR=\"\$(scitecolibdir)\"'"
+
# Auxiliary functions
# expand $1 and print its absolute path
@@ -86,8 +95,9 @@ PKG_CHECK_MODULES(LIBGLIB, [glib-2.0 >= 2.28], [
# Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS([bsd/sys/queue.h])
-AM_CONDITIONAL(NEED_COMPAT, [test $ac_cv_header_bsd_sys_queue_h = no])
+AC_CHECK_HEADERS([bsd/sys/queue.h], [], [
+ AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/compat"
+])
case $host in
*-mingw*)
@@ -247,7 +257,6 @@ gtk)
AC_CHECK_FUNCS(gtk_flow_box_new, [], [
GTK_FLOW_BOX_FALLBACK=true
])
- AM_CONDITIONAL(GTK_FLOW_BOX_FALLBACK, [test x$GTK_FLOW_BOX_FALLBACK = xtrue])
AC_CHECK_PROG(GOB2, gob2, gob2)
if [[ x$GOB2 = x ]]; then
@@ -266,6 +275,7 @@ gtk)
esac
AM_CONDITIONAL(INTERFACE_GTK, [test x$INTERFACE = xgtk])
+AM_CONDITIONAL(GTK_FLOW_BOX_FALLBACK, [test x$GTK_FLOW_BOX_FALLBACK = xtrue])
AC_ARG_WITH(teco-integer,
AS_HELP_STRING([--with-teco-integer=SIZE],
@@ -320,6 +330,8 @@ AC_ARG_ENABLE(static-executables,
[static_executables=$enableval], [static_executables=no])
AM_CONDITIONAL(STATIC_EXECUTABLES, [test x$static_executables = xyes])
-AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile])
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([src/Makefile src/interface-gtk/Makefile src/interface-curses/Makefile])
+AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([doc/Makefile doc/Doxyfile])
AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index 3c60ba0..306bfb2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,21 +1,21 @@
+# The Gtk and Curses UIs have their own subdirectories.
+# Either of them will build libsciteco-interface.a
+if INTERFACE_GTK
+SUBDIRS = interface-gtk
+LIBSCITECO_INTERFACE = interface-gtk/libsciteco-interface.la
+else
+SUBDIRS = interface-curses
+LIBSCITECO_INTERFACE = interface-curses/libsciteco-interface.la
+endif
+
include $(top_srcdir)/bootstrap.am
include $(top_srcdir)/scintilla.am
-AM_CFLAGS = -Wall -std=c99
AM_CXXFLAGS = -Wall -Wno-char-subscripts
if CLANG
AM_CXXFLAGS += -Wno-mismatched-tags
endif
-# These paths can be changed at install-time and
-# should not be written into config.h:
-AM_CPPFLAGS = -D'SCITECODATADIR="$(pkgdatadir)"' \
- -D'SCITECOLIBDIR="@scitecolibdir@"'
-
-if NEED_COMPAT
-AM_CPPFLAGS += -I@top_srcdir@/compat
-endif
-
if STATIC_EXECUTABLES
# AM_LDFLAGS are libtool flags, NOT compiler/linker flags
AM_LDFLAGS = -all-static
@@ -23,61 +23,43 @@ endif
BUILT_SOURCES =
-EXTRA_DIST = gtk-info-popup.gob \
- symbols-extract.tes \
+EXTRA_DIST = symbols-extract.tes \
sciteco.html
-noinst_LIBRARIES = libsciteco-base.a
-libsciteco_base_a_SOURCES = main.cpp sciteco.h \
- string-utils.cpp string-utils.h \
- error.cpp error.h \
- cmdline.cpp cmdline.h \
- undo.cpp undo.h \
- expressions.cpp expressions.h \
- document.cpp document.h \
- ioview.cpp ioview.h \
- qregisters.cpp qregisters.h \
- ring.cpp ring.h \
- parser.cpp parser.h \
- search.cpp search.h \
- spawn.cpp spawn.h \
- glob.cpp glob.h \
- goto.cpp goto.h \
- rbtree.cpp rbtree.h \
- symbols.cpp symbols.h \
- interface.cpp interface.h
-nodist_libsciteco_base_a_SOURCES =
-
-if INTERFACE_GTK
-
-BUILT_SOURCES += gtk-info-popup.c \
- gtk-info-popup.h gtk-info-popup-private.h
-nodist_libsciteco_base_a_SOURCES += gtk-info-popup.c
-
-libsciteco_base_a_SOURCES += interface-gtk.cpp interface-gtk.h
-if GTK_FLOW_BOX_FALLBACK
-libsciteco_base_a_SOURCES += gtkflowbox.c gtkflowbox.h
-endif
-
-else
-# else must be Curses interface
-
-libsciteco_base_a_SOURCES += interface-curses.cpp interface-curses.h
-
-endif
+noinst_LTLIBRARIES = libsciteco-base.la
+libsciteco_base_la_SOURCES = main.cpp sciteco.h \
+ string-utils.cpp string-utils.h \
+ error.cpp error.h \
+ cmdline.cpp cmdline.h \
+ undo.cpp undo.h \
+ expressions.cpp expressions.h \
+ document.cpp document.h \
+ ioview.cpp ioview.h \
+ qregisters.cpp qregisters.h \
+ ring.cpp ring.h \
+ parser.cpp parser.h \
+ search.cpp search.h \
+ spawn.cpp spawn.h \
+ glob.cpp glob.h \
+ goto.cpp goto.h \
+ rbtree.cpp rbtree.h \
+ symbols.cpp symbols.h \
+ interface.cpp interface.h
+# NOTE: We cannot link in Scintilla (static library) into
+# a libtool convenience library
+libsciteco_base_la_LIBADD = $(LIBSCITECO_INTERFACE)
if BOOTSTRAP
noinst_PROGRAMS = sciteco-minimal
symbols-scintilla.cpp symbols-scilexer.cpp : sciteco-minimal$(EXEEXT)
endif
sciteco_minimal_SOURCES = symbols-minimal.cpp
-sciteco_minimal_LDADD = libsciteco-base.a \
- @SCINTILLA_PATH@/bin/scintilla.a
+sciteco_minimal_LDADD = libsciteco-base.la \
+ @SCINTILLA_PATH@/bin/scintilla.a
bin_PROGRAMS = sciteco
sciteco_SOURCES =
-nodist_sciteco_SOURCES = $(nodist_sciteco_minimal_SOURCES) \
- symbols-scintilla.cpp symbols-scilexer.cpp
+nodist_sciteco_SOURCES = symbols-scintilla.cpp symbols-scilexer.cpp
sciteco_LDADD = $(sciteco_minimal_LDADD)
# For MinGW: Compile in resource (contains the icon)
@@ -90,9 +72,6 @@ endif
CLEANFILES = $(BUILT_SOURCES) \
symbols-scintilla.cpp symbols-scilexer.cpp
-%.c %.h %-private.h : %.gob
- @GOB2@ --gtk3 $<
-
symbols-scintilla.cpp : @SCINTILLA_PATH@/include/Scintilla.h \
symbols-extract.tes
$(BOOTSTRAP_SCITECO) -m @srcdir@/symbols-extract.tes \
diff --git a/src/interface-curses/Makefile.am b/src/interface-curses/Makefile.am
new file mode 100644
index 0000000..a64694c
--- /dev/null
+++ b/src/interface-curses/Makefile.am
@@ -0,0 +1,9 @@
+AM_CPPFLAGS += -I$(top_srcdir)/src
+
+AM_CXXFLAGS = -Wall -Wno-char-subscripts
+if CLANG
+AM_CXXFLAGS += -Wno-mismatched-tags
+endif
+
+noinst_LTLIBRARIES = libsciteco-interface.la
+libsciteco_interface_la_SOURCES = interface-curses.cpp interface-curses.h
diff --git a/src/interface-curses.cpp b/src/interface-curses/interface-curses.cpp
index 49339d4..49339d4 100644
--- a/src/interface-curses.cpp
+++ b/src/interface-curses/interface-curses.cpp
diff --git a/src/interface-curses.h b/src/interface-curses/interface-curses.h
index a6b0e1c..a6b0e1c 100644
--- a/src/interface-curses.h
+++ b/src/interface-curses/interface-curses.h
diff --git a/src/interface-gtk/Makefile.am b/src/interface-gtk/Makefile.am
new file mode 100644
index 0000000..64b4625
--- /dev/null
+++ b/src/interface-gtk/Makefile.am
@@ -0,0 +1,23 @@
+AM_CPPFLAGS += -I$(top_srcdir)/src
+
+AM_CFLAGS = -Wall -std=c99
+AM_CXXFLAGS = -Wall -Wno-char-subscripts
+if CLANG
+AM_CXXFLAGS += -Wno-mismatched-tags
+endif
+
+EXTRA_DIST = gtk-info-popup.gob
+BUILT_SOURCES = gtk-info-popup.c \
+ gtk-info-popup.h gtk-info-popup-private.h
+
+noinst_LTLIBRARIES = libsciteco-interface.la
+libsciteco_interface_la_SOURCES = interface-gtk.cpp interface-gtk.h
+if GTK_FLOW_BOX_FALLBACK
+libsciteco_interface_la_SOURCES += gtkflowbox.c gtkflowbox.h
+endif
+nodist_libsciteco_interface_la_SOURCES = gtk-info-popup.c
+
+CLEANFILES = $(BUILT_SOURCES)
+
+%.c %.h %-private.h : %.gob
+ @GOB2@ --gtk3 $<
diff --git a/src/gtk-info-popup.gob b/src/interface-gtk/gtk-info-popup.gob
index 5082091..5082091 100644
--- a/src/gtk-info-popup.gob
+++ b/src/interface-gtk/gtk-info-popup.gob
diff --git a/src/gtkflowbox.c b/src/interface-gtk/gtkflowbox.c
index 1a5c2e9..1a5c2e9 100644
--- a/src/gtkflowbox.c
+++ b/src/interface-gtk/gtkflowbox.c
diff --git a/src/gtkflowbox.h b/src/interface-gtk/gtkflowbox.h
index 6f0549f..6f0549f 100644
--- a/src/gtkflowbox.h
+++ b/src/interface-gtk/gtkflowbox.h
diff --git a/src/interface-gtk.cpp b/src/interface-gtk/interface-gtk.cpp
index 9b0b0aa..9b0b0aa 100644
--- a/src/interface-gtk.cpp
+++ b/src/interface-gtk/interface-gtk.cpp
diff --git a/src/interface-gtk.h b/src/interface-gtk/interface-gtk.h
index b5200ea..b5200ea 100644
--- a/src/interface-gtk.h
+++ b/src/interface-gtk/interface-gtk.h
diff --git a/src/interface.h b/src/interface.h
index 062c377..9552984 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -340,9 +340,9 @@ public:
} /* namespace SciTECO */
#ifdef INTERFACE_GTK
-#include "interface-gtk.h"
+#include "interface-gtk/interface-gtk.h"
#elif defined(INTERFACE_CURSES)
-#include "interface-curses.h"
+#include "interface-curses/interface-curses.h"
#else
#error No interface selected!
#endif