
SUFFIXES += .png 
CLEANFILES += $(patsubst %.png,%.h, $(filter %.png, $(SOURCES))) 
CLEANFILES += $(patsubst %.png,%.cc, $(filter %.png, $(SOURCES))) 

BUILT_SOURCES += $(patsubst %.png, %.cc, $(filter %.png, $(SOURCES)))

#.png.cc:
#	convert $< $*.xpm
#	$(SED) -e "s,char \*$(notdir $*),const char * s_icon_$(subst /,_,$*)," < $*.xpm > $*.cc


AM_V_PNG = $(am__v_PNG_$(V))
am__v_PNG_ = $(am__v_PNG_$(AM_DEFAULT_VERBOSITY))
am__v_PNG_0 = @echo "  PNG   " $@; 
am__v_PNG_1 = @echo "compile $< to $*.cc and $*.h ";

.png.cc:
	$(AM_V_PNG)
	@echo > $*.cc
	@echo "#include <Nice/Property/Types.h>" >> $*.cc
	@echo "namespace $(firstword $(subst /, ,$(dir $*))) {" >> $*.cc
	@echo " Nice::SeqU8 createIcon_$(notdir $*)() {" >> $*.cc
	@echo "  static const char icon[]={" >> $*.cc
	@$(top_srcdir)/config/hexdump.pl $< >>$*.cc
	@echo "  };" >> $*.cc
	@echo "  return Nice::SeqU8(icon, icon + sizeof(icon));" >> $*.cc
	@echo " };">> $*.cc
	@echo "};">> $*.cc
	@echo >> $*.cc
	@echo > $*.h
	@echo "#ifndef $(subst /,_,$*)_h" >> $*.h
	@echo "#define $(subst /,_,$*)_h" >> $*.h
	@echo >> $*.h
	@echo "#include <Nice/Property/Types.h>" >> $*.h
	@echo "namespace $(firstword $(subst /, ,$(dir $*))) {" >> $*.h
	@echo "Nice::SeqU8 createIcon_$(notdir $*)();" >> $*.h
	@echo "};">> $*.h
	@echo >> $*.h
	@echo "#endif">> $*.h


SUFFIXES += .jpg 
CLEANFILES += $(patsubst %.jpg,%.h, $(filter %.jpg, $(SOURCES))) 
CLEANFILES += $(patsubst %.jpg,%.cc, $(filter %.jpg, $(SOURCES))) 

.jpg.cc:
	convert $< $*.h
	echo "#include <$*.h>" > $*.cc
	$(SED) -e "s,MagickImage,s_icon_$(subst /,_,$*)," < $*.h >> $*.cc


#all-local-image:

#clean-local-image:

install-data-hook-image:

uninstall-hook-image:
