# Makefile

#-- Configuration
# Edit the entries below for your system:
# In most cases you don't have to

#Use these for FreeBSD:
#GTK-CONFIG	= gtk12-config
#FONTDIR	= /usr/lib/X11/fonts/local

# Works on my Red Hat Linux system:
GTK-CONFIG	= gtk-config
PREFIX		= `$(GTK-CONFIG) --prefix`
FONTDIR		= /usr/lib/X11/fonts/misc

CC		= gcc -pipe
CFLAGS		= -O2 -fomit-frame-pointer `$(GTK-CONFIG) --cflags` -DG_DISABLE_CHECKS
#CFLAGS		= `$(GTK-CONFIG) --cflags`
LIBS		= `$(GTK-CONFIG) --libs`


#-- End of Configuration --

#-- Compiler flags ---------------------------------
MAJOR		= 0
MINOR		= 7
VERSION		= $(MAJOR).$(MINOR)

COMPILE		= $(CC) $(CFLAGS)  -c
LINK		= $(CC) $(LIBS)

LIB_PATH	= $(PREFIX)/lib/gtk/themes/engines
DATA_PATH	= $(PREFIX)/share/themes

OBJECTS		= xeno_theme_main.o xeno_theme_rc.o xeno_theme_style.o xeno_theme_draw.o \
		  xeno_theme_color.o xeno_theme_images.o xeno_theme_patches.o

SONAME		= libxeno.so.$(VERSION)
SHORTNAME	= libxeno.so.$(MAJOR)
TINYNAME	= libxeno.so

#-- Targets ----------------------------------------
$(SONAME):	$(OBJECTS)
		$(LINK) $(GTKLIBS) $(OBJECTS) -shared -Wl,-soname,$(SHORTNAME) -o $(SONAME)

install-libs:	$(SONAME)
		install -d $(LIB_PATH)
		chmod 755 $(SONAME)
		cp -fdp $(SONAME) $(LIB_PATH)
		ln -fs $(SONAME) $(LIB_PATH)/$(SHORTNAME)
		ln -fs $(SONAME) $(LIB_PATH)/$(TINYNAME)

install-data:
		cp -fdpR themes/Xenophilia $(DATA_PATH)
		cp -fdpR "themes/Xeno Thin" $(DATA_PATH)
		cp -fdpR "themes/Xeno Gradient" $(DATA_PATH)
		cp -fdpR "themes/Xeno Helix" $(DATA_PATH)
		cp -fdpR "themes/Xeno Buffed" $(DATA_PATH)
		ln -fs ../Xenophilia/README.html "$(DATA_PATH)/Xeno Thin/README.html"

install-fonts:
		cp -fdp fonts/infernal-120.pcf.gz $(FONTDIR)/infernal-120.pcf.gz
		cp -fdp fonts/infernal-bold-120.pcf.gz $(FONTDIR)/infernal-bold-120.pcf.gz
		mkfontdir $(FONTDIR)
		xset fp rehash

install:	install-libs install-data

uninstall:
		rm -f $(LIB_PATH)/libxeno.so*
		rm -rf $(DATA_PATH)/Xenophilia
		rm -rf $(DATA_PATH)/XenoThin

test:
		$(PREFIX)/bin/testgtk

strip:		$(SONAME)
		strip $(SONAME)

gradients:
		mkdir -p pixmaps
		./mkgradient.py button_xpm 1 30 c7c5c3 959391 > pixmaps/button.xpm
		./mkgradient.py vslider_xpm 15 1 c7c5c3 959391 > pixmaps/vslider.xpm
		./mkgradient.py hslider_xpm 1 15 c7c5c3 959391 > pixmaps/hslider.xpm
		./mkgradient.py vslider_xpm 19 1 4d4b49 979593  > pixmaps/vslidera.xpm
		./mkgradient.py hslider_xpm 1 19 4d4b49 979593  > pixmaps/hslidera.xpm

noobjs:
		rm -f $(OBJECTS) core *~

clean:		noobjs
		rm -f *.so*

dist:		clean
		lynx -dump themes/Xenophilia/README.html > CONFIGURATION
		mv Xenophilia.??? ..
		mv themes/XenoThemes.??? ..

undist:
		mv ../XenoThemes.??? themes/
		mv ../XenoCode.??? .

# quick and dirty way of installing without having to be root
minstall:	$(SONAME)
		su -c "cp $(SONAME) $(LIB_PATH)"

minstall-strip:	strip minstall

minstall-2.0:	strip
		su -c "cp $(SONAME) $(PREFIX)/lib/gtk-2.0/1.3.2/engines/"

# objects
xeno_theme_main.o:	xeno_theme_main.c xeno_theme_main.h xeno_theme_rc.h xeno_theme_enums.h xeno_theme_style.h
			$(COMPILE) xeno_theme_main.c

xeno_theme_rc.o:	xeno_theme_rc.c xeno_theme_rc.h xeno_theme_main.h xeno_theme_style.h xeno_theme_enums.h
			$(COMPILE) xeno_theme_rc.c

xeno_theme_style.o:	xeno_theme_style.c xeno_theme_style.h xeno_theme_rc.h xeno_theme_main.h xeno_theme_enums.h xeno_theme_draw.h xeno_theme_color.h
			$(COMPILE) xeno_theme_style.c

xeno_theme_draw.o:	xeno_theme_draw.c xeno_theme_style.h xeno_theme_rc.h xeno_theme_main.h xeno_theme_enums.h xeno_theme_color.h xeno_theme_images.h
			$(COMPILE) xeno_theme_draw.c

xeno_theme_color.o:	xeno_theme_color.c xeno_theme_color.h xeno_theme_style.h xeno_theme_rc.h xeno_theme_images.h
			$(COMPILE) xeno_theme_color.c

xeno_theme_images.o:	xeno_theme_images.c xeno_theme_images.h xeno_theme_enums.h
			$(COMPILE) xeno_theme_images.c

xeno_theme_patches.o:	xeno_theme_patches.c xeno_theme_patches.h xeno_theme_main.h xeno_theme_rc.h xeno_theme_enums.h xeno_theme_main.h
			$(COMPILE) xeno_theme_patches.c


