SPHERICAL_COW_DIR=$(DESTDIR)/usr/share/backgrounds/spherical-cow
GNOME_BG_DIR=$(DESTDIR)/usr/share/gnome-background-properties
KDE_BG_DIR=$(DESTDIR)/usr/share/wallpapers/
XFCE_BG_DIR=$(DESTDIR)/usr/share/xfce4/backdrops
MKDIR=/bin/mkdir -p
INSTALL=/usr/bin/install -p -m644 -D
LN_S=/bin/ln -s
THEMES=calluna \
	   calm \
	   caminhos \
	   churi \
	   giza-at-my-roof \
	   lighthouse-cork \
	   lioran \
	   lonely-tree \
	   luminaire \
	   patagonia-cleide \
	   pink-flower \
	   schmetterling \
	   tiger-turtle \
	   trama-calda \
	   vienna-nights

all:

install:
	$(MKDIR) $(SPHERICAL_COW_DIR)/extras
	$(MKDIR) $(GNOME_BG_DIR)
	$(MKDIR) $(XFCE_BG_DIR)
	$(INSTALL) spherical-cow-extras.xml 			$(SPHERICAL_COW_DIR)/extras/spherical-cow-extras.xml
	$(INSTALL) desktop-backgrounds-spherical-cow-extras.xml $(GNOME_BG_DIR)/desktop-backgrounds-spherical-cow-extras.xml
	for theme in $(THEMES) ; do \
	  $(INSTALL) $${theme}.jpg $(SPHERICAL_COW_DIR)/extras/$${theme}.jpg ;\
	  $(MKDIR) $(KDE_BG_DIR)/Spherical_Cow_$${theme}/contents/images ;\
	  $(INSTALL) $${theme}.desktop $(KDE_BG_DIR)/Spherical_Cow_$${theme}/metadata.desktop ; \
	  for res in 1280x1024 \
		     640x480 800x600 1024x768 1152x864 1200x900 1280x960 1280x1024 1440x1080 1600x1200 1600x1280 1920x1440 2048x1536 \
		     800x480 1024x600 1152x720 1280x720 1280x768 1280x800 1366x768 1440x900 1680x1050 1920x1080 1920x1200 ; do \
	    $(LN_S) ../../../../backgrounds/spherical-cow/extras/$${theme}.jpg \
	            $(KDE_BG_DIR)/Spherical_Cow_$${theme}/contents/images/$${res}.jpg ; \
	  done; \
	  $(LN_S) ../../backgrounds/spherical-cow/extras/$${theme}.jpg \
			$(XFCE_BG_DIR)/spherical-cow-$${theme}.jpg ;\
	done;

