Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codebrainz/9ecb8b52c1b569c0ec0b82dfa0b0a270 to your computer and use it in GitHub Desktop.
Save codebrainz/9ecb8b52c1b569c0ec0b82dfa0b0a270 to your computer and use it in GitHub Desktop.
xfce4-notifyd build system (changes against 2476c93be821a5b2fe42ae5c656018dbb8b13bb2)
From cf2a87a156aeb14d09c4d04b4b8857185803d9d4 Mon Sep 17 00:00:00 2001
From: Matthew Brush <matt@xfce.org>
Date: Sun, 10 Dec 2017 19:09:54 -0800
Subject: [PATCH 1/2] Switch to using recursive make for build system
This makes it easier to grok what's going on since it puts related
rules into separate files and allows for cleaner path specifications.
As part of refactoring, various improvements where made to Autotools
practices. It now passes make distcheck and can be built out-of-tree.
There are a few TODO comments that should be addressed in the future.
---
.gitignore | 3 +
Makefile.am | 274 ++-------------------------------------
configure.ac.in | 6 +
icons/Makefile.am | 20 +++
tests/Makefile.am | 12 ++
themes/Makefile.am | 10 ++
xfce4-notifyd-config/Makefile.am | 44 +++++++
xfce4-notifyd/Makefile.am | 109 ++++++++++++++++
8 files changed, 217 insertions(+), 261 deletions(-)
create mode 100644 icons/Makefile.am
create mode 100644 tests/Makefile.am
create mode 100644 themes/Makefile.am
create mode 100644 xfce4-notifyd-config/Makefile.am
create mode 100644 xfce4-notifyd/Makefile.am
diff --git a/.gitignore b/.gitignore
index f042be0..e3c37bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ intltool-merge.in
intltool-update.in
libtool
ltmain.sh
+m4/
missing
mkinstalldirs
.deps
@@ -44,6 +45,8 @@ xfce4-notifyd/notify-dbus.h
xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service
xfce4-notifyd/xfce-notify-enum-types.c
xfce4-notifyd/xfce-notify-enum-types.h
+xfce4-notifyd/xfce-notify-gbus.c
+xfce4-notifyd/xfce-notify-gbus.h
xfce4-notifyd/xfce-notify-marshal.c
xfce4-notifyd/xfce-notify-marshal.h
xfce4-notifyd/xfce4-notifyd
diff --git a/Makefile.am b/Makefile.am
index 7456a0c..a7244e0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,248 +1,25 @@
SUBDIRS = \
- po
-
-dist_autogen = autogen.sh
-dist_misc = TODO
-dist_intltool = \
+ po \
+ xfce4-notifyd \
+ xfce4-notifyd-config \
+ icons \
+ tests \
+ themes
+
+ACLOCAL_AMFLAGS = -I m4
+
+EXTRA_DIST = \
+ autogen.sh \
+ TODO \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
-distclean_intltool = \
+DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update
-distuninstallcheck_listfiles = \
- find . -type f -print | grep -v ./share/icons/hicolor/icon-theme.cache
-
-xfce4_notifyddir = $(HELPER_PATH_PREFIX)/xfce4/notifyd
-xfce4_notifyd_PROGRAMS = xfce4-notifyd/xfce4-notifyd
-bin_PROGRAMS = xfce4-notifyd-config/xfce4-notifyd-config
-
-xfce4_notifyd_xfce4_notifyd_SOURCES = \
- xfce4-notifyd/main.c \
- xfce4-notifyd/xfce-notify-gbus.c \
- xfce4-notifyd/xfce-notify-gbus.h \
- xfce4-notifyd/xfce-notify-daemon.c \
- xfce4-notifyd/xfce-notify-daemon.h \
- xfce4-notifyd/xfce-notify-enum-types.c \
- xfce4-notifyd/xfce-notify-enum-types.h \
- xfce4-notifyd/xfce-notify-marshal.c \
- xfce4-notifyd/xfce-notify-marshal.h \
- xfce4-notifyd/xfce-notify-window.c \
- xfce4-notifyd/xfce-notify-window.h
-
-xfce4_notifyd_config_xfce4_notifyd_config_SOURCES = \
- xfce4-notifyd-config/main.c \
- xfce4-notifyd-config/xfce4-notifyd-config.ui.h
-
-common_cflags = \
- -I$(builddir) \
- -DLOCALEDIR=\"$(localedir)\" \
- $(LIBXFCE4UTIL_CFLAGS) \
- $(XFCONF_CFLAGS) \
- $(LIBXFCE4UI_CFLAGS) \
- $(GTK3_CFLAGS)
-
-xfce4_notifyd_xfce4_notifyd_CFLAGS = \
- -DG_LOG_DOMAIN=\"xfce4-notifyd\" \
- $(common_cflags) \
- $(LIBX11_CFLAGS) \
- $(GIO_CFLAGS) \
- $(GIO_UNIX_CFLAGS)
-
-
-xfce4_notifyd_config_xfce4_notifyd_config_CFLAGS = \
- -DG_LOG_DOMAIN=\"xfce4-notifyd-config\" \
- $(LIBNOTIFY_CFLAGS) \
- $(common_cflags)
-
-common_ldadd = \
- $(LIBXFCE4UTIL_LIBS) \
- $(XFCONF_LIBS) \
- $(LIBXFCE4UI_LIBS) \
- $(GTK3_LIBS)
-
-xfce4_notifyd_xfce4_notifyd_LDADD = \
- $(common_ldadd) \
- $(LIBX11_LIBS) \
- $(GIO_LIBS) \
- $(GIO_UNIX_LIBS)
-
-xfce4_notifyd_config_xfce4_notifyd_config_LDADD = \
- $(common_ldadd) \
- $(LIBNOTIFY_LIBS)
-
-
-servicedir = $(datadir)/dbus-1/services
-service_in_files = xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service.in
-service_DATA = $(service_in_files:.service.in=.service)
-
-dist_service = \
- $(service_in_files) \
- xfce4-notifyd/notify-dbus.xml \
- xfce4-notifyd/xfce-notify-marshal.list
-distclean_service = $(service_DATA)
-
-dist_man1_MANS = \
- xfce4-notifyd-config/xfce4-notifyd-config.1
-
-desktopdir = $(datadir)/applications
-desktop_in_files = xfce4-notifyd-config/xfce4-notifyd-config.desktop.in
-desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
-@INTLTOOL_DESKTOP_RULE@
-
-icon_dir = $(datadir)/icons/hicolor
-gtk_update_icon_cache = gtk-update-icon-cache -f -t $(icon_dir)
-
-icons48dir = $(icon_dir)/48x48/apps
-dist_icons48_DATA = icons/48x48/xfce4-notifyd.png
-
-theme_dir = $(datadir)/themes
-
-defaultthemedir = $(theme_dir)/Default/xfce-notify-4.0
-dist_defaulttheme_DATA = themes/Default/gtk.css
-
-smokethemedir = $(theme_dir)/Smoke/xfce-notify-4.0
-dist_smoketheme_DATA = themes/Smoke/gtk.css
-
-zomgponiesthemedir = $(theme_dir)/ZOMG-PONIES!/xfce-notify-4.0
-dist_zomgponiestheme_DATA = themes/ZOMG-PONIES!/gtk.css
-
-built_xfce4_notifyd = \
- xfce4-notifyd/xfce-notify-gbus.c \
- xfce4-notifyd/xfce-notify-gbus.h
-
-clean_xfce4_notifyd = \
- $(built_xfce4_notifyd)
-
-if MAINTAINER_MODE
-
-built_xfce4_notifyd += \
- xfce4-notifyd/xfce-notify-marshal.c \
- xfce4-notifyd/xfce-notify-marshal.h \
- xfce4-notifyd/xfce-notify-enum-types.c \
- xfce4-notifyd/xfce-notify-enum-types.h
-
-built_xfce4_notifyd_config = \
- xfce4-notifyd-config/xfce4-notifyd-config.ui.h
-
-clean_xfce4_notifyd += \
- xfce4-notifyd/stamp-xfce-notify-enum-types.h \
- xfce4-notifyd/stamp-xfce-notify-marshal.h
-
-endif
-
-clean_xfce4_notifyd_config = \
- $(built_xfce4_notifyd_config) \
- $(desktop_DATA)
-
-dist_xfce4_notifyd_config = \
- xfce4-notifyd-config/xfce4-notifyd-config.glade \
- $(desktop_in_files)
-
-dist_noinst_DATA = \
- $(dist_misc) \
- $(dist_intltool) \
- $(dist_service) \
- $(dist_xfce4_notifyd_config)
-
-dist_noinst_SCRIPTS = \
- $(dist_autogen)
-
-BUILT_SOURCES = \
- $(built_xfce4_notifyd) \
- $(built_xfce4_notifyd_config)
-
-CLEANFILES = \
- $(clean_xfce4_notifyd) \
- $(clean_xfce4_notifyd_config)
-
-DISTCLEANFILES = \
- $(distclean_intltool) \
- $(distclean_service)
-
-xfce4-notifyd/xfce-notify-gbus.h:
-xfce4-notifyd/xfce-notify-gbus.c: $(srcdir)/xfce4-notifyd/notify-dbus.xml Makefile
- $(AM_V_GEN) $(GDBUS_CODEGEN) \
- --interface-prefix org.freedesktop.Notifications \
- --c-namespace XfceNotify \
- --generate-c-code xfce4-notifyd/xfce-notify-gbus \
- $(srcdir)/xfce4-notifyd/notify-dbus.xml
-
-if MAINTAINER_MODE
-
-xfce4-notifyd/xfce-notify-marshal.h: xfce4-notifyd/stamp-xfce-notify-marshal.h
- @true
-
-xfce4-notifyd/stamp-xfce-notify-marshal.h: $(srcdir)/xfce4-notifyd/xfce-notify-marshal.list Makefile
- $(AM_V_GEN) ( \
- echo '/* this file is autogenerated -- do not edit */' > xfce4-notifyd/xfce-notify-marshal.h \
- && glib-genmarshal --prefix=xfce_notify_marshal --header $(srcdir)/xfce4-notifyd/xfce-notify-marshal.list \
- >> xfce4-notifyd/xfce-notify-marshal.h \
- && echo timestamp >$@ )
-
-xfce4-notifyd/xfce-notify-marshal.c: $(srcdir)/xfce4-notifyd/xfce-notify-marshal.list Makefile
- $(AM_V_GEN) ( \
- echo '/* this file is autogenerated -- do not edit */' >$@ \
- && echo '#include "xfce-notify-marshal.h"' >$@ \
- && glib-genmarshal --prefix=xfce_notify_marshal --body $(srcdir)/xfce4-notifyd/xfce-notify-marshal.list >>$@ \
- )
-
-xfce4-notifyd/xfce-notify-enum-types.h: $(srcdir)/xfce4-notifyd/stamp-xfce-notify-enum-types.h
- @true
-
-xfce4-notifyd/stamp-xfce-notify-enum-types.h: $(srcdir)/xfce4-notifyd/xfce-notify-window.h Makefile
- $(AM_V_GEN) ( \
- ( cd $(srcdir) && glib-mkenums \
- --fhead "#ifndef __XFCE_NOTIFY_ENUM_TYPES_H__\n#define __XFCE_NOTIFY_ENUM_TYPES_H__\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name@_get_type(void) G_GNUC_CONST;\n#define XFCE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
- --ftail "G_END_DECLS\n\n#endif /* __XFCE_NOTIFY_ENUM_TYPES_H__ */" \
- $(srcdir)/xfce4-notifyd/xfce-notify-window.h ) >> xfce4-notifyd/xgen-xneth \
- && ( cmp -s xfce4-notifyd/xgen-xneth xfce4-notifyd/xfce-notify-enum-types.h || cp xfce4-notifyd/xgen-xneth xfce4-notifyd/xfce-notify-enum-types.h ) \
- && rm -f xfce4-notifyd/xgen-xneth \
- && echo timestamp >$@ \
- )
-
-xfce4-notifyd/xfce-notify-enum-types.c: $(srcdir)/xfce4-notifyd/xfce-notify-window.h Makefile
- $(AM_V_GEN) ( \
- ( cd $(srcdir) && glib-mkenums \
- --fhead "#include \"xfce-notify-enum-types.h\"\n#include \"xfce4-notifyd/xfce-notify-window.h\"\n" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n@enum_name@_get_type(void)\n{\n\tstatic GType type = 0;\n\tif(type == 0) {\n\tstatic const G@Type@Value values[] = {"\
- --vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static(\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
- $(srcdir)/xfce4-notifyd/xfce-notify-window.h ) >> xfce4-notifyd/xgen-xnetc \
- && cp xfce4-notifyd/xgen-xnetc xfce4-notifyd/xfce-notify-enum-types.c \
- && rm -f xfce4-notifyd/xgen-xnetc \
- )
-
-xfce4-notifyd-config/xfce4-notifyd-config.ui.h: $(srcdir)/xfce4-notifyd-config/xfce4-notifyd-config.glade
- $(AM_V_GEN) ( \
- $(EXO_CSOURCE) --static --name=xfce4_notifyd_config_ui $< >$@ \
- )
-
-endif
-
-install-data-hook:
- @-if test -z "$(DESTDIR)"; then \
- echo "Updating Gtk icon cache."; \
- $(gtk_update_icon_cache); \
- else \
- echo "*** Icon cache not updated. Remember to run:"; \
- echo "***"; \
- echo "*** $(gtk_update_icon_cache)"; \
- echo "***"; \
- fi
-
-xfce4-notifyd/%.service: $(srcdir)/xfce4-notifyd/%.service.in Makefile
- sed -e "s,\@notifydir\@,$(xfce4_notifyddir),g" < $< > $@
-
-distclean-local:
- -rm -rf *.cache *~
-
checksums: distcheck
sha1sum $(PACKAGE)-$(VERSION).tar.bz2 > $(PACKAGE)-$(VERSION).tar.bz2.sha1.asc
@@ -262,28 +39,3 @@ ChangeLog: Makefile
|| (touch ChangeLog; echo 'Git directory not found: installing possibly empty changelog.' >&2)
dist-hook: ChangeLog
-
-#Tests
-noinst_PROGRAMS = \
- tests/test-text \
- tests/test-positioning \
- tests/test-actions
-
-tests_cflags = \
- -I$(top_srcdir) \
- $(LIBNOTIFY_CFLAGS)
-
-tests_ldadd = \
- $(LIBNOTIFY_LIBS)
-
-tests_test_actions_SOURCES = tests/test-actions.c
-tests_test_actions_CFLAGS = $(tests_cflags)
-tests_test_actions_LDADD = $(tests_ldadd)
-
-tests_test_positioning_SOURCES = tests/test-positioning.c
-tests_test_positioning_CFLAGS = $(tests_cflags)
-tests_test_positioning_LDADD = $(tests_ldadd)
-
-tests_test_text_SOURCES = tests/test-text.c
-tests_test_text_CFLAGS = $(tests_cflags)
-tests_test_text_LDADD = $(tests_ldadd)
diff --git a/configure.ac.in b/configure.ac.in
index 59f66a9..3c16027 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -20,6 +20,7 @@ AC_INIT([xfce4-notifyd], [xfce4_notifyd_version],
[http://bugzilla.xfce.org/enter_bug.cgi?product=Xfce4-notifyd],
[xfce4-notifyd])
AC_PREREQ([2.59c])
+AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_SRCDIR([xfce4-notifyd/main.c])
AC_CONFIG_HEADERS([config.h])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -129,4 +130,9 @@ AC_OUTPUT(
[
Makefile
po/Makefile.in
+ icons/Makefile
+ tests/Makefile
+ themes/Makefile
+ xfce4-notifyd-config/Makefile
+ xfce4-notifyd/Makefile
])
diff --git a/icons/Makefile.am b/icons/Makefile.am
new file mode 100644
index 0000000..e4903be
--- /dev/null
+++ b/icons/Makefile.am
@@ -0,0 +1,20 @@
+icon_dir = $(datadir)/icons/hicolor
+
+icons48dir = $(icon_dir)/48x48/apps
+dist_icons48_DATA = 48x48/xfce4-notifyd.png
+
+gtk_update_icon_cache = gtk-update-icon-cache -f -t $(icon_dir)
+
+install-data-hook: update-icon-cache
+uninstall-hook: update-icon-cache
+
+update-icon-cache:
+ @-if test -z "$(DESTDIR)"; then \
+ echo "Updating Gtk icon cache."; \
+ $(gtk_update_icon_cache); \
+ else \
+ echo "*** Icon cache not updated. Remember to run:"; \
+ echo "***"; \
+ echo "*** $(gtk_update_icon_cache)"; \
+ echo "***"; \
+ fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..7688115
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,12 @@
+AM_CPPFLAGS = -I$(top_srcdir)
+AM_CFLAGS = $(LIBNOTIFY_CFLAGS)
+AM_LDFLAGS = $(LIBNOTIFY_LIBS)
+
+noinst_PROGRAMS = \
+ test-text \
+ test-positioning \
+ test-actions
+
+test_actions_SOURCES = test-actions.c
+test_positioning_SOURCES = test-positioning.c
+test_text_SOURCES = test-text.c
diff --git a/themes/Makefile.am b/themes/Makefile.am
new file mode 100644
index 0000000..d2549eb
--- /dev/null
+++ b/themes/Makefile.am
@@ -0,0 +1,10 @@
+theme_dir = $(datadir)/themes
+
+defaultthemedir = $(theme_dir)/Default/xfce-notify-4.0
+dist_defaulttheme_DATA = Default/gtk.css
+
+smokethemedir = $(theme_dir)/Smoke/xfce-notify-4.0
+dist_smoketheme_DATA = Smoke/gtk.css
+
+zomgponiesthemedir = $(theme_dir)/ZOMG-PONIES!/xfce-notify-4.0
+dist_zomgponiestheme_DATA = ZOMG-PONIES!/gtk.css
diff --git a/xfce4-notifyd-config/Makefile.am b/xfce4-notifyd-config/Makefile.am
new file mode 100644
index 0000000..f03e0fc
--- /dev/null
+++ b/xfce4-notifyd-config/Makefile.am
@@ -0,0 +1,44 @@
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DG_LOG_DOMAIN=\"xfce4-notifyd-config\"
+
+AM_CFLAGS = \
+ $(GTK3_CFLAGS) \
+ $(LIBNOTIFY_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(XFCONF_CFLAGS)
+
+AM_LDFLAGS = \
+ $(GTK3_LIBS) \
+ $(LIBNOTIFY_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
+ $(LIBXFCE4UTIL_LIBS) \
+ $(XFCONF_LIBS)
+
+bin_PROGRAMS = xfce4-notifyd-config
+
+xfce4_notifyd_config_SOURCES = main.c xfce4-notifyd-config.ui.h
+
+dist_man1_MANS = xfce4-notifyd-config.1
+
+desktopdir = $(datadir)/applications
+desktop_in_files = xfce4-notifyd-config.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+@INTLTOOL_DESKTOP_RULE@
+
+CLEANFILES = $(desktop_DATA)
+EXTRA_DIST = xfce4-notifyd-config.glade $(desktop_in_files)
+
+if MAINTAINER_MODE
+
+BUILT_SOURCES = xfce4-notifyd-config.ui.h
+CLEANFILES += $(BUILT_SOURCES)
+
+$(srcdir)/xfce4-notifyd-config.ui.h: $(srcdir)/xfce4-notifyd-config.glade
+ $(AM_V_GEN)$(EXO_CSOURCE) --static --name=xfce4_notifyd_config_ui \
+ $(srcdir)/xfce4-notifyd-config.glade > $@
+
+endif
+
diff --git a/xfce4-notifyd/Makefile.am b/xfce4-notifyd/Makefile.am
new file mode 100644
index 0000000..3537c71
--- /dev/null
+++ b/xfce4-notifyd/Makefile.am
@@ -0,0 +1,109 @@
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DG_LOG_DOMAIN=\"xfce4-notifyd\"
+
+AM_CFLAGS = \
+ $(GIO_CFLAGS) \
+ $(GIO_UNIX_CFLAGS) \
+ $(GTK3_CFLAGS) \
+ $(LIBX11_CFLAGS) \
+ $(LIBXFCE4UI_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(XFCONF_CFLAGS)
+
+AM_LDFLAGS = \
+ $(GIO_LIBS) \
+ $(GIO_UNIX_LIBS) \
+ $(GTK3_LIBS) \
+ $(LIBX11_LIBS) \
+ $(LIBXFCE4UI_LIBS) \
+ $(LIBXFCE4UTIL_LIBS) \
+ $(XFCONF_LIBS)
+
+xfce4_notifyddir = $(HELPER_PATH_PREFIX)/xfce4/notifyd
+xfce4_notifyd_PROGRAMS = xfce4-notifyd
+
+xfce4_notifyd_SOURCES = \
+ main.c \
+ xfce-notify-gbus.c \
+ xfce-notify-gbus.h \
+ xfce-notify-daemon.c \
+ xfce-notify-daemon.h \
+ xfce-notify-enum-types.c \
+ xfce-notify-enum-types.h \
+ xfce-notify-marshal.c \
+ xfce-notify-marshal.h \
+ xfce-notify-window.c \
+ xfce-notify-window.h
+
+servicedir = $(datadir)/dbus-1/services
+service_in_files = org.xfce.xfce4-notifyd.Notifications.service.in
+service_DATA = $(service_in_files:.service.in=.service)
+
+# TODO: check what this does and see if autoconf can do it
+# TODO: autoreconf warns that this is not portable
+%.service: $(srcdir)/%.service.in Makefile
+ sed -e "s,\@notifydir\@,$(xfce4_notifyddir),g" < $< > $@
+
+# TODO: shouldn't this be inside `if MAINTAINER_MODE`?
+xfce-notify-gbus.c: $(srcdir)/notify-dbus.xml
+ $(AM_V_GEN)$(GDBUS_CODEGEN) \
+ --interface-prefix org.freedesktop.Notifications \
+ --c-namespace XfceNotify \
+ --generate-c-code $(builddir)/xfce-notify-gbus \
+ $(srcdir)/notify-dbus.xml
+
+xfce-notify-gbus.h: xfce-notify-gbus.c
+
+EXTRA_DIST = \
+ $(service_in_files) \
+ notify-dbus.xml \
+ xfce-notify-marshal.list
+
+BUILT_SOURCES = \
+ xfce-notify-gbus.c \
+ xfce-notify-gbus.h
+
+if MAINTAINER_MODE
+
+BUILT_SOURCES += \
+ xfce-notify-marshal.c \
+ xfce-notify-marshal.h \
+ xfce-notify-enum-types.c \
+ xfce-notify-enum-types.h
+
+# TODO: should use autoconf to check for glib-genmarshal/glib-mkenums
+
+$(srcdir)/xfce-notify-marshal.h: $(srcdir)/xfce-notify-marshal.list
+ $(AM_V_GEN)glib-genmarshal --prefix=xfce_notify_marshal --header \
+ $(srcdir)/xfce-notify-marshal.list > $@
+
+$(srcdir)/xfce-notify-marshal.c: $(srcdir)/xfce-notify-marshal.list
+ $(AM_V_GEN)glib-genmarshal --prefix=xfce_notify_marshal --body \
+ $(srcdir)/xfce-notify-marshal.list > $@
+
+enum_headers = $(srcdir)/xfce-notify-window.h
+
+$(srcdir)/xfce-notify-enum-types.h: $(enum_headers)
+ $(AM_V_GEN)glib-mkenums \
+ --fhead "#ifndef __XFCE_NOTIFY_ENUM_TYPES_H__\n#define __XFCE_NOTIFY_ENUM_TYPES_H__\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
+ --fprod "/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name@_get_type(void) G_GNUC_CONST;\n#define XFCE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* __XFCE_NOTIFY_ENUM_TYPES_H__ */" \
+ $(enum_headers) > $@
+
+$(srcdir)/xfce-notify-enum-types.c: $(enum_headers)
+ $(AM_V_GEN)glib-mkenums \
+ --fhead "#include \"xfce-notify-enum-types.h\"\n#include \"xfce4-notifyd/xfce-notify-window.h\"\n" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type(void)\n{\n\tstatic GType type = 0;\n\tif(type == 0) {\n\tstatic const G@Type@Value values[] = {"\
+ --vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static(\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
+ $(enum_headers) > $@
+
+endif
+
+
+CLEANFILES = $(BUILT_SOURCES) $(service_DATA)
--
2.14.1
From 12f0486277de9347d33e8d0160884885cc297c62 Mon Sep 17 00:00:00 2001
From: Matthew Brush <matt@xfce.org>
Date: Sun, 10 Dec 2017 19:42:13 -0800
Subject: [PATCH 2/2] Use template files for glib-mkenums
This makes the make files cleaner and easier to maintain the
templates compared to hardcoded into arguments.
---
xfce4-notifyd/Makefile.am | 20 +++++++-------------
xfce4-notifyd/xfce-notify-enum-types.c.tmpl | 29 +++++++++++++++++++++++++++++
xfce4-notifyd/xfce-notify-enum-types.h.tmpl | 26 ++++++++++++++++++++++++++
3 files changed, 62 insertions(+), 13 deletions(-)
create mode 100644 xfce4-notifyd/xfce-notify-enum-types.c.tmpl
create mode 100644 xfce4-notifyd/xfce-notify-enum-types.h.tmpl
diff --git a/xfce4-notifyd/Makefile.am b/xfce4-notifyd/Makefile.am
index 3537c71..99a98c4 100644
--- a/xfce4-notifyd/Makefile.am
+++ b/xfce4-notifyd/Makefile.am
@@ -60,7 +60,9 @@ xfce-notify-gbus.h: xfce-notify-gbus.c
EXTRA_DIST = \
$(service_in_files) \
notify-dbus.xml \
- xfce-notify-marshal.list
+ xfce-notify-marshal.list \
+ xfce-notify-enum-types.c.tmpl \
+ xfce-notify-enum-types.h.tmpl
BUILT_SOURCES = \
xfce-notify-gbus.c \
@@ -86,24 +88,16 @@ $(srcdir)/xfce-notify-marshal.c: $(srcdir)/xfce-notify-marshal.list
enum_headers = $(srcdir)/xfce-notify-window.h
-$(srcdir)/xfce-notify-enum-types.h: $(enum_headers)
+$(srcdir)/xfce-notify-enum-types.h: $(enum_headers) $(srcdir)/xfce-notify-enum-types.h.tmpl
$(AM_V_GEN)glib-mkenums \
- --fhead "#ifndef __XFCE_NOTIFY_ENUM_TYPES_H__\n#define __XFCE_NOTIFY_ENUM_TYPES_H__\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name@_get_type(void) G_GNUC_CONST;\n#define XFCE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
- --ftail "G_END_DECLS\n\n#endif /* __XFCE_NOTIFY_ENUM_TYPES_H__ */" \
+ --template $(srcdir)/xfce-notify-enum-types.h.tmpl \
$(enum_headers) > $@
-$(srcdir)/xfce-notify-enum-types.c: $(enum_headers)
+$(srcdir)/xfce-notify-enum-types.c: $(enum_headers) $(srcdir)/xfce-notify-enum-types.c.tmpl
$(AM_V_GEN)glib-mkenums \
- --fhead "#include \"xfce-notify-enum-types.h\"\n#include \"xfce4-notifyd/xfce-notify-window.h\"\n" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n@enum_name@_get_type(void)\n{\n\tstatic GType type = 0;\n\tif(type == 0) {\n\tstatic const G@Type@Value values[] = {"\
- --vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static(\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
+ --template $(srcdir)/xfce-notify-enum-types.c.tmpl \
$(enum_headers) > $@
endif
-
CLEANFILES = $(BUILT_SOURCES) $(service_DATA)
diff --git a/xfce4-notifyd/xfce-notify-enum-types.c.tmpl b/xfce4-notifyd/xfce-notify-enum-types.c.tmpl
new file mode 100644
index 0000000..aeb8de5
--- /dev/null
+++ b/xfce4-notifyd/xfce-notify-enum-types.c.tmpl
@@ -0,0 +1,29 @@
+/* This file is autogenerated -- do not edit */
+/*** BEGIN file-header ***/
+#include "xfce-notify-enum-types.h"
+#include "xfce-notify-window.h"
+/*** END file-header ***/
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type(void)
+{
+ static GType type = 0;
+ if(type == 0) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ type = g_@type@_register_static("@EnumName@", values);
+ }
+ return type;
+}
+/*** END value-tail ***/
diff --git a/xfce4-notifyd/xfce-notify-enum-types.h.tmpl b/xfce4-notifyd/xfce-notify-enum-types.h.tmpl
new file mode 100644
index 0000000..4e6eb69
--- /dev/null
+++ b/xfce4-notifyd/xfce-notify-enum-types.h.tmpl
@@ -0,0 +1,26 @@
+/*** BEGIN file-header ***/
+/* This file is autogenerated -- do not edit */
+#ifndef __XFCE_NOTIFY_ENUM_TYPES_H__
+#define __XFCE_NOTIFY_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+#define XFCE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+GType @enum_name@_get_type(void) G_GNUC_CONST;
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+
+#endif /* __XFCE_NOTIFY_ENUM_TYPES_H__ */
+/*** END file-tail ***/
--
2.14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment