diff Makefile @ 10:adba37525ee5

Notify about required session or system restarts Follow all PackageKit transactions and indicate when a session or system restart is required. Generate enum types with glib-mkenums.
author Guido Berhoerster <guido+pui@berhoerster.name>
date Fri, 06 Jul 2018 14:12:46 +0200
parents 2477a6151087
children 329aeecdd83a
line wrap: on
line diff
--- a/Makefile	Wed Jul 04 17:08:47 2018 +0200
+++ b/Makefile	Fri Jul 06 14:12:46 2018 +0200
@@ -50,6 +50,7 @@
 SED :=		sed
 GLIB_COMPILE_SCHEMAS := $(shell pkg-config --variable=glib_compile_schemas gio-2.0)
 GLIB_COMPILE_RESOURCES := $(shell pkg-config --variable=glib_compile_resources gio-2.0)
+GLIB_MKENUMS :=	$(shell pkg-config --variable=glib_mkenums glib-2.0)
 XSLTPROC :=	xsltproc
 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
@@ -113,6 +114,14 @@
 
 OBJS = $($(PACKAGE)_OBJS) $($(PACKAGE)-prefs_OBJS)
 
+ENUM_DEPS =	pui-backend.h \
+		pui-application.h
+
+ENUM_HEADER =	pui-types.h
+
+ENUM_FILES =	$(ENUM_HEADER) \
+		pui-types.c
+
 GSETTINGS_SCHEMAS = $(APPLICATION_ID).gschema.xml
 
 GRESOURCE_FILES = pui-prefs.gresource.xml
@@ -176,6 +185,14 @@
 $(PACKAGE)-prefs: $($(PACKAGE)-prefs_OBJS)
 	$(LINK.o) $^ $(LDLIBS) -o $@
 
+$(OBJS): $(ENUM_HEADER)
+
+%-types.h: %-types.h.in $(ENUM_DEPS)
+	$(GLIB_MKENUMS) --template $< >$@ $(filter-out $<,$^)
+
+%-types.c: %-types.c.in $(ENUM_DEPS)
+	$(GLIB_MKENUMS) --template $< >$@ $(filter-out $<,$^)
+
 %-resources.c: %.gresource.xml
 	$(GLIB_COMPILE_RESOURCES) --generate-dependencies $< | \
 	    while read -r resource_file; do \
@@ -231,8 +248,8 @@
 	done
 
 clean:
-	rm -f $(PACKAGE) $(OBJS) $(AUTOSTART_FILE) $(DESKTOP_FILES) $(POTFILE) \
-	    $(MOFILES) $(MANPAGES)
+	rm -f $(PACKAGE) $(OBJS) $(ENUM_FILES) $(AUTOSTART_FILE) \
+	    $(DESKTOP_FILES) $(POTFILE) $(MOFILES) $(MANPAGES)
 
 clobber: clean
 	rm -f $(patsubst %.o,%.d,$(OBJS))