Skip to content

Commit

Permalink
Build: More improvements to the build system
Browse files Browse the repository at this point in the history
 * This patch is another one in a series of improvments
   to the build system.
 * It fixes some 'make distcheck' problems that the
   patch to compile the UI file into the tilda binary
   introduced.
 * It also removes some unneeded includes.
 * It switches to using PKG_CHECK_MODULES for X11 detection
 * Finally it makes out-of-tree builds possible. To perform an
   out-of-tree build do the following:

    - create a such as build/ either inside or outside the tilda folder.
    - run /path/to/tilda/autogen.sh && make
    - optionally run 'make distcheck'

   This will help you keep your source directory clean.

 * Use ""-includes instead of <>-includes for local headers
  • Loading branch information
lanoxx committed Sep 25, 2014
1 parent bf2857a commit d26e99c
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 81 deletions.
7 changes: 0 additions & 7 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,3 @@ bin_PROGRAMS =

include src/Makefile.am

# We register this uninstall hook to remove the ${pkgdatadir}, which
# is created by the pkgdata_DATA directive above. Without this hook
# the folder would be left over after a make uninstall.
# We wrap it into and if-then because otherwise make distcheck would
# fail.
uninstall-hook:
if test -d ${pkgdatadir}; then rmdir ${pkgdatadir}; fi
6 changes: 4 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ echo;

