chiark / gitweb /
disobedience now embeds image files
[disorder] / disobedience / Makefile.am
index 9b18ca99e7b68e6a7e534e255fb20d07ecde1ce7..99abd7fad7671a7d2919d5a8a2bf8f6a73d26717 100644 (file)
@@ -22,6 +22,7 @@ bin_PROGRAMS=disobedience
 
 AM_CPPFLAGS=-I${top_srcdir}/lib -I../lib
 AM_CFLAGS=$(GLIB_CFLAGS) $(GTK_CFLAGS)
+PNGS:=$(wildcard ${top_srcdir}/images/*.png)
 
 disobedience_SOURCES=disobedience.h disobedience.c client.c queue.c    \
                  choose.c misc.c style.h control.c properties.c menu.c \
@@ -53,6 +54,22 @@ manual.h: manual.html ${top_srcdir}/scripts/text2c
        ${top_srcdir}/scripts/text2c manual manual.html > $@.tmp
        mv $@.tmp $@
 
+misc.o: images.h
+
+images.h: $(PNGS)
+       exec > @$.new;                                                  \
+       for png in $(PNGS); do                                          \
+         name=`echo $$png | sed 's,.*/,,;s,\.png,,;'`;                 \
+         gdk-pixbuf-csource --raw --name=image_$$name $$png;           \
+       done;                                                           \
+       echo "static const struct image images[] = {";                  \
+       for png in $(PNGS); do                                          \
+         name=`echo $$png | sed 's,.*/,,;s,\.png,,;'`;                 \
+         echo "  { \"$$name.png\", image_$$name },";                   \
+       done;                                                           \
+       echo "};"
+       mv @$.new $@
+
 EXTRA_DIST=disobedience.rc
 
 # check everything has working --help