# usplash-theme-debian - Makefile
#
# Copyright © 2006 - 2007 David Härdeman <david@hardeman.nu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

#Edited by Chad Albers <chad@neomantic.com> for usplash-theme-debian-swirl


# This is the list of sizes to build and include in the theme
# By convention, the sizes should go from smaller to larger
#sizes missing (at least) = 1024x600 1280x1024 1440x1050 1900x1200
sizes = 640x400 640x480 800x600 1024x768 1365x768_scaled 1600x1200


# This creates a list with entries like background_800x600.png...
backgrounds = $(addsuffix .png, $(addprefix usplash_, $(sizes)))
background_objs = $(backgrounds:.png=.o)
throbbers = throbber_fore.png throbber_fore_16.png throbber_back.png throbber_back_16.png
throbber_objs = $(throbbers:.png=.o)

CC=gcc
CFLAGS=-g -Wall -fPIC
LDFLAGS=
INCLUDES=
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS)

INSTALL      = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROG = $(INSTALL) -m 755

DESTDIR = /usr/lib/usplash

# Default = silent build
V =
ifeq ($(strip $(V)),)
E = @echo
Q = @
else
E = @\#
Q =
endif
export E Q

all: debian-theme.so
.PHONY: all
.DEFAULT: all

debian-theme.so: debian-theme.o $(background_objs) $(throbber_objs)
	$(E) "  LINK    " $@
	$(Q) $(COMPILE) -shared -o $@ $^
    
debian-theme.o: debian-theme.c
    
%.o: %.c
	$(E) "  CC      " $@
	$(Q) $(COMPILE) -o $@ -c $<
    
%.c: %.png
	$(E) "  PNGSRC  " $@
	$(Q) pngtousplash $< > $@

install:debian-theme.so
	$(E) "  INSTALL " $<
	$(Q) $(INSTALL_DATA) -D $< $(DESTDIR)/debian-theme.so 
.PHONY: install

install-strip: debian-theme.so
	$(MAKE) INSTALL='$(INSTALL) -s' install
.PHONY: install-strip

clean:
	$(E) "  CLEAN   "
	$(Q) - find . -type f -name '*.png.c' -print0 | xargs -0r rm -f
	$(Q) - find . -type f -name '*.o' -print0     | xargs -0r rm -f
	$(Q) - find . -type f -name '*.so' -print0    | xargs -0r rm -f
.PHONY: clean