# Autoconf will call run autopoint, aclocal, autoconf, autoheader and automake
# to setup and configure the build environment
autoreconf --verbose --install --symlink --force || {
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
autoreconf --verbose --install --symlink --force "$srcdir" || {
echo;
echo "autoreconf has encountered an error."
echo;
Expand All @@ -44,4 +46,4 @@ autoreconf --verbose --install --symlink --force || {
echo
echo "Running configure now"
echo
./configure "$@"
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.0.0])
PKG_CHECK_MODULES([VTE], [vte-2.90])
PKG_CHECK_MODULES([LIBCONFUSE], [libconfuse])
PKG_CHECK_MODULES([X11], [x11])

# Checks for header files.
AC_PATH_X
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h malloc.h stdlib.h string.h strings.h sys/ioctl.h unistd.h confuse.h])
AC_CHECK_HEADERS([fcntl.h malloc.h stdlib.h string.h strings.h sys/ioctl.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
Expand Down
22 changes: 11 additions & 11 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
# vim: set noexpandtab ts=8 sts=8 sw=8:

# Define a C macro LOCALEDIR indicating where catalogs
# will be installed.
DEFS += -DLOCALEDIR=\"$(localedir)\" -DDATADIR=\"$(datadir)\" -DPKGDATADIR=\"$(pkgdatadir)\"

bin_PROGRAMS += src/tilda

# Rules to compile resources
src/glade-resources.h: src/glade-resources.gresource.xml
$(GLIB_COMPILE_RESOURCES) --generate $< --target=$@ --sourcedir=src
$(GLIB_COMPILE_RESOURCES) --generate $< --target=$@ --sourcedir=$(srcdir)/src
src/glade-resources.c: src/glade-resources.gresource.xml
$(GLIB_COMPILE_RESOURCES) --generate $< --target=$@ --sourcedir=src
$(GLIB_COMPILE_RESOURCES) --generate $< --target=$@ --sourcedir=$(srcdir)/src

# Dependencies rule, and do not forget to do a make after
# editing the UI with glade!
src/glade-resources.c src/glade-resources.h: \
src/glade-resources.gresource.xml \
$(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies src/glade-resources.gresource.xml --sourcedir=src)
$(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/src/glade-resources.gresource.xml --sourcedir=$(srcdir)/src)

src_tilda_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_builddir)/src \
-DDATADIR='"$(datadir)"' \
-DMODULEDIR='"$(moduledir)"' \
-DLIBEXECDIR='"$(libexecdir)"'
-DLOCALEDIR='"$(localedir)"' \
-DPKGDATADIR='"$(pkgdatadir)"'

# Keep the headers here so that make dist-bzip2 works
src_tilda_SOURCES = src/callback_func.h src/callback_func.c \
Expand All @@ -37,7 +33,8 @@ src_tilda_SOURCES = src/callback_func.h src/callback_func.c \
src/tomboykeybinder.h src/tomboykeybinder.c \
src/wizard.h src/wizard.c \
src/xerror.h src/xerror.c \
src/glade-resources.h src/glade-resources.c
src/glade-resources.h src/glade-resources.c \
src/glade-resources.gresource.xml

src_tilda_CFLAGS = $(AM_CFLAGS) \
$(GTK_CFLAGS) \
Expand All @@ -60,4 +57,7 @@ src_tilda_LDADD = $(AM_LDADD) \
$(LTLIBINTL) \
$(LEXLIB)

CLEANNFILES=src/glade-resources.h src/glade-resources.c
EXTRA_DIST += src/glade-resources.gresource.xml \
src/tilda.ui

CLEANFILES += src/glade-resources.h src/glade-resources.c
6 changes: 3 additions & 3 deletions src/callback_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

#include <tilda-config.h>

#include <debug.h>
#include <configsys.h>
#include <callback_func.h>
#include "debug.h"
#include "configsys.h"
#include "callback_func.h"

#include <glib.h>
#include <glib/gi18n.h>
Expand Down
4 changes: 2 additions & 2 deletions src/callback_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#ifndef CALLBACK_FUNC_H
#define CALLBACK_FUNC_H

#include <tilda_window.h>
#include <tilda_terminal.h>
#include "tilda_window.h"
#include "tilda_terminal.h"

#include <glib.h>
#include <gtk/gtk.h>
Expand Down
4 changes: 2 additions & 2 deletions src/configsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define _XOPEN_SOURCE /* feature test macro for fsync */

#include <tilda-config.h>
#include <debug.h>
#include "debug.h"

#include <confuse.h>
#include <glib.h>
Expand All @@ -27,7 +27,7 @@
#include <stdlib.h> /* atoi */
#include <unistd.h> /* fsync */

#include <configsys.h>
#include "configsys.h"

static cfg_t *tc;

Expand Down
4 changes: 1 addition & 3 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
#ifndef DEBUG_H
#define DEBUG_H

#include <tilda-config.h>
#include "tilda-config.h"
#include <libgen.h>

#include <glib.h>
#include <stdio.h>



/* Debug Macros
*
* Add -DDEBUG to your compile options to turn on assert()s.
Expand Down
12 changes: 6 additions & 6 deletions src/key_grabber.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

#include <tilda-config.h>

#include <debug.h>
#include <key_grabber.h>
#include <tilda.h>
#include <xerror.h>
#include "debug.h"
#include "key_grabber.h"
#include "tilda.h"
#include "xerror.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <configsys.h>
#include <tomboykeybinder.h>
#include "configsys.h"
#include "tomboykeybinder.h"

#include <X11/Xlib.h>
#include <X11/keysym.h>
Expand Down
2 changes: 1 addition & 1 deletion src/key_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef TILDA_KEY_GRABBER_C
#define TILDA_KEY_GRABBER_C

#include <tilda_window.h>
#include "tilda_window.h"

G_BEGIN_DECLS

Expand Down
22 changes: 9 additions & 13 deletions src/tilda.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

#include <tilda-config.h>

#include <debug.h>
#include <tilda.h>
#include <callback_func.h>
#include <configsys.h>
#include <tilda_window.h>
#include <key_grabber.h> /* for pull */
#include <wizard.h>
#include <xerror.h>
#include <tomboykeybinder.h>
#include "debug.h"
#include "tilda.h"
#include "callback_func.h"
#include "configsys.h"
#include "tilda_window.h"
#include "key_grabber.h" /* for pull */
#include "wizard.h"
#include "xerror.h"
#include "tomboykeybinder.h"

#include <sys/ioctl.h>
#include <sys/stat.h>
Expand All @@ -48,13 +48,9 @@

#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xrandr.h>

#include <vte/vte.h>
#include <glib/gstdio.h>
#include <zlib.h>


/**
* If lock->pid is 0 then the file is not opened exclusively. Instead flock() must be used to obtain a lock.
Expand Down
2 changes: 1 addition & 1 deletion src/tilda.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef TILDA_H
#define TILDA_H

#include <tilda_window.h>
#include "tilda_window.h"

#include <gtk/gtk.h>

Expand Down
15 changes: 7 additions & 8 deletions src/tilda_terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@

#include <tilda-config.h>

#include <debug.h>
#include <tilda.h>
#include <tilda_window.h>
#include <tilda_terminal.h>
#include <callback_func.h>
#include <configsys.h>
#include <wizard.h> /* wizard */
#include <gtk/gtk.h>
#include "debug.h"
#include "tilda.h"
#include "tilda_window.h"
#include "tilda_terminal.h"
#include "callback_func.h"
#include "configsys.h"
#include "wizard.h" /* wizard */

#include <stdio.h>
#include <stdlib.h> /* malloc */
Expand Down
2 changes: 1 addition & 1 deletion src/tilda_terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef TILDA_TERMINALN_H
#define TILDA_TERMINALN_H

#include <tilda_window.h>
#include "tilda_window.h"

#include <gtk/gtk.h>

Expand Down
14 changes: 7 additions & 7 deletions src/tilda_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

#include <tilda-config.h>

#include <debug.h>
#include <tilda.h>
#include <callback_func.h>
#include <configsys.h>
#include <tilda_window.h>
#include <tilda_terminal.h>
#include <key_grabber.h>
#include "debug.h"
#include "tilda.h"
#include "callback_func.h"
#include "configsys.h"
#include "tilda_window.h"
#include "tilda_terminal.h"
#include "key_grabber.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
4 changes: 2 additions & 2 deletions src/tilda_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#ifndef TILDA_WINDOW_H
#define TILDA_WINDOW_H

#include <tilda_window.h>
#include <tilda_terminal.h>
#include "tilda_window.h"
#include "tilda_terminal.h"

#include <glib.h>
#include <gtk/gtk.h>
Expand Down
12 changes: 6 additions & 6 deletions src/wizard.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#include <errno.h>

#include <debug.h>
#include <tilda.h>
#include <wizard.h>
#include <key_grabber.h>
#include <configsys.h>
#include <callback_func.h>
#include "debug.h"
#include "tilda.h"
#include "wizard.h"
#include "key_grabber.h"
#include "configsys.h"
#include "callback_func.h"

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
Expand Down
4 changes: 2 additions & 2 deletions src/wizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#ifndef WIZARD_H
#define WIZARD_H

#include <tilda_window.h>
#include <tilda_terminal.h>
#include "tilda_window.h"
#include "tilda_terminal.h"

#include <gtk/gtk.h>

Expand Down
4 changes: 2 additions & 2 deletions src/xerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#include <tilda-config.h>

#include <xerror.h>
#include <debug.h>
#include "xerror.h"
#include "debug.h"

#include <glib.h>
#include <glib/gi18n.h>
Expand Down

0 comments on commit d26e99c

Please sign in to comment.